Patches item #1574068, was opened at 2006-10-09 17:40 Message generated for change (Comment added) made by geekmug You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1574068&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library (Lib) Group: None Status: Open Resolution: None Priority: 5 Submitted By: Scott Dial (geekmug) Assigned to: Nobody/Anonymous (nobody) Summary: urllib2 - Fix line breaks in authorization headers Initial Comment: urllib2 uses the wrong base64 encode function from the base64 library. This patch corrects that. Original bug report from "The Doctor What" <[EMAIL PROTECTED]> I found a bug in urllib2's handling of basic HTTP authentication. urllib2 uses the base64.encodestring() method to encode the username:password. The problem is that base64.encodestring() adds newlines to wrap the encoded characters at the 76th column. This produces bogus request headers like this: ---------->8---------cut---------8<---------------- GET /some/url HTTP/1.1 Host: some.host Accept-Encoding: identity Authorization: Basic cmVhbGx5bG9uZ3VzZXJuYW1lOmFuZXZlbmxvbmdlcnBhc3N3b3JkdGhhdGdvZXNvbmFuZG9uYW5k b25hbmRvbmFuZG9u User-agent: some-agent ---------->8---------cut---------8<---------------- ---------------------------------------------------------------------- >Comment By: Scott Dial (geekmug) Date: 2006-10-09 20:33 Message: Logged In: YES user_id=383208 Ah yes, you are correct that urllib has the same problem. I have attached a patch to correct all of those instances as well. It is note-worthy that the one usage of decodestring in urllib is correct (as it is decoding the body of the response and should reasonably expect to see newlines in that encoding). ---------------------------------------------------------------------- Comment By: John J Lee (jjlee) Date: 2006-10-09 20:13 Message: Logged In: YES user_id=261020 urllib should also be fixed. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1574068&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
