[Python-bugs-list] [ python-Bugs-754016 ] urlparse goes wrong with IP:port without scheme

SourceForge.net noreply@sourceforge.net
Fri, 13 Jun 2003 19:39:05 -0700


Bugs item #754016, was opened at 2003-06-13 10:15
Message generated for change (Comment added) made by sjones
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=754016&group_id=5470

Category: Python Library
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Krüger (kruegi)
Assigned to: Nobody/Anonymous (nobody)
Summary: urlparse goes wrong with IP:port without scheme

Initial Comment:
urlparse doesnt work if IP and port are given without 
scheme:

>>> urlparse.urlparse('1.2.3.4:80','http')
('1.2.3.4', '', '80', '', '', '')

should be:

>>> urlparse.urlparse('1.2.3.4:80','http')
('http', '1.2.3.4', '80', '', '', '')

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

Comment By: Shannon Jones (sjones)
Date: 2003-06-13 21:39

Message:
Logged In: YES 
user_id=589306

Sorry, previous comment got cut off...

urlparse.urlparse takes a url of the format:
    <scheme>://<netloc>/<path>;<params>?<query>#<fragment>

And returns a 6-tuple of the format:
    (scheme, netloc, path, params, query, fragment).

An example from the library refrence takes:
    urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')

And produces:
    ('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '',
'', '')

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

Note that there isn't a field for the port number in the
6-tuple. Instead, it is included in the netloc. Urlparse
should handle your example as:

>>> urlparse.urlparse('1.2.3.4:80','http') 
('http', '1.2.3.4:80', '', '', '', '')

Instead, it gives the incorrect output as you indicated.


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

Comment By: Shannon Jones (sjones)
Date: 2003-06-13 21:26

Message:
Logged In: YES 
user_id=589306

urlparse.urlparse takes a url of the format:
    <scheme>://<netloc>/<path>;<params>?<query>#<fragment>

And returns a 6-tuple of the format:
    (scheme, netloc, path, params, query, fragment).

An example from the library refrence takes:


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

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