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.
If you use a token plugin, or a Unix socket target, then you should no
longer specify a target on the command line. Add these to the usage
string to make this clear.
Something is broken in pip so it installs a wrapt that doesn't support
Python 3.4. Work around this by manually request a version that is known
to work.