[Python-bugs-list] [ python-Bugs-639311 ] urllib.basejoin() mishandles ''

noreply@sourceforge.net noreply@sourceforge.net
Sat, 16 Nov 2002 04:34:53 -0800


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

Category: Python Library
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Brown (mike_j_brown)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.basejoin() mishandles ''

Initial Comment:
It's not entirely clear whether urllib.basejoin() intends to 
implement RFC 2396's "resolution of relative URI 
references to absolute form" faithfully, but it seems to 
behave improperly when given an empty string as the 
relative URI to make absolute.

>>> from urllib import basejoin
>>> basejoin('http://host/foo/bar.xml','')
'http://host/foo/'

I believe it should return the base as-is, because the 
empty string is a reference to the document that 
contains that reference... and presumably the 
document's URI is what you're passing in as the base.

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

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