mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 04:44:15 +02:00
[http] fix: http client not hanling None 'Content-length' header
This commit is contained in:
@@ -61,9 +61,10 @@ class HttpClient:
|
|||||||
res = self.session.get(url, allow_redirects=True, stream=True)
|
res = self.session.get(url, allow_redirects=True, stream=True)
|
||||||
|
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
size = int(res.headers.get('Content-Length'))
|
size = res.headers.get('Content-Length')
|
||||||
|
|
||||||
if size is not None:
|
if size is not None:
|
||||||
|
size = int(size)
|
||||||
for m in SIZE_MULTIPLIERS:
|
for m in SIZE_MULTIPLIERS:
|
||||||
size_str = str(size * m[0])
|
size_str = str(size * m[0])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user