From ae79fe166087864b630f77538149d035cfb58f3b Mon Sep 17 00:00:00 2001 From: meeee Date: Mon, 26 Sep 2011 00:44:43 +0300 Subject: Handle missing message/reason phrase in HTTP response status line gracefully by adding an empty one. --- libmproxy/proxy.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libmproxy') diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index 7b6e695f..32057c24 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -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 -- cgit v1.2.3