[dl:http] allow '_http_signature' to return a custom error message
… and fail the download immediately like '_http_validate'
This commit is contained in:
@@ -280,9 +280,13 @@ class HttpDownloader(DownloaderBase):
|
|||||||
except (RequestException, SSLError) as exc:
|
except (RequestException, SSLError) as exc:
|
||||||
msg = str(exc)
|
msg = str(exc)
|
||||||
continue
|
continue
|
||||||
if validate_sig and not validate_sig(file_header):
|
if validate_sig:
|
||||||
msg = "Invalid file signature bytes"
|
result = validate_sig(file_header)
|
||||||
continue
|
if result is not True:
|
||||||
|
self.release_conn(response)
|
||||||
|
self.log.warning(
|
||||||
|
result or "Invalid file signature bytes")
|
||||||
|
return False
|
||||||
if validate_ext and self._adjust_extension(
|
if validate_ext and self._adjust_extension(
|
||||||
pathfmt, file_header) and pathfmt.exists():
|
pathfmt, file_header) and pathfmt.exists():
|
||||||
pathfmt.temppath = ""
|
pathfmt.temppath = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user