websockify/websockify
Brooks Swinnerton 9003646a8e
Coerce BaseTokenAPI port to int if numeric
This commit builds on b46fab5 to further sanitize the port value that
comes in when using the BaseTokenAPI plugin.

As far as I can tell, b46fab5 _only_ supports ascii based port values
like `ssh` and not integer-based values like `22`. This results in
identical failures to the ones described in novnc/websockify#399:

```
WebSocket server settings:
  - Listen on :80
  - No SSL/TLS support (no cert file)
  - proxying from :80 to targets generated by BaseTokenAPI
172.17.0.1 - - [02/Sep/2019 19:05:25] 172.17.0.1: Plain non-SSL (ws://) WebSocket connection
172.17.0.1 - - [02/Sep/2019 19:05:25] 172.17.0.1: Path: '/websockify?token=8bff5517-f620-461c-82df-6eb42163411b'
172.17.0.1 - - [02/Sep/2019 19:05:25] connecting to: 172.16.16.16:5910

172.17.0.1 - - [02/Sep/2019 19:05:25] Failed to connect to 172.16.16.16:5910
```

This commit makes two changes:
1. Strips any leading or trailing spaces from the port value
2. Checks to see if the ascii-encoded string is composed of digits, and
if so, coerce the value to an `int`
2019-09-02 15:12:33 -04:00
..
__init__.py Don't use implicit relative imports 2015-02-03 16:52:29 -05:00
__main__.py Add a __main__.py file for invocation as a module 2019-06-13 17:16:25 +02:00
auth_plugins.py novnc redis backed token_plyugins.py 2019-04-29 20:32:04 +02:00
sysloghandler.py Syslog now RFC 5424 compliant and properly identified. 2018-08-28 19:52:47 +01:00
token_plugins.py Coerce BaseTokenAPI port to int if numeric 2019-09-02 15:12:33 -04:00
websocket.py fix handling of code: invalid unpacking, undefined variable in error path, missing argument 2019-02-23 12:37:16 +07:00
websocketproxy.py [websocketproxy] Fixed base class call to process_request() when using 2019-05-15 14:58:47 +02:00
websocketserver.py Change WebSocket request handler to a mix-in 2018-08-15 17:07:37 +02:00
websockifyserver.py Use client IP in logs, not host 2019-04-25 10:05:14 +02:00