mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-23 20:00:09 +08:00
Handle missing message/reason phrase in HTTP response status line gracefully by adding an empty one.
This commit is contained in:
@@ -214,6 +214,8 @@ class ServerConnection:
|
||||
if not line:
|
||||
raise ProxyError(502, "Blank server response.")
|
||||
parts = line.strip().split(" ", 2)
|
||||
if len(parts) == 2: # handle missing message gracefully
|
||||
parts.append("")
|
||||
if not len(parts) == 3:
|
||||
raise ProxyError(502, "Invalid server response: %s."%line)
|
||||
proto, code, msg = parts
|
||||
|
||||
Reference in New Issue
Block a user