aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-06-26 15:36:59 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-06-26 15:36:59 +1200
commita68b4498b87cbc8fc6f1c1c660df5fac09ca564e (patch)
treee1523c919e404dee1af96a970f74de98cbbb7f38
parent65aef81997be86344acd78c475ad3d8936407324 (diff)
downloadmitmproxy-a68b4498b87cbc8fc6f1c1c660df5fac09ca564e.tar.gz
mitmproxy-a68b4498b87cbc8fc6f1c1c660df5fac09ca564e.tar.bz2
mitmproxy-a68b4498b87cbc8fc6f1c1c660df5fac09ca564e.zip
Allow naked value literal for pathoc path specifications.
-rw-r--r--libpathod/pathod.py10
-rw-r--r--libpathod/rparse.py4
2 files changed, 8 insertions, 6 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index d4869750..a09d3594 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -9,6 +9,9 @@ class PathodError(Exception): pass
class PathodHandler(tcp.BaseHandler):
wbufsize = 0
sni = None
+ def debug(self, s):
+ logging.debug("%s:%s: %s"%(self.client_address[0], self.client_address[1], str(s)))
+
def handle_sni(self, connection):
self.sni = connection.get_servername()
@@ -20,7 +23,7 @@ class PathodHandler(tcp.BaseHandler):
self.server.ssloptions["keyfile"],
)
except tcp.NetLibError, v:
- logging.debug("%s: %s"%(self.client_address, str(v)))
+ self.debug(v)
self.finish()
while not self.finished:
@@ -61,10 +64,7 @@ class PathodHandler(tcp.BaseHandler):
headers = headers.lst,
sni = self.sni,
remote_address = self.client_address,
- #full_url = self.request.full_url(),
- #query = self.request.query,
httpversion = httpversion,
- #uri = self.request.uri,
)
self.server.add_log(dict(request=request_log, response=response_log))
else:
@@ -78,7 +78,7 @@ class PathodHandler(tcp.BaseHandler):
version.NAMEVERSION
)
app.serve(req, self.wfile)
- logging.debug("%s: wsgi %s %s"%(self.client_address, method, path))
+ self.debug("%s %s"%(method, path))
class Pathod(tcp.TCPServer):
diff --git a/libpathod/rparse.py b/libpathod/rparse.py
index bb45ae00..6306f746 100644
--- a/libpathod/rparse.py
+++ b/libpathod/rparse.py
@@ -293,6 +293,8 @@ class Body:
class Path:
def __init__(self, value):
+ if isinstance(value, basestring):
+ value = ValueLiteral(value)
self.value = value
def accept(self, settings, r):
@@ -300,7 +302,7 @@ class Path:
@classmethod
def expr(klass):
- e = Value.copy()
+ e = v_naked_literal.copy()
return e.setParseAction(lambda x: klass(*x))