Fix to ignore empty header value.

According to Augmented BNF in the following RFCs

http://tools.ietf.org/html/rfc5234#section-3.6

http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.1

        field-value    = *( field-content | LWS )

http://tools.ietf.org/html/rfc7230#section-3.2

        field-value    = *( field-content / obs-fold )

... the HTTP message header `field-value` is allowed to be empty.
This commit is contained in:
Benjamin Lee 2015-11-17 04:51:20 +11:00
parent 0df7e27c3b
commit c1385c9a17
1 changed files with 1 additions and 1 deletions

View File

@ -321,7 +321,7 @@ def _read_headers(rfile):
try:
name, value = line.split(b":", 1)
value = value.strip()
if not name or not value:
if not name:
raise ValueError()
ret.append([name, value])
except ValueError: