Skip to content

Commit

Permalink
HttpStreamParser: Reject headers with nulls in them.
Browse files Browse the repository at this point in the history
While the HTTP spec further limits what values are legal, nulls are
particularly concerning, and it's safest just to reject them. See
discussion here: whatwg/xhr#165

Chrome will be the first browser to reject nulls in responses, despite
there being wpt tests for this, so we'll have to keep an eye out for
breakages.

For reference, 0x00 through 0x1F aren't allowed in header values or
fields, (https://tools.ietf.org/html/rfc7230#section-3.2 - VCHAR
excludes those characters).  CRs and LFs are of course needed, and
0x0C and 0x0B are allowed by other specs for particular
header parsers, strangely.

This CL does not affect other code that can generate HTTP response
headers, which still uses the old behavior of just removing nulls.
ServiceWorkers, extensions, WebPackages, Dial (?), and various tests
still inherit the old behavior, since they create headers directly
with a method that can't fail.  It does introduce a new helper method,
however, that they should eventually be switched to use:
HttpResponseHeaders::TryToCreate().  We should probably put off
conversion until this successfully makes it to stable.

Bug: 832086
Change-Id: Ib75ac03a6a298238cafb41eaa5f046c082fd0bdf
Reviewed-on: https://chromium-review.googlesource.com/c/1291812
Reviewed-by: Asanka Herath <asanka@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601776}
  • Loading branch information
Matt Menke authored and chromium-wpt-export-bot committed Oct 22, 2018
1 parent 5af37dd commit 89637ce
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion cookies/http-state/chromium-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ <h3>Test Results</h3>
{file: "disabled-chromium0020", name: "disabled-chromium0020"},
{file: "chromium0021", name: "chromium0021"},
{file: "disabled-chromium0022", name: "disabled-chromium0022"},
{file: "disabled-chromium0023", name: "disabled-chromium0023"},
];

for (const i in TEST_CASES) {
Expand Down
Binary file not shown.

This file was deleted.

This file was deleted.

0 comments on commit 89637ce

Please sign in to comment.