Python 3.4 and 3.5 haven't been tested for long time. Enforce
the minimum version so that users may not attempt to use untested
ancient python versions.
Note that Python 3.6 ~ 3.8 already reached their EOL and we may even
remove support for these in the near future.
GitHub is removing Ubuntu 20.04, and Ubuntu 22.04 doesn't have Python
3.6 that we want to continue testing for. Switch to using containers
instead so we have more control over when to deprecate a Python version.
We use the header dict to pass on non-header information to the
authentication plugins. Make sure an evil client isn't trying to sneak
something in that hasn't been verified by us.
Issue found by Kevin Rasmussen.
pypi has changed something in their end that is incompatible with older
Python versions. Fortunately, anything older than 3.6 is no longer that
interesting as that is the new baseline set by the oldest enterprise
distributions.
If the peer doesn't send us a close code, then don't send any code back
in the response. Sending 1005 is explicitly wrong as the specification
states that code should only be used locally and never be sent over the
network.
GitHub has deprecated 18.04, so we can't continue running tests on that
old distribution. Unfortunately, we can't switch to the latest 22.04
since GitHub doesn't package anything older than Python 3.7 for that
runner.
And unfortunately the oldest version in 20.04 is Python 3.5, so we have
to remove the test runs for Python 3.4.
It's very surprising to get some external copy of websockify when you
are building an image in your local websockify source tree. Make sure we
are using the local copy of everything.
Token plugins are technically optional, but if you are installing
websockify via pip then all of these are available anyway. So let's make
things simple for users.
The logging should be handled directly in send_response() instead, which
is the default of Python's built-in send_response(). Remove this manual
logging to avoid logging the same call twice.
This class acts as a glue between websocket and http functionality by
taking a 'request_handler' and using its functions for send_response(),
send_header() and end_headers().
Functions connect() and accept() are using http functionality, like
sending requests and headers. Let's create separate functions with more
intuitive names for these calls. This allows subclasses to override
these functions, as well as makes the code easier to understand at a
glance.