From: Ben Darnell Date: Mon, 20 Feb 2012 05:30:15 +0000 (-0800) Subject: Use copy.deepcopy to clone HTTPRequest when following redirects. X-Git-Tag: v2.3.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7e604646537984e967dd25447a8df3e221bf9ed;p=thirdparty%2Ftornado.git Use copy.deepcopy to clone HTTPRequest when following redirects. This gives each request in a redirect chain its own copy of the headers dictionary. Closes #459. --- diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index aa2bec637..26c32d375 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -391,7 +391,7 @@ class _HTTPConnection(object): if (self.request.follow_redirects and self.request.max_redirects > 0 and self.code in (301, 302, 303, 307)): - new_request = copy.copy(self.request) + new_request = copy.deepcopy(self.request) new_request.url = urlparse.urljoin(self.request.url, self.headers["Location"]) new_request.max_redirects -= 1