mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Merge pull request #15 from meeee/patch-1
Handle HTTP responses with status line missing a message/reason phrase
This commit is contained in:
commit
17facd8b72
@ -214,6 +214,8 @@ class ServerConnection:
|
|||||||
if not line:
|
if not line:
|
||||||
raise ProxyError(502, "Blank server response.")
|
raise ProxyError(502, "Blank server response.")
|
||||||
parts = line.strip().split(" ", 2)
|
parts = line.strip().split(" ", 2)
|
||||||
|
if len(parts) == 2: # handle missing message gracefully
|
||||||
|
parts.append("")
|
||||||
if not len(parts) == 3:
|
if not len(parts) == 3:
|
||||||
raise ProxyError(502, "Invalid server response: %s."%line)
|
raise ProxyError(502, "Invalid server response: %s."%line)
|
||||||
proto, code, msg = parts
|
proto, code, msg = parts
|
||||||
|
Loading…
Reference in New Issue
Block a user