RESOLVED FIXED 201721
Factor out duplicated functions from HTTPParsers.cpp and HTTPHeaderField.cpp
https://bugs.webkit.org/show_bug.cgi?id=201721
Summary Factor out duplicated functions from HTTPParsers.cpp and HTTPHeaderField.cpp
Adrian Perez
Reported 2019-09-12 08:41:52 PDT
WebCore/loader/HTTPHeaderField.cpp and WebCore/platform/network/HTTPParsers.cpp contain functions which duplicate functionality, namely: HTTPHeaderField.cpp HTTPParsers.cpp ============================= ===================================== RFC7230::isCommentText() isCommentTextCharacter() RFC7230::isOBSText() isOctetInFieldContentCharacter() RFC7230::isVisibleCharacter() isVisibleCharacter() RFC7230::isDelimiter() isDelimiterCharacter() RFC7230::isTokenCharacter() isHTTPTokenCharacter() There are also a couple of functions in HTTPParsers.cpp which could be simplieied by using helper function from HTTPHeaderField.cpp. For example skipWhiteSpace() could be written in terms of skipWhile()+RFC3270::isWhitespace(); skipQuotedPair() could use skipCharacter()+RFC7230::isQuotedPairSecondOctetValue() instead of duplicating the list of characters that can follow the backslash in a quoted pair, and so on.
Attachments
Patch (9.16 KB, patch)
2019-09-12 09:42 PDT, Adrian Perez
no flags
Adrian Perez
Comment 1 2019-09-12 09:42:58 PDT
Don Olmstead
Comment 2 2019-09-12 10:21:01 PDT
Comment on attachment 378651 [details] Patch r=me assuming bots are all green. You sure some unit tests wouldn't be of use while you're here?
Adrian Perez
Comment 3 2019-09-12 14:08:38 PDT
(In reply to Don Olmstead from comment #2) > Comment on attachment 378651 [details] > Patch > > r=me assuming bots are all green. Thanks Don! > You sure some unit tests wouldn't be of use while you're here? In patch in bug #201077 an unit test was added which calls WebCore::isValidUserAgentHeaderValue(). That test is now exercising the functions from the WebCore::RFC7230 namespace as well — those are direct translations from the definitions in the RFC, so I reckon that we do not need additional tests for them :)
Adrian Perez
Comment 4 2019-09-12 14:10:50 PDT
It's late for me today, so I will r+ tomorrow morning instead to be able to keep an eye on the bots
Adrian Perez
Comment 5 2019-09-12 14:13:28 PDT
(In reply to Adrian Perez from comment #4) > It's late for me today, so I will r+ tomorrow morning > instead to be able to keep an eye on the bots I meant cq+, of course O:-)
WebKit Commit Bot
Comment 6 2019-09-13 00:58:01 PDT
Comment on attachment 378651 [details] Patch Clearing flags on attachment: 378651 Committed r249826: <https://trac.webkit.org/changeset/249826>
WebKit Commit Bot
Comment 7 2019-09-13 00:58:03 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-09-13 00:59:19 PDT
Note You need to log in before you can comment on or make changes to this bug.