mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 16:17:49 +00:00
Allow naked value literal for pathoc path specifications.
This commit is contained in:
parent
65aef81997
commit
a68b4498b8
@ -9,6 +9,9 @@ class PathodError(Exception): pass
|
|||||||
class PathodHandler(tcp.BaseHandler):
|
class PathodHandler(tcp.BaseHandler):
|
||||||
wbufsize = 0
|
wbufsize = 0
|
||||||
sni = None
|
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):
|
def handle_sni(self, connection):
|
||||||
self.sni = connection.get_servername()
|
self.sni = connection.get_servername()
|
||||||
|
|
||||||
@ -20,7 +23,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
self.server.ssloptions["keyfile"],
|
self.server.ssloptions["keyfile"],
|
||||||
)
|
)
|
||||||
except tcp.NetLibError, v:
|
except tcp.NetLibError, v:
|
||||||
logging.debug("%s: %s"%(self.client_address, str(v)))
|
self.debug(v)
|
||||||
self.finish()
|
self.finish()
|
||||||
|
|
||||||
while not self.finished:
|
while not self.finished:
|
||||||
@ -61,10 +64,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
headers = headers.lst,
|
headers = headers.lst,
|
||||||
sni = self.sni,
|
sni = self.sni,
|
||||||
remote_address = self.client_address,
|
remote_address = self.client_address,
|
||||||
#full_url = self.request.full_url(),
|
|
||||||
#query = self.request.query,
|
|
||||||
httpversion = httpversion,
|
httpversion = httpversion,
|
||||||
#uri = self.request.uri,
|
|
||||||
)
|
)
|
||||||
self.server.add_log(dict(request=request_log, response=response_log))
|
self.server.add_log(dict(request=request_log, response=response_log))
|
||||||
else:
|
else:
|
||||||
@ -78,7 +78,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
version.NAMEVERSION
|
version.NAMEVERSION
|
||||||
)
|
)
|
||||||
app.serve(req, self.wfile)
|
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):
|
class Pathod(tcp.TCPServer):
|
||||||
|
@ -293,6 +293,8 @@ class Body:
|
|||||||
|
|
||||||
class Path:
|
class Path:
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
|
if isinstance(value, basestring):
|
||||||
|
value = ValueLiteral(value)
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def accept(self, settings, r):
|
def accept(self, settings, r):
|
||||||
@ -300,7 +302,7 @@ class Path:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def expr(klass):
|
def expr(klass):
|
||||||
e = Value.copy()
|
e = v_naked_literal.copy()
|
||||||
return e.setParseAction(lambda x: klass(*x))
|
return e.setParseAction(lambda x: klass(*x))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user