Handle Transfer-Encoding header values case insensitive

According to HTTP/1.1 RFC 2616 Section 3.6.
This commit is contained in:
Michael Frister 2012-03-08 23:08:08 +01:00
parent 883424030f
commit e67dbf6123

View File

@ -106,7 +106,7 @@ def read_chunked(fp, limit):
def read_http_body(rfile, connection, headers, all, limit): def read_http_body(rfile, connection, headers, all, limit):
if 'transfer-encoding' in headers: if 'transfer-encoding' in headers:
if not ",".join(headers["transfer-encoding"]) == "chunked": if not ",".join(headers["transfer-encoding"]).lower() == "chunked":
raise IOError('Invalid transfer-encoding') raise IOError('Invalid transfer-encoding')
content = read_chunked(rfile, limit) content = read_chunked(rfile, limit)
elif "content-length" in headers: elif "content-length" in headers: