diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2016-02-19 12:16:55 +1300 | 
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2016-02-19 12:16:55 +1300 | 
| commit | a635e04fbfb1623db25687bb04c022b32bd0ed2c (patch) | |
| tree | c973a8cb5a582c34fddaf0337e3ac840c58d199f | |
| parent | 3d477c72d3283f26cff99139c957b317c984cc7b (diff) | |
| download | mitmproxy-a635e04fbfb1623db25687bb04c022b32bd0ed2c.tar.gz mitmproxy-a635e04fbfb1623db25687bb04c022b32bd0ed2c.tar.bz2 mitmproxy-a635e04fbfb1623db25687bb04c022b32bd0ed2c.zip  | |
console: slightly less hacky hack show http2 warning after first tick
| -rw-r--r-- | mitmproxy/console/__init__.py | 15 | 
1 files changed, 8 insertions, 7 deletions
diff --git a/mitmproxy/console/__init__.py b/mitmproxy/console/__init__.py index c6b91e16..f7e7b0d5 100644 --- a/mitmproxy/console/__init__.py +++ b/mitmproxy/console/__init__.py @@ -454,13 +454,6 @@ class ConsoleMaster(flow.FlowMaster):              signals.update_settings.send()          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):          self.ui = urwid.raw_display.Screen() @@ -491,6 +484,14 @@ class ConsoleMaster(flow.FlowMaster):                  sys.exit(1)          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,          # mitmproxy hangs on keyboard interrupt. Remove if we ever figure it  | 
