<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210077] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210077">210077</a></dd>
<dt>Author</dt> <dd>wilander@apple.com</dd>
<dt>Date</dt> <dd>2016-12-21 14:06:22 -0800 (Wed, 21 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Switch to a blacklist model for restricted Accept headers in simple CORS requests
https://bugs.webkit.org/show_bug.cgi?id=166363
Reviewed by Alex Christensen.
Source/WebCore:
Updated existing tests.
* platform/network/HTTPParsers.cpp:
(WebCore::isDelimiterCharacter):
Convenience function for checking delimiter characters according to:
https://tools.ietf.org/html/rfc7230#section-3.2.6
(WebCore::isValidAcceptHeaderValue):
Now uses WebCore::isDelimiterCharacter() to blacklist delimiter characters
instead of a whitelist of accepted non-alphanumeric characters.
LayoutTests:
* http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt:
* http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestcorsnonstandardsafelistedheadersshouldtriggerpreflightexpectedtxt">trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsxmlhttprequestcorsnonstandardsafelistedheadersshouldtriggerpreflighthtml">trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkHTTPParserscpp">trunk/Source/WebCore/platform/network/HTTPParsers.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210076 => 210077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-21 22:02:48 UTC (rev 210076)
+++ trunk/LayoutTests/ChangeLog        2016-12-21 22:06:22 UTC (rev 210077)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-12-21 John Wilander <wilander@apple.com>
+
+ Switch to a blacklist model for restricted Accept headers in simple CORS requests
+ https://bugs.webkit.org/show_bug.cgi?id=166363
+
+ Reviewed by Alex Christensen.
+
+ * http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt:
+ * http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html:
+
</ins><span class="cx"> 2016-12-21 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Add a layout test for scroll snapping with padding in the container
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestcorsnonstandardsafelistedheadersshouldtriggerpreflightexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt (210076 => 210077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt        2016-12-21 22:02:48 UTC (rev 210076)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight-expected.txt        2016-12-21 22:06:22 UTC (rev 210077)
</span><span class="lines">@@ -3,11 +3,29 @@
</span><span class="cx"> CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Content-Language is not allowed by Access-Control-Allow-Headers.
</span><span class="cx"> CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Content-Language is not allowed by Access-Control-Allow-Headers.
</span><span class="cx"> CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
</span><del>-PASS Accept header with normal value SHOULD NOT cause a preflight
-PASS Accept header value with all allowed non-alphanumeric characters SHOULD NOT cause a preflight
-PASS Accept-Language header with normal value SHOULD NOT cause a preflight
</del><ins>+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/cors-preflight-safelisted-headers-responder.php. Request header field Accept is not allowed by Access-Control-Allow-Headers.
+PASS Accept header value 'application/json,text/*,*/*' SHOULD NOT cause a preflight
+PASS Accept header with normal value 'application/vnd.api+json' SHOULD NOT cause a preflight
+PASS Accept header with normal value 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c' SHOULD NOT cause a preflight
+PASS Accept header with normal value 'text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5' SHOULD NOT cause a preflight
+PASS Accept header value with all allowed delimiter characters SHOULD NOT cause a preflight
+PASS Accept-Language header value 'en-US,en;q=0.8' SHOULD NOT cause a preflight
+PASS Accept-Language header value 'zh-Latn-CN-variant1-a-extend1-x-wadegile-private1' SHOULD NOT cause a preflight
</ins><span class="cx"> PASS Accept-Language header value with all allowed non-alphanumeric characters SHOULD NOT cause a preflight
</span><del>-PASS Content-Language header with normal value SHOULD NOT cause a preflight
</del><ins>+PASS Content-Language header value 'en-US,en;q=0.8' SHOULD NOT cause a preflight
+PASS Content-Language header value 'zh-Latn-CN-variant1-a-extend1-x-wadegile-private1' SHOULD NOT cause a preflight
</ins><span class="cx"> PASS Content-Language header value with all allowed non-alphanumeric characters SHOULD NOT cause a preflight
</span><span class="cx"> PASS Accept header with abnormal value SHOULD cause a preflight
</span><span class="cx"> PASS Accept-Language header with abnormal value SHOULD cause a preflight
</span><span class="lines">@@ -18,4 +36,17 @@
</span><span class="cx"> PASS Content-Language header with abnormal value and explicitly allowed headers SHOULD be allowed
</span><span class="cx"> PASS Accept header with normal value, Accept-Language header with normal value, Content-Language header with abnormal value, and explicitly allowed headers SHOULD be allowed
</span><span class="cx"> PASS Accept header with normal value, then another Accept header with abnormal value, and explicitly allowed headers SHOULD be allowed
</span><ins>+PASS Accept header with disallowed delimiter '"' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '(' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter ')' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter ':' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '<' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '>' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '?' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '@' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '[' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '\' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter ']' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '{' SHOULD cause a preflight
+PASS Accept header with disallowed delimiter '}' SHOULD cause a preflight
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsxmlhttprequestcorsnonstandardsafelistedheadersshouldtriggerpreflighthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html (210076 => 210077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html        2016-12-21 22:02:48 UTC (rev 210076)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/cors-non-standard-safelisted-headers-should-trigger-preflight.html        2016-12-21 22:06:22 UTC (rev 210077)
</span><span class="lines">@@ -34,7 +34,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> var abnormalSimpleCorsHeaderValue = "() { :;};"
</span><del>- var allAllowedNonAlphanumericCharactersForAcceptHeader = " *,./;="
</del><ins>+ var allAllowedDelimiterCharactersForAcceptHeader = ",/;="
+ var allDisallowedDelimiterCharactersForAcceptHeader = ['"', '(', ')', ':', '<', '>', '?', '@', '[', '\\', ']', '{', '}'];
</ins><span class="cx"> var allAllowedNonAlphanumericCharactersForAcceptAndContentLanguageHeader = " *,-.;="
</span><span class="cx"> var testCases = [
</span><span class="cx"> // Positive test cases with normal headers
</span><span class="lines">@@ -42,21 +43,45 @@
</span><span class="cx"> headersToAdd: [{ name : "Accept", value: "application/json,text/*,*/*" }],
</span><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><del>- description: "Accept header with normal value SHOULD NOT cause a preflight"
</del><ins>+ description: "Accept header value 'application/json,text/*,*/*' SHOULD NOT cause a preflight"
</ins><span class="cx"> }
</span><span class="cx"> ,{
</span><del>- headersToAdd: [{ name : "Accept", value: allAllowedNonAlphanumericCharactersForAcceptHeader }],
</del><ins>+ headersToAdd: [{ name : "Accept", value: "application/vnd.api+json" }],
</ins><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><del>- description: "Accept header value with all allowed non-alphanumeric characters SHOULD NOT cause a preflight"
</del><ins>+ description: "Accept header with normal value 'application/vnd.api+json' SHOULD NOT cause a preflight"
</ins><span class="cx"> }
</span><span class="cx"> ,{
</span><ins>+ headersToAdd: [{ name : "Accept", value: "text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c" }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: false,
+ description: "Accept header with normal value 'text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c' SHOULD NOT cause a preflight"
+ }
+ ,{
+ headersToAdd: [{ name : "Accept", value: "text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5" }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: false,
+ description: "Accept header with normal value 'text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5' SHOULD NOT cause a preflight"
+ }
+ ,{
+ headersToAdd: [{ name : "Accept", value: allAllowedDelimiterCharactersForAcceptHeader }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: false,
+ description: "Accept header value with all allowed delimiter characters SHOULD NOT cause a preflight"
+ }
+ ,{
</ins><span class="cx"> headersToAdd: [{ name : "Accept-Language", value: "en-US,en;q=0.8" }],
</span><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><del>- description: "Accept-Language header with normal value SHOULD NOT cause a preflight"
</del><ins>+ description: "Accept-Language header value 'en-US,en;q=0.8' SHOULD NOT cause a preflight"
</ins><span class="cx"> }
</span><span class="cx"> ,{
</span><ins>+ headersToAdd: [{ name : "Accept-Language", value: "zh-Latn-CN-variant1-a-extend1-x-wadegile-private1" }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: false,
+ description: "Accept-Language header value 'zh-Latn-CN-variant1-a-extend1-x-wadegile-private1' SHOULD NOT cause a preflight"
+ }
+ ,{
</ins><span class="cx"> headersToAdd: [{ name : "Accept-Language", value: allAllowedNonAlphanumericCharactersForAcceptAndContentLanguageHeader }],
</span><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><span class="lines">@@ -63,12 +88,18 @@
</span><span class="cx"> description: "Accept-Language header value with all allowed non-alphanumeric characters SHOULD NOT cause a preflight"
</span><span class="cx"> }
</span><span class="cx"> ,{
</span><del>- headersToAdd: [{ name : "Content-Language", value: "en" }],
</del><ins>+ headersToAdd: [{ name : "Content-Language", value: "en-US,en;q=0.8" }],
</ins><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><del>- description: "Content-Language header with normal value SHOULD NOT cause a preflight"
</del><ins>+ description: "Content-Language header value 'en-US,en;q=0.8' SHOULD NOT cause a preflight"
</ins><span class="cx"> }
</span><span class="cx"> ,{
</span><ins>+ headersToAdd: [{ name : "Content-Language", value: "zh-Latn-CN-variant1-a-extend1-x-wadegile-private1" }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: false,
+ description: "Content-Language header value 'zh-Latn-CN-variant1-a-extend1-x-wadegile-private1' SHOULD NOT cause a preflight"
+ }
+ ,{
</ins><span class="cx"> headersToAdd: [{ name : "Content-Language", value: allAllowedNonAlphanumericCharactersForAcceptAndContentLanguageHeader }],
</span><span class="cx"> explicitlyAllowHeaders: false,
</span><span class="cx"> shouldCausePreflight: false,
</span><span class="lines">@@ -132,6 +163,19 @@
</span><span class="cx"> }
</span><span class="cx"> ];
</span><span class="cx">
</span><ins>+ // Individual negative test cases for each disallowed delimiter character in Accept header values.
+ for (var i = 0; i < allDisallowedDelimiterCharactersForAcceptHeader.length; i++) {
+ var disallowedDelimiter = allDisallowedDelimiterCharactersForAcceptHeader[i];
+ testCases.push(
+ {
+ headersToAdd: [{ name : "Accept", value: disallowedDelimiter }],
+ explicitlyAllowHeaders: false,
+ shouldCausePreflight: true,
+ description: "Accept header with disallowed delimiter '" + disallowedDelimiter + "' SHOULD cause a preflight"
+ }
+ );
+ }
+
</ins><span class="cx"> function runTestCase(testNumber) {
</span><span class="cx"> var testCase = testCases[testNumber];
</span><span class="cx"> xhr = new XMLHttpRequest();
</span><span class="lines">@@ -157,4 +201,4 @@
</span><span class="cx"> runTestCase(0);
</span><span class="cx"> </script>
</span><span class="cx"> </body>
</span><del>-</html>
</del><span class="cx">\ No newline at end of file
</span><ins>+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210076 => 210077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-21 22:02:48 UTC (rev 210076)
+++ trunk/Source/WebCore/ChangeLog        2016-12-21 22:06:22 UTC (rev 210077)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-12-21 John Wilander <wilander@apple.com>
+
+ Switch to a blacklist model for restricted Accept headers in simple CORS requests
+ https://bugs.webkit.org/show_bug.cgi?id=166363
+
+ Reviewed by Alex Christensen.
+
+ Updated existing tests.
+
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::isDelimiterCharacter):
+ Convenience function for checking delimiter characters according to:
+ https://tools.ietf.org/html/rfc7230#section-3.2.6
+ (WebCore::isValidAcceptHeaderValue):
+ Now uses WebCore::isDelimiterCharacter() to blacklist delimiter characters
+ instead of a whitelist of accepted non-alphanumeric characters.
+
</ins><span class="cx"> 2016-12-21 Beth Dakin <bdakin@apple.com>
</span><span class="cx">
</span><span class="cx"> Holding down on candidates in the TouchBar should show panel on screen
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkHTTPParserscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (210076 => 210077)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp        2016-12-21 22:02:48 UTC (rev 210076)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp        2016-12-21 22:06:22 UTC (rev 210077)
</span><span class="lines">@@ -127,20 +127,31 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// See RFC 7231, Section 5.3.2
</del><ins>+// See RFC 7230, Section 3.2.6.
+static bool isDelimiterCharacter(const UChar c)
+{
+ // DQUOTE and "(),/:;<=>?@[\]{}"
+ return (c == '"' || c == '(' || c == ')' || c == ',' || c == '/' || c == ':' || c == ';'
+ || c == '<' || c == '=' || c == '>' || c == '?' || c == '@' || c == '[' || c == '\\'
+ || c == ']' || c == '{' || c == '}');
+}
+
+// See RFC 7231, Section 5.3.2.
</ins><span class="cx"> bool isValidAcceptHeaderValue(const String& value)
</span><span class="cx"> {
</span><span class="cx"> for (unsigned i = 0; i < value.length(); ++i) {
</span><span class="cx"> UChar c = value[i];
</span><del>- if (isASCIIAlphanumeric(c) || c == ' ' || c == '*' || c == ',' || c == '.' || c == '/' || c == ';' || c == '=')
</del><ins>+ // First check for alphanumeric for performance reasons then whitelist four delimiter characters.
+ if (isASCIIAlphanumeric(c) || c == ',' || c == '/' || c == ';' || c == '=')
</ins><span class="cx"> continue;
</span><del>- return false;
</del><ins>+ if (isDelimiterCharacter(c))
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// See RFC 7231, Section 5.3.5 and 3.1.3.2
</del><ins>+// See RFC 7231, Section 5.3.5 and 3.1.3.2.
</ins><span class="cx"> bool isValidLanguageHeaderValue(const String& value)
</span><span class="cx"> {
</span><span class="cx"> for (unsigned i = 0; i < value.length(); ++i) {
</span></span></pre>
</div>
</div>
</body>
</html>