mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Merge branch 'master' of ssh.github.com:cortesi/mitmproxy
This commit is contained in:
commit
362fdf9bae
@ -80,6 +80,8 @@ class Master:
|
|||||||
return changed
|
return changed
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
global should_exit
|
||||||
|
should_exit = False
|
||||||
if self.server:
|
if self.server:
|
||||||
slave = Slave(self.masterq, self.server)
|
slave = Slave(self.masterq, self.server)
|
||||||
slave.start()
|
slave.start()
|
||||||
|
@ -104,7 +104,6 @@ def parse_request_line(request):
|
|||||||
return method, scheme, host, port, path, minor
|
return method, scheme, host, port, path, minor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FileLike:
|
class FileLike:
|
||||||
def __init__(self, o):
|
def __init__(self, o):
|
||||||
self.o = o
|
self.o = o
|
||||||
@ -197,7 +196,10 @@ class ServerConnection:
|
|||||||
if not len(parts) == 3:
|
if not len(parts) == 3:
|
||||||
raise ProxyError(502, "Invalid server response: %s."%line)
|
raise ProxyError(502, "Invalid server response: %s."%line)
|
||||||
proto, code, msg = parts
|
proto, code, msg = parts
|
||||||
code = int(code)
|
try:
|
||||||
|
code = int(code)
|
||||||
|
except ValueError:
|
||||||
|
raise ProxyError(502, "Invalid server response: %s."%line)
|
||||||
headers = flow.Headers()
|
headers = flow.Headers()
|
||||||
headers.read(self.rfile)
|
headers.read(self.rfile)
|
||||||
if code >= 100 and code <= 199:
|
if code >= 100 and code <= 199:
|
||||||
|
@ -393,8 +393,11 @@ def parse_url(url):
|
|||||||
if not scheme:
|
if not scheme:
|
||||||
return None
|
return None
|
||||||
if ':' in netloc:
|
if ':' in netloc:
|
||||||
host, port = string.split(netloc, ':')
|
host, port = string.rsplit(netloc, ':', maxsplit=1)
|
||||||
port = int(port)
|
try:
|
||||||
|
port = int(port)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
host = netloc
|
host = netloc
|
||||||
if scheme == "https":
|
if scheme == "https":
|
||||||
|
@ -216,6 +216,9 @@ class u_parse_url(libpry.AutoTree):
|
|||||||
s, h, po, pa = utils.parse_url("https://foo")
|
s, h, po, pa = utils.parse_url("https://foo")
|
||||||
assert po == 443
|
assert po == 443
|
||||||
|
|
||||||
|
assert not utils.parse_url("https://foo:bar")
|
||||||
|
assert not utils.parse_url("https://foo:")
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
uformat_timestamp(),
|
uformat_timestamp(),
|
||||||
uisBin(),
|
uisBin(),
|
||||||
|
Loading…
Reference in New Issue
Block a user