fix relative urls
This commit is contained in:
parent
5b91bef896
commit
ab03e18ce2
@ -35,7 +35,7 @@ def download_content(url, depth=0):
|
|||||||
raise InfiniteRedirects('too much redirects: %s' % url)
|
raise InfiniteRedirects('too much redirects: %s' % url)
|
||||||
|
|
||||||
up = urlparse(url)
|
up = urlparse(url)
|
||||||
if not up.scheme:
|
if not up.netloc:
|
||||||
up = urlparse('//' + url)
|
up = urlparse('//' + url)
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
@ -44,7 +44,7 @@ def download_content(url, depth=0):
|
|||||||
"Connection": "keep-alive",
|
"Connection": "keep-alive",
|
||||||
}
|
}
|
||||||
|
|
||||||
if up.scheme == 'http':
|
if not up.scheme or up.scheme == 'http':
|
||||||
conn = http.client.HTTPConnection(up.netloc)
|
conn = http.client.HTTPConnection(up.netloc)
|
||||||
elif up.scheme == 'https':
|
elif up.scheme == 'https':
|
||||||
conn = http.client.HTTPSConnection(up.netloc)
|
conn = http.client.HTTPSConnection(up.netloc)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user