Skip to content

Commit dbd8fff

Browse files
pi-anldpgeorge
authored andcommitted
urequests: Raise error when server doesn't respond with valid http.
1 parent a725c42 commit dbd8fff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python-ecosys/urequests/urequests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ def request(
111111
l = s.readline()
112112
# print(l)
113113
l = l.split(None, 2)
114+
if len(l) < 2:
115+
# Invalid response
116+
raise ValueError("HTTP error: BadStatusLine:\n%s" % l)
114117
status = int(l[1])
115118
reason = ""
116119
if len(l) > 2:

0 commit comments

Comments
 (0)