summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/request.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-09-27 01:28:10 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-09-27 01:28:10 (GMT)
commit603ca41e27ed67716dd31e6f7e286a137936cc4b (patch)
tree1ae8a4d39af2f432913fa0f9c0c347a2a8d02739 /Lib/urllib/request.py
parent1a0eb98b9c41224f6ea8fd8f87687f79f723ba8c (diff)
downloadcpython-603ca41e27ed67716dd31e6f7e286a137936cc4b.zip
cpython-603ca41e27ed67716dd31e6f7e286a137936cc4b.tar.gz
cpython-603ca41e27ed67716dd31e6f7e286a137936cc4b.tar.bz2
Merged revisions 85025 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85025 | senthil.kumaran | 2010-09-27 06:56:03 +0530 (Mon, 27 Sep 2010) | 6 lines Fix Issue1595365 - Adding the req.headers after the un-redirect headers have been added. This helps in accidental overwritting of User-Agent header to default value. To preserve the old behavior, only headers not in unredirected headers will be updated. ........
Diffstat (limited to 'Lib/urllib/request.py')
-rw-r--r--Lib/urllib/request.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index c638cfa5..464f847 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1063,8 +1063,10 @@ class AbstractHTTPHandler(BaseHandler):
raise URLError('no host given')
h = http_class(host, timeout=req.timeout) # will parse host:port
- headers = dict(req.headers)
- headers.update(req.unredirected_hdrs)
+
+ headers = dict(req.unredirected_hdrs)
+ headers.update(dict((k, v) for k, v in req.headers.items()
+ if k not in headers))
# TODO(jhylton): Should this be redesigned to handle
# persistent connections?