[Python-bugs-list] [ python-Bugs-607789 ] urllib doesn't handle file://localhost

noreply@sourceforge.net noreply@sourceforge.net
Thu, 12 Sep 2002 14:07:34 -0700


Bugs item #607789, was opened at 2002-09-11 14:31
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607789&group_id=5470

Category: Python Library
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Jack Jansen (jackjansen)
Assigned to: Jack Jansen (jackjansen)
Summary: urllib doesn't handle file://localhost

Initial Comment:
Urllib handles "file:/foo" and "file:///foo" locally, but not "file://localhost/foo". The later is passed to the ftp handler, which will fail if there is no ftp server running on the system.

All other tools I've inspected handle the file://localhost/foo convention without going through ftp.

The fix is easy enough, but I thought I'd give the RFC-police a chance to look at this before I go against one of the more subtle aspects of URL semantics. Feel free to assign back to me to fix it.

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2002-09-12 22:15

Message:
Logged In: YES 
user_id=45365

Fixed in urllib.py 1.152. Skip's suggestion to use .lower() before testing for "localhost/" did uncover a MacOSX bug, though: the lookup of "localhost" is case-sensitive:-) 

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-11 18:06

Message:
Logged In: YES 
user_id=6380

Strange you'd think that I'm the RFC police. :-)

I know nothing about what the RFC says about this, or
whether the RFC is relevant to best practice. I'd like to
see your patch!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=607789&group_id=5470