[Python-Dev] urllib2 doesn't grok URLs w/ user/passwd
John J Lee
jjl at pobox.com
Tue Dec 30 16:55:45 EST 2003
On Tue, 30 Dec 2003, Alex Martelli wrote:
> On Tuesday 30 December 2003 04:03 pm, Skip Montanaro wrote:
> > SF seems to be down for some unscheduled reason. Posting here just so I
> > don't completely forget about it should I exit my web browser before SF is
> > back up...
> > urllib2.urlopen("http://email@example.com/") fails (at least in part)
> > because it fails to separate the username and password from the hostname.
> > Trying to open http://foo:firstname.lastname@example.org/ reveals other shortcomings in
> Presumably they need to be kept somewhere and sent in the Authorization
> header in case the server returns a 401 error and challenge (or a proxy
> returns a 407 error and challenge) -- or maybe the Authorization header
urllib2 already knows about this syntax for proxy auth
(ProxyHandler.proxy_open). If somebody fixes this (assuming it needs
fixing -- I haven't read what the standards say), note that the Basic
authentication logic is duplicated, and perhaps broken in one place, which
should probably be fixed at the same time:
If nobody does it first, I'll fix it *eventually* (I'm lazy about
configuring a local proxy and web server...).
BTW, is somebody planning a 2.3.4 (or 2.2.4)? When? That would motivate
me to fix urllib2 bugs sooner.
More information about the Python-Dev