zopefoundation / zope.publisher

Map requests from HTTP/WebDAV clients, web browsers, XML-RPC and FTP clients onto Python objects
Other
3 stars 12 forks source link

Avoid using urllib.parse.splitport() #48

Closed mgedmin closed 5 years ago

mgedmin commented 5 years ago

The function is an undocumented internal helper and emits a deprecation warning in Python 3.8.

The suggested replacement is urllib.parse.urlparse(), but it's awkward for our use case (you have to add a scheme so it doesn't treat the argument as a relative URL, and it unwraps IPv6 addresses that we'd have to wrap right back into [], and it converts the port to an int whereas we expect it to be a string) so let's just reimplement the function using a regexp (which is what the stdlib did anyway).

Fixes #38.