New issue
Advanced search Search tips

Issue 866787 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jul 26
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 736308



Sign in to add a comment

net::HttpResponseHeaders::GetNormalizedHeader doesn't work with empty header values

Project Member Reported by yhirano@chromium.org, Jul 24

Issue description

https://tools.ietf.org/html/rfc7230#section-3.2 allows empty field values.

     header-field   = field-name ":" OWS field-value OWS

     field-name     = token
     field-value    = *( field-content / obs-fold )
     field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
     field-vchar    = VCHAR / obs-text

A recipient MAY combine multiple header fields with the same name into one.

   A recipient MAY combine multiple header fields with the same field
   name into one "field-name: field-value" pair, without changing the
   semantics of the message, by appending each subsequent field value to
   the combined field value in order, separated by a comma.  The order
   in which header fields with the same field name are received is
   therefore significant to the interpretation of the combined field
   value; a proxy MUST NOT change the order of these field values when
   forwarding a message.

Hence, if we have response headers r such as

 name:
 name: abc

, r->GetNormalizedHeaders("x", &value) should return true and |value|
should be ", abc". Now it returns true but |value| is "abc".



 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 25

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b53bca17f41038da87367186e37bcad0165719c8

commit b53bca17f41038da87367186e37bcad0165719c8
Author: Yutaka Hirano <yhirano@chromium.org>
Date: Wed Jul 25 12:53:58 2018

Fix empty value handling of HttpResponseHeaders::GetNormalizedHeader

Per RFC7230 empty header field is valid, but
HttpResponseHeaders::GetNormalizedHeader sometimes ignores empty values.
This CL fixes the issue.

Bug:  866787 , 736308
Change-Id: I227e18e413740e345d557e2c24a25e45e68b0ae8
Reviewed-on: https://chromium-review.googlesource.com/1148091
Reviewed-by: Helen Li <xunjieli@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577852}
[modify] https://crrev.com/b53bca17f41038da87367186e37bcad0165719c8/net/http/http_response_headers.cc
[modify] https://crrev.com/b53bca17f41038da87367186e37bcad0165719c8/net/http/http_response_headers_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment