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.

classification
Title: All URL funcs mishandle file://localhost
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: mike_j_brown, troy_melhase
Priority: normal Keywords:

Created on 2002-12-07 08:28 by mike_j_brown, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg13546 - (view) Author: Mike Brown (mike_j_brown) Date: 2002-12-07 08:28
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 '///path/to/file' 
and '//localhost/path/to/file' identically, 
returning '/path/to/file' on Unix or '\path\to\file' on 
Windows, for example.

(note separate bug report filed for url2pathname() 
mishandling '///path/to/file' on Windows)
msg13547 - (view) Author: Troy Melhase (troy_melhase) Date: 2004-03-16 21:03
Logged In: YES 
user_id=548370

Should be closed; duplicate of bug #607789, now closed.
msg13548 - (view) Author: Mike Brown (mike_j_brown) Date: 2004-03-17 19:48
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.
History
Date User Action Args
2022-04-10 16:05:58adminsetgithub: 37579
2002-12-07 08:28:06mike_j_browncreate