This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scott.dial
Recipients
Date 2006-10-09.21:40:51
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
urllib2 uses the wrong base64 encode function from the
base64 library. This patch corrects that.

Original bug report from "The Doctor What"
<docwhat+list.python-dev@gerf.org>

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<----------------
History
Date User Action Args
2007-08-23 15:54:55adminlinkissue1574068 messages
2007-08-23 15:54:55admincreate