Add HTTP version to response objects.

Another change in the serialization format.
This commit is contained in:
Aldo Cortesi
2012-06-10 13:27:43 +12:00
parent 52779d9db9
commit 6ba5f0f35b
5 changed files with 14 additions and 8 deletions

View File

@@ -309,6 +309,9 @@ class ServerConnection:
if not len(parts) == 3:
raise ProxyError(502, "Invalid server response: %s."%line)
proto, code, msg = parts
httpversion = parse_http_protocol(proto)
if httpversion is None:
raise ProxyError(502, "Invalid HTTP version: %s."%httpversion)
try:
code = int(code)
except ValueError:
@@ -320,7 +323,7 @@ class ServerConnection:
content = ""
else:
content = read_http_body(self.rfile, self, headers, True, self.config.body_size_limit)
return flow.Response(request, code, msg, headers, content, self.cert)
return flow.Response(request, httpversion, code, msg, headers, content, self.cert)
def terminate(self):
try: