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
urlunsplit for itms-services scheme returns invalid url #104139
I don't think this scheme is standard. https://url.spec.whatwg.org/#url-serializing says "If url's host is non-null: Append "//" to output." This itms-services URL doesn't have a host, so it shouldn't require a //. I think there's some other special casing for schemes with the uses_netloc list, a similar "add //" could be added.
I agree with @davidism that the WhatWG URL spec does not require // when there is no pathname.
Regardless, behavior wise this seems to match our existing uses_netloc special case so we can just add it to that list in Lib/urllib/parse.py and add test coverage in Lib/test/test_urlparse.py. I made a PR.
Workaround for this to "work" on existing Pythons:
I'm calling this a feature as code will have to deal with Python's that do not list it as such for a long time anyways via a code snippet like that, so backporting doesn't seem consistently helpful.
Activity
davidism commentedon May 3, 2023
I don't think this scheme is standard. https://url.spec.whatwg.org/#url-serializing says "If url's
hostis non-null: Append "//" to output." Thisitms-servicesURL doesn't have a host, so it shouldn't require a//. I think there's some other special casing for schemes with theuses_netloclist, a similar "add//" could be added.cpython/Lib/urllib/parse.py
Lines 44 to 74 in 9f9e001
davidism commentedon May 8, 2023
@gpshead I know you were looking at some other urllib issues recently, could you comment on this?
gpshead commentedon May 8, 2023
I agree with @davidism that the WhatWG URL spec does not require // when there is no pathname.
Regardless, behavior wise this seems to match our existing
uses_netlocspecial case so we can just add it to that list in Lib/urllib/parse.py and add test coverage in Lib/test/test_urlparse.py. I made a PR.Workaround for this to "work" on existing Pythons:
I'm calling this a feature as code will have to deal with Python's that do not list it as such for a long time anyways via a code snippet like that, so backporting doesn't seem consistently helpful.
gh-104139: Add itms-services to uses_netloc urllib.parse. (#104312)
gpshead commentedon May 9, 2023
fixed in 3.12.
Merge branch 'main' into fixsendfamily
Merge branch 'main' into supermon
Merge branch 'main' into fixloadsuperspec