Skip to content

Commit 63511b4

Browse files
authored
Add files via upload
1 parent fb10157 commit 63511b4

8 files changed

Lines changed: 24 additions & 16 deletions

PyWWW/pywwwget_chatgpt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,8 +1780,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
17801780
httpfile.write(r.content)
17811781
httpcodeout = r.status
17821782
httpcodereason = http_status_to_reason(r.status)
1783-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1784-
httpversionout = raw_version.decode("ascii")
1783+
httpversionout = r.extensions.get("http_version")
1784+
if isinstance(httpversionout, (bytes, bytearray)):
1785+
httpversionout = httpversionout.decode("ascii", errors="replace")
17851786
httpmethodout = httpmethod
17861787
httpurlout = str(rebuilt_url)
17871788
httpheaderout = r.headers

PyWWW/pywwwget_deepseek.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,8 +1979,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
19791979
httpfile.write(r.content)
19801980
httpcodeout = r.status
19811981
httpcodereason = http_status_to_reason(r.status)
1982-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1983-
httpversionout = raw_version.decode("ascii")
1982+
httpversionout = r.extensions.get("http_version")
1983+
if isinstance(httpversionout, (bytes, bytearray)):
1984+
httpversionout = httpversionout.decode("ascii", errors="replace")
19841985
httpmethodout = httpmethod
19851986
httpurlout = str(rebuilt_url)
19861987
httpheaderout = r.headers

PyWWW/pywwwget_merged.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
18151815
httpfile.write(r.content)
18161816
httpcodeout = r.status
18171817
httpcodereason = http_status_to_reason(r.status)
1818-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1819-
httpversionout = raw_version.decode("ascii")
1818+
httpversionout = r.extensions.get("http_version")
1819+
if isinstance(httpversionout, (bytes, bytearray)):
1820+
httpversionout = httpversionout.decode("ascii", errors="replace")
18201821
httpmethodout = httpmethod
18211822
httpurlout = str(rebuilt_url)
18221823
httpheaderout = r.headers

PyWWW/pywwwget_nextver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,8 +1796,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
17961796
httpfile.write(r.content)
17971797
httpcodeout = r.status
17981798
httpcodereason = http_status_to_reason(r.status)
1799-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1800-
httpversionout = raw_version.decode("ascii")
1799+
httpversionout = r.extensions.get("http_version")
1800+
if isinstance(httpversionout, (bytes, bytearray)):
1801+
httpversionout = httpversionout.decode("ascii", errors="replace")
18011802
httpmethodout = httpmethod
18021803
httpurlout = str(rebuilt_url)
18031804
httpheaderout = r.headers

pywwwget_chatgpt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,8 +1780,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
17801780
httpfile.write(r.content)
17811781
httpcodeout = r.status
17821782
httpcodereason = http_status_to_reason(r.status)
1783-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1784-
httpversionout = raw_version.decode("ascii")
1783+
httpversionout = r.extensions.get("http_version")
1784+
if isinstance(httpversionout, (bytes, bytearray)):
1785+
httpversionout = httpversionout.decode("ascii", errors="replace")
17851786
httpmethodout = httpmethod
17861787
httpurlout = str(rebuilt_url)
17871788
httpheaderout = r.headers

pywwwget_deepseek.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,8 +1979,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
19791979
httpfile.write(r.content)
19801980
httpcodeout = r.status
19811981
httpcodereason = http_status_to_reason(r.status)
1982-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1983-
httpversionout = raw_version.decode("ascii")
1982+
httpversionout = r.extensions.get("http_version")
1983+
if isinstance(httpversionout, (bytes, bytearray)):
1984+
httpversionout = httpversionout.decode("ascii", errors="replace")
19841985
httpmethodout = httpmethod
19851986
httpurlout = str(rebuilt_url)
19861987
httpheaderout = r.headers

pywwwget_merged.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
18151815
httpfile.write(r.content)
18161816
httpcodeout = r.status
18171817
httpcodereason = http_status_to_reason(r.status)
1818-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1819-
httpversionout = raw_version.decode("ascii")
1818+
httpversionout = r.extensions.get("http_version")
1819+
if isinstance(httpversionout, (bytes, bytearray)):
1820+
httpversionout = httpversionout.decode("ascii", errors="replace")
18201821
httpmethodout = httpmethod
18211822
httpurlout = str(rebuilt_url)
18221823
httpheaderout = r.headers

pywwwget_nextver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,8 +1796,9 @@ def download_file_from_http_file(url, headers=None, usehttp=__use_http_lib__, ht
17961796
httpfile.write(r.content)
17971797
httpcodeout = r.status
17981798
httpcodereason = http_status_to_reason(r.status)
1799-
raw_version = r.extensions.get(b"http_version", b"HTTP/1.1")
1800-
httpversionout = raw_version.decode("ascii")
1799+
httpversionout = r.extensions.get("http_version")
1800+
if isinstance(httpversionout, (bytes, bytearray)):
1801+
httpversionout = httpversionout.decode("ascii", errors="replace")
18011802
httpmethodout = httpmethod
18021803
httpurlout = str(rebuilt_url)
18031804
httpheaderout = r.headers

0 commit comments

Comments
 (0)