aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/http/headers.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-05-29 11:14:46 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-05-29 11:14:46 +1200
commited415877d48251774012bd6aad4be91e9d558b79 (patch)
treee12a399c6df498f24aa5eeb9652dfaa90ab98dae /netlib/http/headers.py
parent00426534982ab7fba5617ad6422c13483a8e6521 (diff)
parent7971dce2231bc32c25b962d425d8ad935568a699 (diff)
downloadmitmproxy-ed415877d48251774012bd6aad4be91e9d558b79.tar.gz
mitmproxy-ed415877d48251774012bd6aad4be91e9d558b79.tar.bz2
mitmproxy-ed415877d48251774012bd6aad4be91e9d558b79.zip
Merge branch 'master' into solidcore
Diffstat (limited to 'netlib/http/headers.py')
-rw-r--r--netlib/http/headers.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/netlib/http/headers.py b/netlib/http/headers.py
index 60d3f429..2caf8d51 100644
--- a/netlib/http/headers.py
+++ b/netlib/http/headers.py
@@ -14,12 +14,18 @@ from ..utils import always_bytes
# See also: http://lucumr.pocoo.org/2013/7/2/the-updated-guide-to-unicode/
if six.PY2: # pragma: no cover
- _native = lambda x: x
- _always_bytes = lambda x: x
+ def _native(x):
+ return x
+
+ def _always_bytes(x):
+ return x
else:
# While headers _should_ be ASCII, it's not uncommon for certain headers to be utf-8 encoded.
- _native = lambda x: x.decode("utf-8", "surrogateescape")
- _always_bytes = lambda x: always_bytes(x, "utf-8", "surrogateescape")
+ def _native(x):
+ return x.decode("utf-8", "surrogateescape")
+
+ def _always_bytes(x):
+ return always_bytes(x, "utf-8", "surrogateescape")
class Headers(MultiDict):