From f41306da0fc7cc07b45e685bb28f57448df3c332 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 26 May 2012 10:54:34 -0700 Subject: [PATCH] Override dict.copy in HTTPHeaders to return the correct type. Closes #519. --- tornado/httputil.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tornado/httputil.py b/tornado/httputil.py index 7d884e28b..2cbf677bf 100644 --- a/tornado/httputil.py +++ b/tornado/httputil.py @@ -154,6 +154,10 @@ class HTTPHeaders(dict): for k, v in dict(*args, **kwargs).iteritems(): self[k] = v + def copy(self): + # default implementation returns dict(self), not the subclass + return HTTPHeaders(self) + _NORMALIZED_HEADER_RE = re.compile(r'^[A-Z0-9][a-z0-9]*(-[A-Z0-9][a-z0-9]*)*$') _normalized_headers = {} -- 2.47.2