RESOLVED FIXED 200475
Fix inefficiency in HTTPHeaderMap::set(CFStringRef, const String&)
https://bugs.webkit.org/show_bug.cgi?id=200475
Summary Fix inefficiency in HTTPHeaderMap::set(CFStringRef, const String&)
Chris Dumez
Reported 2019-08-06 11:54:43 PDT
Fix inefficiency in HTTPHeaderMap::set(CFStringRef, const String&).
Attachments
Patch (3.69 KB, patch)
2019-08-06 11:57 PDT, Chris Dumez
no flags
Patch (9.72 KB, patch)
2019-08-06 12:30 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2019-08-06 11:57:32 PDT
Darin Adler
Comment 2 2019-08-06 12:00:39 PDT
Comment on attachment 375639 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375639&action=review > Source/WebCore/platform/network/HTTPHeaderMap.cpp:75 > + if (findHTTPHeaderName(StringView(reinterpret_cast<const LChar*>(nameCharacters), length), headerName)) > + set(headerName, value); > + else > + setUncommonHeader(String(nameCharacters, length), value); Strikes me as strange that StringView requires the cast to LChar* and String does not.
Chris Dumez
Comment 3 2019-08-06 12:02:24 PDT
(In reply to Darin Adler from comment #2) > Comment on attachment 375639 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=375639&action=review > > > Source/WebCore/platform/network/HTTPHeaderMap.cpp:75 > > + if (findHTTPHeaderName(StringView(reinterpret_cast<const LChar*>(nameCharacters), length), headerName)) > > + set(headerName, value); > > + else > > + setUncommonHeader(String(nameCharacters, length), value); > > Strikes me as strange that StringView requires the cast to LChar* and String > does not. StringView(const LChar*, unsigned length); StringView(const UChar*, unsigned length); StringView(const char*); We're missing: StringView(const char*, unsigned length); Should I add it?
Darin Adler
Comment 4 2019-08-06 12:09:08 PDT
(In reply to Chris Dumez from comment #3) > StringView(const LChar*, unsigned length); > StringView(const UChar*, unsigned length); > StringView(const char*); > > We're missing: > StringView(const char*, unsigned length); > > Should I add it? Yes. If we already have the one without a length, then yes I think you should add it. The counter argument is that if we have a "const char*" with UTF-8 in it, we don’t want someone to accidentally interpret it as Latin-1. But I’m not sure that leaving this one particular overload out of StringView helps much with that problem.
Chris Dumez
Comment 5 2019-08-06 12:30:00 PDT
WebKit Commit Bot
Comment 6 2019-08-06 14:45:39 PDT
Comment on attachment 375643 [details] Patch Clearing flags on attachment: 375643 Committed r248316: <https://trac.webkit.org/changeset/248316>
WebKit Commit Bot
Comment 7 2019-08-06 14:45:41 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-08-06 14:46:24 PDT
Note You need to log in before you can comment on or make changes to this bug.