sans-io compat++

This commit is contained in:
Maximilian Hils 2020-11-17 17:29:17 +01:00
parent 98f060d019
commit 739b5b0b74
3 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,7 @@ from mitmproxy.utils import human
class TermStatus:
def running(self):
if ctx.options.server:
if ctx.master.server.bound:
ctx.log.info(
"Proxy server listening at http://{}".format(
human.format_address(ctx.master.server.address)

View File

@ -6,6 +6,7 @@ from mitmproxy import connections
from mitmproxy import controller, exceptions # noqa
from mitmproxy import stateobject
from mitmproxy import version
from mitmproxy.utils import compat
class Error(stateobject.StateObject):
@ -63,8 +64,8 @@ class Flow(stateobject.StateObject):
def __init__(
self,
type: str,
client_conn: connections.ClientConnection,
server_conn: connections.ServerConnection,
client_conn: compat.Client,
server_conn: compat.Server,
live: bool=None
) -> None:
self.type = type
@ -84,8 +85,8 @@ class Flow(stateobject.StateObject):
_stateobject_attributes = dict(
id=str,
error=Error,
client_conn=connections.ClientConnection,
server_conn=connections.ServerConnection,
client_conn=compat.Client,
server_conn=compat.Server,
type=str,
intercepted=bool,
is_replay=str,

View File

@ -10,6 +10,7 @@ async def test_configure():
ts = termstatus.TermStatus()
with taddons.context() as ctx:
ctx.master.server = proxy.DummyServer()
ctx.master.server.bound = True
ctx.configure(ts, server=False)
ts.running()
ctx.configure(ts, server=True)