mirror of
https://github.com/simon987/od-database.git
synced 2025-04-24 12:45:51 +00:00
Bugfix post-pycurl update
This commit is contained in:
parent
cadaf14c1b
commit
484a0baf9d
@ -179,13 +179,14 @@ class HttpDirectory(RemoteDirectory):
|
|||||||
while retries > 0:
|
while retries > 0:
|
||||||
try:
|
try:
|
||||||
raw_headers = BytesIO()
|
raw_headers = BytesIO()
|
||||||
curl.setopt(pycurl.URL, url)
|
curl.setopt(pycurl.URL, url.encode("utf-8", errors="ignore"))
|
||||||
curl.setopt(pycurl.HEADERFUNCTION, raw_headers.write)
|
curl.setopt(pycurl.HEADERFUNCTION, raw_headers.write)
|
||||||
curl.perform()
|
curl.perform()
|
||||||
|
|
||||||
stripped_url = url[len(base_url) - 1:]
|
stripped_url = url[len(base_url) - 1:]
|
||||||
headers = HttpDirectory._parse_dict_header(raw_headers.getvalue().decode("utf-8", errors="ignore"))
|
headers = HttpDirectory._parse_dict_header(raw_headers.getvalue().decode("utf-8", errors="ignore"))
|
||||||
raw_headers.close()
|
raw_headers.close()
|
||||||
|
curl.close()
|
||||||
|
|
||||||
path, name = os.path.split(stripped_url)
|
path, name = os.path.split(stripped_url)
|
||||||
date = headers.get("Last-Modified", "1970-01-01")
|
date = headers.get("Last-Modified", "1970-01-01")
|
||||||
@ -208,7 +209,7 @@ class HttpDirectory(RemoteDirectory):
|
|||||||
while retries > 0:
|
while retries > 0:
|
||||||
try:
|
try:
|
||||||
content = BytesIO()
|
content = BytesIO()
|
||||||
self.curl.setopt(pycurl.URL, url)
|
self.curl.setopt(pycurl.URL, url.encode("utf-8", errors="ignore"))
|
||||||
self.curl.setopt(pycurl.WRITEDATA, content)
|
self.curl.setopt(pycurl.WRITEDATA, content)
|
||||||
self.curl.perform()
|
self.curl.perform()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user