[ python-Bugs-649962 ] All URL funcs mishandle file://localhost

SourceForge.net noreply at sourceforge.net
Wed Mar 17 14:48:02 EST 2004


Bugs item #649962, was opened at 2002-12-07 01:28
Message generated for change (Comment added) made by mike_j_brown
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=649962&group_id=5470

Category: Python Library
Group: Python 2.2.1
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Mike Brown (mike_j_brown)
Assigned to: Nobody/Anonymous (nobody)
Summary: All URL funcs mishandle file://localhost

Initial Comment:
Per RFC 1738 section 3.10: "A file URL takes the form: 
file://<host>/<path> ... As a special case, <host> can 
be the string "localhost" or the empty string; this is 
interpreted as `the machine from which the URL is being 
interpreted".

In other words, regardless of what DNS or NetBIOS say 
about "localhost", it is always the local machine.

Therefore, functions like urllib.url2pathname() and 
urllib.urlopen() and anything else that takes a URL 
argument should treat &#039;///path/to/file&#039; 
and &#039;//localhost/path/to/file&#039; identically, 
returning &#039;/path/to/file&#039; on Unix or &#039;\path\to\file&#039; on 
Windows, for example.

(note separate bug report filed for url2pathname() 
mishandling &#039;///path/to/file&#039; on Windows)


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

>Comment By: Mike Brown (mike_j_brown)
Date: 2004-03-17 12:48

Message:
Logged In: YES 
user_id=371366

I didn't realize it was a duplicate. I'm OK with the resolution 
of #607789. So I am changing this one to Closed / Duplicate.

In hindsight, I feel there are so many little conformance bugs 
in urllib that are so entrenched, there's no reason to assume 
that true RFC conformance was ever the intent or that it is a 
reasonable goal. Much code out there, within core Python libs 
and without, is written to match urllib's current behavior, or 
vice-versa.

If anyone's curious, I have implemented some urllib 
workarounds and RFC 2396bis (new version of RFC 2396, the 
URI spec) compliant features in 4Suite's Ft.Lib.Uri module, 
which can be reviewed at http://cvs.4suite.org/cgi-
bin/viewcvs.cgi/~checkout~/4Suite/Ft/Lib/Uri.py?
rev=HEAD&content-type=text/plain  ... it's always a work in 
progress, but is getting close to having a fork stuck in it for 
our upcoming 1.0 release.

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

Comment By: troy melhase (troy_melhase)
Date: 2004-03-16 14:03

Message:
Logged In: YES 
user_id=548370

Should be closed; duplicate of bug #607789, now closed.

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

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



More information about the Python-bugs-list mailing list