]> git.ipfire.org Git - thirdparty/tornado.git/commit
Begin to fix type confusion in HTTPHeaders. 1699/head
authorBen Darnell <ben@bendarnell.com>
Sat, 23 Apr 2016 23:34:23 +0000 (19:34 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 23 Apr 2016 23:34:23 +0000 (19:34 -0400)
commit10da549cbebf00a5cd3ad3898f141e56f5ede090
tree28e93742e14d1c186edbb4a7b3cbbd287404c941
parent49fef5384a05ed021682ccd19fb36551638427c3
Begin to fix type confusion in HTTPHeaders.

Values in HTTPHeaders were typed inconsistently: the class itself
assumed that values were of type str, while many callers assumed they
were bytes. Since headers are practically restricted to ascii, this
would work on python 2 but fail when certain combinations were
encountered on python 3 (notably the combination of GzipContentEncoding
with multiple preexisting Vary headers).

This commit adds a test and fixes the bug, and also adds enough type
annotations that mypy was able to report errors in the old incorrect
code.

Fixes #1670
tornado/escape.py
tornado/http1connection.py
tornado/httputil.py
tornado/test/web_test.py
tornado/util.py
tornado/web.py