aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/pathod.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-11 16:36:58 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-15 15:50:45 +0200
commit22811c45dd1e6e6f1c8108e83a7be625f305c19e (patch)
tree0f8a2374bbf6f56d18d789bd2598168b5b233dca /libpathod/pathod.py
parent0bc8fa1d0d4f2730311b9fc934a8fcdaae07ab66 (diff)
downloadmitmproxy-22811c45dd1e6e6f1c8108e83a7be625f305c19e.tar.gz
mitmproxy-22811c45dd1e6e6f1c8108e83a7be625f305c19e.tar.bz2
mitmproxy-22811c45dd1e6e6f1c8108e83a7be625f305c19e.zip
fix craft anchor
The go-button in the app was broken due to an invalid string representation of the regex. A plain string used as URL prefix simplifies this drastically.
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r--libpathod/pathod.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index 505c8c22..f1496181 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -20,7 +20,7 @@ DEFAULT_CERT_DOMAIN = "pathod.net"
CONFDIR = "~/.mitmproxy"
CERTSTORE_BASENAME = "mitmproxy"
CA_CERT_NAME = "mitmproxy-ca.pem"
-DEFAULT_ANCHOR = r"/p/?"
+DEFAULT_CRAFT_ANCHOR = "/p/"
logger = logging.getLogger('pathod')
@@ -293,8 +293,9 @@ class PathodHandler(tcp.BaseHandler):
anchor_gen = i[1]
break
else:
- if m(self.server.craftanchor.match(path)):
- spec = urllib.unquote(path)[len(m.v.group()):]
+ print(self.server.craftanchor)
+ if m(path.startswith(self.server.craftanchor)):
+ spec = urllib.unquote(path)[len(self.server.craftanchor):]
if spec:
try:
anchor_gen = language.parse_pathod(spec)
@@ -373,7 +374,7 @@ class Pathod(tcp.TCPServer):
addr,
ssl=False,
ssloptions=None,
- craftanchor=re.compile(DEFAULT_ANCHOR),
+ craftanchor=DEFAULT_CRAFT_ANCHOR,
staticdir=None,
anchors=(),
sizelimit=None,
@@ -393,7 +394,7 @@ class Pathod(tcp.TCPServer):
addr: (address, port) tuple. If port is 0, a free port will be
automatically chosen.
ssloptions: an SSLOptions object.
- craftanchor: string specifying the path under which to anchor
+ craftanchor: URL prefix specifying the path under which to anchor
response generation.
staticdir: path to a directory of static resources, or None.
anchors: List of (regex object, language.Request object) tuples, or