urlutils: Handle localhost correctly in all cases.
This commit is contained in:
parent
ddb6743b26
commit
aaab05793e
@ -108,8 +108,6 @@ def _is_url_naive(urlstr):
|
|||||||
return False
|
return False
|
||||||
elif '.' in url.host():
|
elif '.' in url.host():
|
||||||
return True
|
return True
|
||||||
elif url.host() == 'localhost':
|
|
||||||
return True
|
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -258,6 +256,9 @@ def is_url(urlstr):
|
|||||||
# A URL will never contain a space
|
# A URL will never contain a space
|
||||||
log.url.debug("Contains space -> no URL")
|
log.url.debug("Contains space -> no URL")
|
||||||
url = False
|
url = False
|
||||||
|
elif qurl_userinput.host() in ('localhost', '127.0.0.1', '::1'):
|
||||||
|
log.url.debug("Is localhost.")
|
||||||
|
url = True
|
||||||
elif is_special_url(qurl):
|
elif is_special_url(qurl):
|
||||||
# Special URLs are always URLs, even with autosearch=False
|
# Special URLs are always URLs, even with autosearch=False
|
||||||
log.url.debug("Is an special URL.")
|
log.url.debug("Is an special URL.")
|
||||||
|
Loading…
Reference in New Issue
Block a user