[ python-Bugs-1097834 ] urllib2 doesn't handle urls without a scheme

SourceForge.net noreply at sourceforge.net
Wed Jan 19 07:33:13 CET 2005


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

Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Jack Jansen (jackjansen)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 doesn't handle urls without a scheme

Initial Comment:
Unlike urllib, urllib2 does not handle "/path/to/file" style urls 
(without a scheme) as "file:" urls.

I'm not sure whether this is a bug per se, but if this behaviour is 
by design then urllib2 should get a pathname2url() method that 
changes a pathname to a "file:"-prefixed url. urllib.pathname2url() 
does not prefix the url, but that's fine because urllib.urlopen() 
treats urls without schemes as file: urls.


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

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2005-01-19 01:33

Message:
Logged In: YES 
user_id=3066

There's no such thing as a URL without a scheme, regardless
of what browsers do.  The best thing to do is to determine
the "base" to which a relative URL reference (whcih can have
the scheme omitted) should be resolved, and join the base
and relative URL reference using urlparse.urljoin(base, rel).

Closing as "not a bug".

urllib.pathname2url() is a problem in it's own right; it
doesn't behave consistently across Windows and Unix.  On
Windows, pathname2url() returns too many slashes, or it
returns too few on Unix.  I've been using helper functions
that hide that difference.


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

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


More information about the Python-bugs-list mailing list