Message371179
| 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:48 | op368 | set | recipients:
+ op368 |
| 2020年06月10日 11:18:48 | op368 | set | messageid: <1591787928.34.0.800218743026.issue40938@roundup.psfhosted.org> |
| 2020年06月10日 11:18:48 | op368 | link | issue40938 messages |
| 2020年06月10日 11:18:48 | op368 | create |
|