You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
urllib.parse.urlunsplit makes relative path to absolute (http:g -> http:///g) #85110
hello, @jaswdr, but I can't understand what's wrong with my point.
What is 'the expected behaviour'?
jaswdr commented on May 13, 2021
jaswdrmannequin
Mannequin
More actions
@op368 as far as I can see, regarding of any miss interpretation, yes, the RFC has this section:
"http:g" = "http:g" ; for strict parsers
/ "http://a/b/c/g" ; for backward compatibility
What I can understand is that for "http:g" it will be translated to "http:///g" because of backward compatibility, this seems to be an edge case for the parser, since the RFC text also mention that this should be avoided.
openandclose commented on May 13, 2021
openandclosemannequin
MannequinAuthor
More actions
'http:///g' has absolute path '/g',
and as urljoin shows:
>>> urljoin('http://a/b/c/d', 'http:///g')
'http://a/g' # 'a' is netloc
So you are proposing third interpretation.
"http:g" = "http:g" ; for strict parsers
/ "http://a/b/c/g" ; for backward compatibility
/ "http://a/g" ; (yours)
Activity
openandclose commentedon Jun 10, 2020
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:
Note also that urllib has decided on the interpretation of 'http:g' (in test).
jaswdr commentedon May 12, 2021
@op368 I don't think that this is a bug, [1] literally uses this exact example and shows the expected behaviour.
[1] https://datatracker.ietf.org/doc/html/rfc3986#section-5.4.2
openandclose commentedon May 13, 2021
hello, @jaswdr, but I can't understand what's wrong with my point.
What is 'the expected behaviour'?
jaswdr commentedon May 13, 2021
@op368 as far as I can see, regarding of any miss interpretation, yes, the RFC has this section:
What I can understand is that for "http:g" it will be translated to "http:///g" because of backward compatibility, this seems to be an edge case for the parser, since the RFC text also mention that this should be avoided.
openandclose commentedon May 13, 2021
'http:///g' has absolute path '/g',
and as urljoin shows:
>>> urljoin('http://a/b/c/d', 'http:///g') 'http://a/g' # 'a' is netlocSo you are proposing third interpretation.
15 remaining items
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix deployment pull file path issue
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix Python3.13 compatibility regarding urllib.parse module
Fix salt://-URL truncation on Python 3.13+
Fix salt://-URL truncation on Python 3.13+
Fix salt://-URL truncation on Python 3.13+
Fix salt://-URL truncation on Python 3.13+