diff options
author | Sören Schwert <hello@soerenschwert.de> | 2020-07-28 14:40:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 14:40:42 +0200 |
commit | 663b39cd388bd7aa00afa4f6fb340b2690cae25a (patch) | |
tree | d803aee30ad4b2cd616ef172fce89e0afe8dc2e9 | |
parent | 86a20b23f5b099e3cd484620a1f456ba9fb625d7 (diff) | |
download | websockify-663b39cd388bd7aa00afa4f6fb340b2690cae25a.tar.gz |
Split token file by any whitespace after the colon, not just a space
With the current parser logic, only tokens and servers that are separated by _exactly_ a colon and a space `: ` are detected as tokens. But when formatting one's token file with tabs, this breaks.
This commit changes the split characters to be a regular expression that matches all forms of whitespace, including spaces and tabs.
-rw-r--r-- | websockify/token_plugins.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/websockify/token_plugins.py b/websockify/token_plugins.py index 6193d9b..1f01e0a 100644 --- a/websockify/token_plugins.py +++ b/websockify/token_plugins.py @@ -1,6 +1,7 @@ from __future__ import print_function import os import sys +import re class BasePlugin(object): def __init__(self, src): @@ -31,7 +32,7 @@ class ReadOnlyTokenFile(BasePlugin): for line in [l.strip() for l in open(f).readlines()]: if line and not line.startswith('#'): try: - tok, target = line.split(': ') + tok, target = re.split(':\s', line) self._targets[tok] = target.strip().rsplit(':', 1) except ValueError: print >>sys.stderr, "Syntax error in %s on line %d" % (self.source, index) |