[Python-checkins] python/dist/src/Lib urllib2.py,1.35,1.36
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
2002年10月11日 10:26:49 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11038
Modified Files:
urllib2.py
Log Message:
Fix for SF bug #599836: Don't duplicate headers.
If the request object has a header, it should override the default
header provided by the OpenerDirector.
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** urllib2.py 9 Oct 2002 23:17:04 -0000 1.35
--- urllib2.py 11 Oct 2002 17:26:46 -0000 1.36
***************
*** 248,252 ****
def __init__(self):
server_version = "Python-urllib/%s" % __version__
! self.addheaders = [('User-agent', server_version)]
# manage the individual handlers
self.handlers = []
--- 248,252 ----
def __init__(self):
server_version = "Python-urllib/%s" % __version__
! self.addheaders = [('User-Agent', server_version)]
# manage the individual handlers
self.handlers = []
***************
*** 772,776 ****
h.putheader('Host', sel_host or host)
for args in self.parent.addheaders:
! h.putheader(*args)
for k, v in req.headers.items():
h.putheader(k, v)
--- 772,777 ----
h.putheader('Host', sel_host or host)
for args in self.parent.addheaders:
! if name not in req.headers:
! h.putheader(*args)
for k, v in req.headers.items():
h.putheader(k, v)