@@ -1341,7 +1341,6 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
13411341 if resume_off and "Range" not in headers and "range" not in headers :
13421342 headers ["Range" ] = "bytes=%d-" % resume_off
13431343
1344- headers = fix_header_names (headers )
13451344 if (httpuseragent is not None ):
13461345 if ('User-Agent' in headers ):
13471346 headers ['User-Agent' ] = httpuseragent
@@ -1491,6 +1490,7 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
14911490 httpurlout = resp .geturl ()
14921491 httpheaderout = resp .info ()
14931492 httpheadersentout = headers
1493+ fulldatasize = httpfile .tell ()
14941494 try :
14951495 httpfile .seek (0 , 0 )
14961496 except Exception :
@@ -1499,7 +1499,8 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
14991499 if (isinstance (httpheaderout , list )):
15001500 httpheaderout = make_http_headers_from_list_to_dict (httpheaderout )
15011501 httpheaderout = fix_header_names (httpheaderout )
1502- returnval = {'Type' : "Buffer" , 'Buffer' : httpfile , 'Headers' : httpheaderout , 'Version' : httpversionout , 'Method' : httpmethodout , 'HeadersSent' : httpheadersentout , 'URL' : httpurlout , 'Code' : httpcodeout , 'Reason' : httpcodereason , 'HTTPLib' : usehttp }
1502+ returnval = {'Type' : "Buffer" , 'Buffer' : httpfile , 'ContentSize' : fulldatasize , 'ContentsizeAlt' : {'IEC' : get_readable_size (
1503+ fulldatasize , 2 , "IEC" ), 'SI' : get_readable_size (fulldatasize , 2 , "SI" )}, 'Headers' : httpheaderout , 'Version' : httpversionout , 'Method' : httpmethodout , 'HeadersSent' : httpheadersentout , 'URL' : httpurlout , 'Code' : httpcodeout , 'Reason' : httpcodereason , 'HTTPLib' : usehttp }
15031504 return returnval
15041505 else :
15051506 return httpfile
0 commit comments