mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 23:09:44 +00:00
console: slightly less hacky hack show http2 warning after first tick
This commit is contained in:
parent
3d477c72d3
commit
a635e04fbf
@ -454,13 +454,6 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
signals.update_settings.send()
|
signals.update_settings.send()
|
||||||
self.loop.set_alarm_in(0.01, self.ticker)
|
self.loop.set_alarm_in(0.01, self.ticker)
|
||||||
|
|
||||||
if not hasattr(self, 'http2_error_shown') and self.server.config.http2 and not tcp.HAS_ALPN: # pragma: no cover
|
|
||||||
self.http2_error_shown = True
|
|
||||||
signals.status_message.send(
|
|
||||||
message="ALPN support missing (OpenSSL 1.0.2+ required). "
|
|
||||||
"HTTP/2 is disabled. Use --no-http2 to silence this warning.",
|
|
||||||
expire=5
|
|
||||||
)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ui = urwid.raw_display.Screen()
|
self.ui = urwid.raw_display.Screen()
|
||||||
@ -491,6 +484,14 @@ class ConsoleMaster(flow.FlowMaster):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.loop.set_alarm_in(0.01, self.ticker)
|
self.loop.set_alarm_in(0.01, self.ticker)
|
||||||
|
if self.server.config.http2 and not tcp.HAS_ALPN: # pragma: no cover
|
||||||
|
def http2err(*args, **kwargs):
|
||||||
|
signals.status_message.send(
|
||||||
|
message = "HTTP/2 disabled - OpenSSL 1.0.2+ required."
|
||||||
|
" Use --no-http2 to silence this warning.",
|
||||||
|
expire=5
|
||||||
|
)
|
||||||
|
self.loop.set_alarm_in(0.01, http2err)
|
||||||
|
|
||||||
# It's not clear why we need to handle this explicitly - without this,
|
# It's not clear why we need to handle this explicitly - without this,
|
||||||
# mitmproxy hangs on keyboard interrupt. Remove if we ever figure it
|
# mitmproxy hangs on keyboard interrupt. Remove if we ever figure it
|
||||||
|
Loading…
Reference in New Issue
Block a user