Changeset 202910 in webkit
- Timestamp:
- Jul 7, 2016 9:24:14 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r202909 r202910 1 2016-07-07 Youenn Fablet <youenn@apple.com> 2 3 [Fetch API] Response constructor should throw in case of bad reason phrase 4 https://bugs.webkit.org/show_bug.cgi?id=159508 5 6 Reviewed by Alex Christensen. 7 8 * web-platform-tests/fetch/api/response/response-error-expected.txt: 9 1 10 2016-07-07 Youenn Fablet <youenn@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-error-expected.txt
r197162 r202910 5 5 PASS Throws RangeError when responseInit's status is 600 6 6 PASS Throws RangeError when responseInit's status is 1000 7 FAIL Throws TypeError when responseInit's statusText is 8 assert_throws: Expect TypeError exception 9 function "function () { new Response("", { "statusText" : statusTex..." did not throw 10 FAIL Throws TypeError when responseInit's statusText is Ā assert_throws: Expect TypeError exception Ā function "function () { new Response("", { "statusText" : statusTex..." did not throw 7 PASS Throws TypeError when responseInit's statusText is 8 9 PASS Throws TypeError when responseInit's statusText is Ā 11 10 PASS Throws TypeError when building a response with body and a body status of 204 12 11 PASS Throws TypeError when building a response with body and a body status of 205 -
trunk/Source/WebCore/ChangeLog
r202909 r202910 1 2016-07-07 Youenn Fablet <youenn@apple.com> 2 3 [Fetch API] Response constructor should throw in case of bad reason phrase 4 https://bugs.webkit.org/show_bug.cgi?id=159508 5 6 Reviewed by Alex Christensen. 7 8 Covered by rebased test. 9 10 * Modules/fetch/FetchResponse.cpp: 11 (WebCore::FetchResponse::initializeWith): Validating reason phrase with new routine. 12 Throwing a TypeError in case of error. 13 * platform/network/HTTPParsers.cpp: 14 (WebCore::isValidReasonPhrase): Added to validate reason phrase according 15 https://tools.ietf.org/html/rfc7230#section-3.1.2 16 * platform/network/HTTPParsers.h: 17 1 18 2016-07-07 Youenn Fablet <youenn@apple.com> 2 19 -
trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp
r202909 r202910 35 35 #include "ExceptionCode.h" 36 36 #include "FetchRequest.h" 37 #include "HTTPParsers.h" 37 38 #include "JSFetchResponse.h" 38 39 #include "ScriptExecutionContext.h" … … 87 88 } 88 89 89 // FIXME: Validate reason phrase (https://tools.ietf.org/html/rfc7230#section-3.1.2).90 90 String statusText; 91 if (!init.get("statusText", statusText) ) {91 if (!init.get("statusText", statusText) || !isValidReasonPhrase(statusText)) { 92 92 ec = TypeError; 93 93 return; -
trunk/Source/WebCore/platform/network/HTTPParsers.cpp
r202121 r202910 103 103 } 104 104 105 // See RFC 7230, Section 3.1.2. 106 bool isValidReasonPhrase(const String& value) 107 { 108 for (unsigned i = 0; i < value.length(); ++i) { 109 UChar c = value[i]; 110 if (c == 0x7F || c > 0xFF || (c < 0x20 && c != '\t')) 111 return false; 112 } 113 return true; 114 } 115 105 116 // See RFC 7230, Section 3.2.3. 106 117 bool isValidHTTPHeaderValue(const String& value) -
trunk/Source/WebCore/platform/network/HTTPParsers.h
r202121 r202910 70 70 71 71 ContentDispositionType contentDispositionType(const String&); 72 bool isValidReasonPhrase(const String&); 72 73 bool isValidHTTPHeaderValue(const String&); 73 74 bool isValidHTTPToken(const String&); 74 75 bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta, double& delay, String& url); 75 76 Optional<std::chrono::system_clock::time_point> parseHTTPDate(const String&); 76 String filenameFromHTTPContentDisposition(const String&); 77 String filenameFromHTTPContentDisposition(const String&); 77 78 String extractMIMETypeFromMediaType(const String&); 78 String extractCharsetFromMediaType(const String&); 79 String extractCharsetFromMediaType(const String&); 79 80 void findCharsetInMediaType(const String& mediaType, unsigned int& charsetPos, unsigned int& charsetLen, unsigned int start = 0); 80 81 XSSProtectionDisposition parseXSSProtectionHeader(const String& header, String& failureReason, unsigned& failurePosition, String& reportURL);
Note: See TracChangeset
for help on using the changeset viewer.