mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Test replay corner cases. Fix discovered bugs.
This commit is contained in:
parent
aab45078ad
commit
79af9e89c4
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,5 +8,6 @@ MANIFEST
|
|||||||
*.swo
|
*.swo
|
||||||
mitmproxyc
|
mitmproxyc
|
||||||
mitmdumpc
|
mitmdumpc
|
||||||
netlib
|
|
||||||
.coverage
|
.coverage
|
||||||
|
netlib
|
||||||
|
libpathod
|
||||||
|
@ -67,11 +67,9 @@ class RequestReplayThread(threading.Thread):
|
|||||||
self.flow.request, httpversion, code, msg, headers, content, server.cert
|
self.flow.request, httpversion, code, msg, headers, content, server.cert
|
||||||
)
|
)
|
||||||
response._send(self.masterq)
|
response._send(self.masterq)
|
||||||
except (ProxyError, http.HttpError), v:
|
except (ProxyError, http.HttpError, tcp.NetLibError), v:
|
||||||
err = flow.Error(self.flow.request, v.msg)
|
err = flow.Error(self.flow.request, str(v))
|
||||||
err._send(self.masterq)
|
err._send(self.masterq)
|
||||||
except tcp.NetLibError, v:
|
|
||||||
raise ProxyError(502, v)
|
|
||||||
|
|
||||||
|
|
||||||
class ServerConnection(tcp.TCPClient):
|
class ServerConnection(tcp.TCPClient):
|
||||||
|
@ -30,6 +30,18 @@ class SanityMixin:
|
|||||||
rt.join()
|
rt.join()
|
||||||
assert l.response.code == 305
|
assert l.response.code == 305
|
||||||
|
|
||||||
|
# Disconnect error
|
||||||
|
l.request.path = "/p/305:d0"
|
||||||
|
rt = self.master.replay_request(l)
|
||||||
|
rt.join()
|
||||||
|
assert l.error
|
||||||
|
|
||||||
|
# Port error
|
||||||
|
l.request.port = 1
|
||||||
|
rt = self.master.replay_request(l)
|
||||||
|
rt.join()
|
||||||
|
assert l.error
|
||||||
|
|
||||||
|
|
||||||
class TestHTTP(tutils.HTTPProxTest, SanityMixin):
|
class TestHTTP(tutils.HTTPProxTest, SanityMixin):
|
||||||
def test_invalid_http(self):
|
def test_invalid_http(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user