mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
fix tests
This commit is contained in:
parent
40fbb95701
commit
a7a9ef826c
@ -14,14 +14,21 @@ from libmproxy.protocol.tcp import TCPHandler
|
|||||||
from libmproxy.protocol import KILL
|
from libmproxy.protocol import KILL
|
||||||
from libmproxy.script import concurrent
|
from libmproxy.script import concurrent
|
||||||
|
|
||||||
HTTPRequest._headers_to_strip_off.remove("Connection")
|
|
||||||
HTTPRequest._headers_to_strip_off.remove("Upgrade")
|
def start(context, argv):
|
||||||
|
HTTPRequest._headers_to_strip_off.remove("Connection")
|
||||||
|
HTTPRequest._headers_to_strip_off.remove("Upgrade")
|
||||||
|
|
||||||
|
|
||||||
|
def done(context):
|
||||||
|
HTTPRequest._headers_to_strip_off.append("Connection")
|
||||||
|
HTTPRequest._headers_to_strip_off.append("Upgrade")
|
||||||
|
|
||||||
@concurrent
|
@concurrent
|
||||||
def response(context, flow):
|
def response(context, flow):
|
||||||
if flow.response.headers.get_first("Connection", None) == "Upgrade":
|
if flow.response.headers.get_first("Connection", None) == "Upgrade":
|
||||||
# We need to send the response manually now...
|
# We need to send the response manually now...
|
||||||
flow.client_conn.send(flow.response.assemble())
|
flow.client_conn.send(flow.response.assemble())
|
||||||
# ...and then delegate to tcp passthrough.
|
# ...and then delegate to tcp passthrough.
|
||||||
TCPHandler(flow.live.c, log=False).handle_messages()
|
TCPHandler(flow.live.c, log=False).handle_messages()
|
||||||
flow.reply(KILL)
|
flow.reply(KILL)
|
@ -16,4 +16,5 @@ def test_load_scripts():
|
|||||||
f += " foo" # one argument required
|
f += " foo" # one argument required
|
||||||
if "modify_response_body" in f:
|
if "modify_response_body" in f:
|
||||||
f += " foo bar" # two arguments required
|
f += " foo bar" # two arguments required
|
||||||
script.Script(f, tmaster) # Loads the script file.
|
s = script.Script(f, tmaster) # Loads the script file.
|
||||||
|
s.unload()
|
Loading…
Reference in New Issue
Block a user