diff --git a/docs/scripting/inlinescripts.rst b/docs/scripting/inlinescripts.rst index 5e56e01e1..74d4e7144 100644 --- a/docs/scripting/inlinescripts.rst +++ b/docs/scripting/inlinescripts.rst @@ -128,7 +128,7 @@ HTTP Events WebSockets Events ^^^^^^^^^^^^^^^^^ -.. py:function:: websockets_handshake(context, flow) +.. py:function:: websocket_handshake(context, flow) Called when a client wants to establish a WebSockets connection. The WebSockets-specific headers can be manipulated to manipulate the handshake. diff --git a/mitmproxy/controller.py b/mitmproxy/controller.py index d886af970..ea084973a 100644 --- a/mitmproxy/controller.py +++ b/mitmproxy/controller.py @@ -28,7 +28,7 @@ Events = frozenset([ "response", "responseheaders", - "websockets_handshake", + "websocket_handshake", "next_layer", diff --git a/mitmproxy/flow/master.py b/mitmproxy/flow/master.py index 80f633cd6..de9d47f1c 100644 --- a/mitmproxy/flow/master.py +++ b/mitmproxy/flow/master.py @@ -246,7 +246,7 @@ class FlowMaster(controller.Master): self.state.update_flow(f) @controller.handler - def websockets_handshake(self, f): + def websocket_handshake(self, f): pass def handle_intercept(self, f): diff --git a/mitmproxy/protocol/http.py b/mitmproxy/protocol/http.py index d3e3c80f6..4a30edb7a 100644 --- a/mitmproxy/protocol/http.py +++ b/mitmproxy/protocol/http.py @@ -200,7 +200,7 @@ class HttpLayer(base.Layer): if websockets.check_handshake(request.headers) and websockets.check_client_version(request.headers): # We only support RFC6455 with WebSockets version 13 # allow inline scripts to manipulate the client handshake - self.channel.ask("websockets_handshake", flow) + self.channel.ask("websocket_handshake", flow) if not flow.response: self.establish_server_connection( diff --git a/pathod/pathod.py b/pathod/pathod.py index bd0feb732..4f6c3d380 100644 --- a/pathod/pathod.py +++ b/pathod/pathod.py @@ -174,12 +174,12 @@ class PathodHandler(tcp.BaseHandler): m = utils.MemBool() - valid_websockets_handshake = websockets.check_handshake(headers) + valid_websocket_handshake = websockets.check_handshake(headers) self.settings.websocket_key = websockets.get_client_key(headers) # If this is a websocket initiation, we respond with a proper # server response, unless over-ridden. - if valid_websockets_handshake: + if valid_websocket_handshake: anchor_gen = language.parse_pathod("ws") else: anchor_gen = None @@ -226,7 +226,7 @@ class PathodHandler(tcp.BaseHandler): spec, lg ) - if nexthandler and valid_websockets_handshake: + if nexthandler and valid_websocket_handshake: self.protocol = protocols.websockets.WebsocketsProtocol(self) return self.protocol.handle_websocket, retlog else: