diff options
author | Georg Brandl <georg@python.org> | 2006-03-28 12:40:24 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-28 12:40:24 (GMT) |
commit | f1349cd05d31ba0a925d9931a7c437a9650c6488 (patch) | |
tree | 1c104179ce784202c1d3cdfdef34d8680ecfc5c6 /Lib/urllib.py | |
parent | 240ec6b9efc2d9d9a23ee76383051acc2df9e074 (diff) | |
download | cpython-f1349cd05d31ba0a925d9931a7c437a9650c6488.zip cpython-f1349cd05d31ba0a925d9931a7c437a9650c6488.tar.gz cpython-f1349cd05d31ba0a925d9931a7c437a9650c6488.tar.bz2 |
Bug #1459963: urllib2 now normalizes HTTP header names correctly
with title().
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index d1c50f6..d4573c6 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -118,7 +118,7 @@ class URLopener: self.proxies = proxies self.key_file = x509.get('key_file') self.cert_file = x509.get('cert_file') - self.addheaders = [('User-agent', self.version)] + self.addheaders = [('User-Agent', self.version)] self.__tempfiles = [] self.__unlink = os.unlink # See cleanup() self.tempcache = None @@ -314,8 +314,8 @@ class URLopener: h = httplib.HTTP(host) if data is not None: h.putrequest('POST', selector) - h.putheader('Content-type', 'application/x-www-form-urlencoded') - h.putheader('Content-length', '%d' % len(data)) + h.putheader('Content-Type', 'application/x-www-form-urlencoded') + h.putheader('Content-Length', '%d' % len(data)) else: h.putrequest('GET', selector) if proxy_auth: h.putheader('Proxy-Authorization', 'Basic %s' % proxy_auth) @@ -400,9 +400,9 @@ class URLopener: cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) - h.putheader('Content-type', + h.putheader('Content-Type', 'application/x-www-form-urlencoded') - h.putheader('Content-length', '%d' % len(data)) + h.putheader('Content-Length', '%d' % len(data)) else: h.putrequest('GET', selector) if proxy_auth: h.putheader('Proxy-Authorization: Basic %s' % proxy_auth) @@ -584,7 +584,7 @@ class URLopener: data = base64.decodestring(data) else: data = unquote(data) - msg.append('Content-length: %d' % len(data)) + msg.append('Content-Length: %d' % len(data)) msg.append('') msg.append(data) msg = '\n'.join(msg) |