diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-04-23 17:35:22 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-04-23 17:35:22 +1200 |
commit | b0ab5297d161d61975e67b04ba58a71f97c5cba8 (patch) | |
tree | e46697bb6acc212cfef0fe265bdfb8ab9fb0e9c6 /libpathod/pathod.py | |
parent | dacb350040806ad0855cd482d53247be81474f3a (diff) | |
download | mitmproxy-b0ab5297d161d61975e67b04ba58a71f97c5cba8.tar.gz mitmproxy-b0ab5297d161d61975e67b04ba58a71f97c5cba8.tar.bz2 mitmproxy-b0ab5297d161d61975e67b04ba58a71f97c5cba8.zip |
Change the semantics of the craft anchor point specification
The anchor point is now defined as /p (rather than /p/), with the specification
for a request just to /p or /p/ being empty.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r-- | libpathod/pathod.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index 2e93a330..dbcb807d 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -201,11 +201,12 @@ class PathodHandler(tcp.BaseHandler): self.addlog(retlog) return again - if not self.server.nocraft and path.startswith(self.server.craftanchor): + if not self.server.nocraft and utils.matchpath(path, self.server.craftanchor): + spec = urllib.unquote(path)[len(self.server.craftanchor) + 1:] key = websockets.check_client_handshake(headers) - if key: - self.settings.websocket_key = key - spec = urllib.unquote(path)[len(self.server.craftanchor):] + self.settings.websocket_key = key + if key and not spec: + spec = "ws" self.info("crafting spec: %s" % spec) try: crafted = language.parse_response(spec) @@ -301,7 +302,7 @@ class Pathod(tcp.TCPServer): addr, ssl=False, ssloptions=None, - craftanchor="/p/", + craftanchor="/p", staticdir=None, anchors=(), sizelimit=None, |