diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2006-10-27 17:11:23 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2006-10-27 17:11:23 (GMT) |
commit | 872dba42538b201b0eed9eeb093183d34c57ab3f (patch) | |
tree | d19e0b070595d1f2c6f017a5a03750c069f51827 /Lib/urllib.py | |
parent | 6d72b0e1f8c6e096aab46aa53d7081df4e3d8153 (diff) | |
download | cpython-872dba42538b201b0eed9eeb093183d34c57ab3f.zip cpython-872dba42538b201b0eed9eeb093183d34c57ab3f.tar.gz cpython-872dba42538b201b0eed9eeb093183d34c57ab3f.tar.bz2 |
[Patch #1574068 by Scott Dial] urllib and urllib2 were using
base64.encodestring() for encoding authentication data.
encodestring() can include newlines for very long input, which
produced broken HTTP headers.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 8d56690..064632c 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -302,13 +302,13 @@ class URLopener: if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTP(host) @@ -387,12 +387,12 @@ class URLopener: if not host: raise IOError, ('https error', 'no host given') if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, |