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.

Author op368
Recipients op368
Date 2020-06-10.11:18:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591787928.34.0.800218743026.issue40938@roundup.psfhosted.org>
In-reply-to
Content
path 'g' in 'http:g' becomes '/g'.

    >>> urlsplit('http:g')
    SplitResult(scheme='http', netloc='', path='g', query='', fragment='')
    >>> urlunsplit(urlsplit('http:g'))
    'http:///g'
    >>> urlsplit('http:///g')
    SplitResult(scheme='http', netloc='', path='/g', query='', fragment='')

    >>> urljoin('http://a/b/c/d', 'http:g')
    'http://a/b/c/g'
    >>> urljoin('http://a/b/c/d', 'http:///g')
    'http://a/g'

The problematic part of the code is:

    def urlunsplit(components):
        [...]
        if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
--->        if url and url[:1] != '/': url = '/' + url
            url = '//' + (netloc or '') + url

Note also that urllib has decided on the interpretation of 'http:g' (in test).

    def test_RFC3986(self):
        [...]
        #self.checkJoin(RFC3986_BASE, 'http:g','http:g') # strict parser
        self.checkJoin(RFC3986_BASE, 'http:g','http://a/b/c/g') #relaxed parser
History
Date User Action Args
2020-06-10 11:18:48op368setrecipients: + op368
2020-06-10 11:18:48op368setmessageid: <1591787928.34.0.800218743026.issue40938@roundup.psfhosted.org>
2020-06-10 11:18:48op368linkissue40938 messages
2020-06-10 11:18:48op368create