monkey patching

This commit is contained in:
Lionel Dricot 2023-07-18 00:45:14 +02:00
parent b745b04f7a
commit 4fd8b89f49
2 changed files with 7 additions and 7 deletions

View File

@ -41,6 +41,13 @@ CRLF = '\r\n'
DEFAULT_TIMEOUT = 10
_MAX_REDIRECTS = 5
# monkey-patch Gemini support in urllib.parse
# see https://github.com/python/cpython/blob/master/Lib/urllib/parse.py
urllib.parse.uses_relative.append("gemini")
urllib.parse.uses_netloc.append("gemini")
urllib.parse.uses_relative.append("spartan")
urllib.parse.uses_netloc.append("spartan")
def parse_mime(mime):
options = {}
if mime:

View File

@ -131,13 +131,6 @@ _ABBREVS = {
_MIME_HANDLERS = {
}
# monkey-patch Gemini support in urllib.parse
# see https://github.com/python/cpython/blob/master/Lib/urllib/parse.py
urllib.parse.uses_relative.append("gemini")
urllib.parse.uses_netloc.append("gemini")
urllib.parse.uses_relative.append("spartan")
urllib.parse.uses_netloc.append("spartan")
#An IPV6 URL should be put between []
#We try to detect them has location with more than 2 ":"
def fix_ipv6_url(url):