From dbb1362fd208bd18f14a28ae144a20b86c65c1b4 Mon Sep 17 00:00:00 2001 From: Solly Ross Date: Thu, 9 Apr 2015 11:36:37 -0400 Subject: [PATCH] Fix bug in token_plugin/target_cfg support Previously, if no `target_cfg` flag was used, the `target_cfg` option would not get removed from the opts dict, causing an error when it got passed through to `WebSocketProxy`. Now we always remove it. Fixes #168. --- websockify/websocketproxy.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/websockify/websocketproxy.py b/websockify/websocketproxy.py index fdad0da..97c5d82 100755 --- a/websockify/websocketproxy.py +++ b/websockify/websocketproxy.py @@ -384,7 +384,8 @@ def websockify_init(): if opts.target_cfg: opts.token_plugin = 'TokenFile' opts.token_source = opts.target_cfg - del opts.target_cfg + + del opts.target_cfg # Sanity checks if len(args) < 2 and not (opts.token_plugin or opts.unix_target): @@ -451,9 +452,11 @@ class LibProxyServer(ForkingMixIn, HTTPServer): self.wrap_mode = kwargs.pop('wrap_mode', None) self.unix_target = kwargs.pop('unix_target', None) self.ssl_target = kwargs.pop('ssl_target', None) - self.target_cfg = kwargs.pop('target_cfg', None) + self.token_plugin = kwargs.pop('token_plugin', None) + self.token_source = kwargs.pop('token_source', None) + + self.token_plugin = None self.daemon = False - self.target_cfg = None # Server configuration listen_host = kwargs.pop('listen_host', '')