[issue8818] urlsplit and urlparse add extra slash when using scheme

AdamN <adam@varud.com> added the comment: Ok, you're right:
urlsplit('cnn.com') SplitResult(scheme='', netloc='', path='cnn.com', query='', fragment='') urlsplit('//cnn.com') SplitResult(scheme='', netloc='cnn.com', path='', query='', fragment='')
Although I see that nowhere in the documentation. It seems to me that in the scenario most people are dealing with, where they are getting 'cnn.com' or 'http://cnn.com' but don't know which ahead of time, this will be useless. I don't see who would ever have '//cnn.com' without constructing that string specifically for urlsplit. I would propose that '/whatever' becomes the path because it starts with slash, otherwise, it becomes the netloc and everything after the first slash becomes the path. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue8818> _______________________________________

On Tue, May 25, 2010 at 1:41 PM, AdamN <report@bugs.python.org> wrote:
Although I see that nowhere in the documentation.
It needn't be in the urlparse documentation; the RFCs on URL syntax apply here. None of what's going on with the urlparse module is Python specific, as far as the URL interpretation is concerned.
It seems to me that in the scenario most people are dealing with, where they are getting 'cnn.com' or 'http://cnn.com' but don't know which ahead of time, this will be useless. I don't see who would ever have '//cnn.com' without constructing that string specifically for urlsplit.
'cnn.com' isn't a URL, and there's no need for urlparse to handle it direectly. That just complicates things. Doing something above and beyond what the RFCs specify means you need to really think about the heuristics you're applying. If there's a useful set of heuristics that folks can agree on, that's a good case for a new module distributed on PyPI. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
participants (2)
-
AdamN
-
Fred Drake