mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Implement and unit test not-after-connect option.
This commit is contained in:
parent
5493925ea0
commit
ed7ef84557
@ -70,6 +70,7 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
'\r\n'
|
'\r\n'
|
||||||
)
|
)
|
||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
|
if not self.server.ssloptions.not_after_connect:
|
||||||
try:
|
try:
|
||||||
self.convert_to_ssl(
|
self.convert_to_ssl(
|
||||||
self.server.ssloptions.certfile,
|
self.server.ssloptions.certfile,
|
||||||
|
@ -52,6 +52,14 @@ class TestNoApi(tutils.DaemonTests):
|
|||||||
assert not "Log" in r.content
|
assert not "Log" in r.content
|
||||||
|
|
||||||
|
|
||||||
|
class TestNotAfterConnect(tutils.DaemonTests):
|
||||||
|
ssl = False
|
||||||
|
not_after_connect = True
|
||||||
|
def test_connect(self):
|
||||||
|
v = self.pathoc(r"get:'http://foo.com/p/202':da", connect_to=("localhost", self.d.port))
|
||||||
|
assert v[1] == 202
|
||||||
|
|
||||||
|
|
||||||
class TestNohang(tutils.DaemonTests):
|
class TestNohang(tutils.DaemonTests):
|
||||||
nohang = True
|
nohang = True
|
||||||
def test_nohang(self):
|
def test_nohang(self):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import tempfile, os, shutil
|
import tempfile, os, shutil
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from libpathod import utils, test, pathoc
|
from libpathod import utils, test, pathoc, pathod
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
class DaemonTests:
|
class DaemonTests:
|
||||||
@ -10,12 +10,15 @@ class DaemonTests:
|
|||||||
ssl = False
|
ssl = False
|
||||||
timeout = None
|
timeout = None
|
||||||
hexdump = False
|
hexdump = False
|
||||||
|
not_after_connect = False
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpAll(self):
|
def setUpAll(self):
|
||||||
|
so = pathod.SSLOptions(not_after_connect = self.not_after_connect)
|
||||||
self.d = test.Daemon(
|
self.d = test.Daemon(
|
||||||
staticdir=test_data.path("data"),
|
staticdir=test_data.path("data"),
|
||||||
anchors=[("/anchor/.*", "202:da")],
|
anchors=[("/anchor/.*", "202:da")],
|
||||||
ssl = self.ssl,
|
ssl = self.ssl,
|
||||||
|
ssloptions = so,
|
||||||
sizelimit=1*1024*1024,
|
sizelimit=1*1024*1024,
|
||||||
noweb = self.noweb,
|
noweb = self.noweb,
|
||||||
noapi = self.noapi,
|
noapi = self.noapi,
|
||||||
|
Loading…
Reference in New Issue
Block a user