use netlib.http_semantics for generic data

This commit is contained in:
Thomas Kriechbaumer 2015-07-08 21:03:04 +02:00
parent c3c3d28bb1
commit df1b0df39f
2 changed files with 10 additions and 16 deletions

View File

@ -760,7 +760,7 @@ class HTTPResponse(HTTPMessage):
if hasattr(rfile, "reset_timestamps"): if hasattr(rfile, "reset_timestamps"):
rfile.reset_timestamps() rfile.reset_timestamps()
httpversion, code, msg, headers, content = http.read_response( resp = http.read_response(
rfile, rfile,
request_method, request_method,
body_size_limit, body_size_limit,
@ -776,11 +776,11 @@ class HTTPResponse(HTTPMessage):
timestamp_end = None timestamp_end = None
return HTTPResponse( return HTTPResponse(
httpversion, resp.httpversion,
code, resp.status_code,
msg, resp.msg,
headers, resp.headers,
content, resp.content,
timestamp_start, timestamp_start,
timestamp_end timestamp_end
) )

View File

@ -765,22 +765,16 @@ class TestStreamRequest(tservers.HTTPProxTest):
(self.server.urlbase, spec)) (self.server.urlbase, spec))
connection.send("\r\n") connection.send("\r\n")
httpversion, code, msg, headers, content = http.read_response( resp = http.read_response(fconn, "GET", None, include_body=False)
fconn, "GET", None, include_body=False)
assert headers["Transfer-Encoding"][0] == 'chunked' assert resp.headers["Transfer-Encoding"][0] == 'chunked'
assert code == 200 assert resp.status_code == 200
chunks = list( chunks = list(
content for _, content for _,
content, content,
_ in http.read_http_body_chunked( _ in http.read_http_body_chunked(
fconn, fconn, resp.headers, None, "GET", 200, False))
headers,
None,
"GET",
200,
False))
assert chunks == ["this", "isatest", ""] assert chunks == ["this", "isatest", ""]
connection.close() connection.close()