mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
drop unused protocol parameter from Response
This commit is contained in:
parent
759496e24e
commit
89627a702a
@ -228,9 +228,9 @@ class Request(controller.Msg):
|
||||
|
||||
class Response(controller.Msg):
|
||||
FMT = '%s\r\n%s\r\n%s'
|
||||
def __init__(self, request, code, proto, msg, headers, content, timestamp=None):
|
||||
def __init__(self, request, code, msg, headers, content, timestamp=None):
|
||||
self.request = request
|
||||
self.code, self.proto, self.msg = code, proto, msg
|
||||
self.code, self.msg = code, msg
|
||||
self.headers, self.content = headers, content
|
||||
self.timestamp = timestamp or time.time()
|
||||
self.cached = False
|
||||
@ -239,7 +239,6 @@ class Response(controller.Msg):
|
||||
def get_state(self):
|
||||
return dict(
|
||||
code = self.code,
|
||||
proto = self.proto,
|
||||
msg = self.msg,
|
||||
headers = self.headers.get_state(),
|
||||
timestamp = self.timestamp,
|
||||
@ -251,7 +250,6 @@ class Response(controller.Msg):
|
||||
return klass(
|
||||
request,
|
||||
state["code"],
|
||||
state["proto"],
|
||||
state["msg"],
|
||||
utils.Headers.from_state(state["headers"]),
|
||||
state["content"],
|
||||
@ -438,7 +436,7 @@ class ServerConnection:
|
||||
content = None
|
||||
else:
|
||||
content = read_http_body(self.rfile, self, headers, True)
|
||||
return Response(self.request, code, proto, msg, headers, content)
|
||||
return Response(self.request, code, msg, headers, content)
|
||||
|
||||
def terminate(self):
|
||||
try:
|
||||
|
@ -93,7 +93,6 @@ class uMatching(libpry.AutoTree):
|
||||
return proxy.Response(
|
||||
q,
|
||||
200,
|
||||
"HTTP/1.1",
|
||||
"message",
|
||||
headers,
|
||||
"content_response"
|
||||
|
@ -237,7 +237,7 @@ class uResponse(libpry.AutoTree):
|
||||
h["test"] = ["test"]
|
||||
c = proxy.ClientConnection(("addr", 2222))
|
||||
req = proxy.Request(c, "host", 22, "https", "GET", "/", h, "content")
|
||||
resp = proxy.Response(req, 200, "HTTP", "msg", h.copy(), "content")
|
||||
resp = proxy.Response(req, 200, "msg", h.copy(), "content")
|
||||
assert resp.short()
|
||||
assert resp.assemble()
|
||||
|
||||
|
@ -13,7 +13,7 @@ def tresp(req=None):
|
||||
req = treq()
|
||||
headers = utils.Headers()
|
||||
headers["header_response"] = ["svalue"]
|
||||
return proxy.Response(req, 200, "HTTP/1.1", "message", headers, "content_response")
|
||||
return proxy.Response(req, 200, "message", headers, "content_response")
|
||||
|
||||
|
||||
def tflow():
|
||||
|
Loading…
Reference in New Issue
Block a user