Commit Graph

971 Commits

Author SHA1 Message Date
Takashi Kajinami de4acf0752 Drop unused variables 2025-06-24 21:27:25 +09:00
Takashi Kajinami 053d37c1d6 Remove dead code
... to fix "E265 block comment should start with '# '".
2025-06-24 21:27:25 +09:00
Takashi Kajinami 992a2d1793 Use 'is' in comparison to None
... instead of == or != .
2025-06-24 21:27:25 +09:00
Takashi Kajinami b9194bf175 Avoid multiple statements on one line 2025-06-24 21:27:25 +09:00
Takashi Kajinami 9140ab7a7d Fix flake8 errors related to whitespace 2025-06-24 21:27:25 +09:00
Takashi Kajinami 9e1c731089 Fix flake8 errors related to blank lines 2025-06-24 21:27:24 +09:00
Takashi Kajinami 070876493b Drop unused/duplicate import 2025-06-24 21:27:04 +09:00
Takashi Kajinami e92a6ddf42 Fix conflicting test case name
... and fix the wrong format of Sec-WebSocket-Protocol header in test
case.
2025-06-24 21:27:04 +09:00
Takashi Kajinami 9ffe1493da Use print function, not print statement
print statement is no longer available in Python 3.
2025-06-24 21:27:04 +09:00
Takashi Kajinami 12dd0c738e Drop trailing semicolons 2025-06-24 21:27:04 +09:00
Takashi Kajinami d19312ba75 tox: Restore pep8 target
... so that we can run flake8 check more easily. Note that the check
is not yet enforced in CI.
2025-06-24 21:27:04 +09:00
Alexander Zeijlon ca75d331f7 Merge branch 'http-405' of https://github.com/tobias-urdin/websockify 2025-06-24 12:41:30 +02:00
Tobias Urdin 93517f1fcb Return 405 Method Not Allowed in request handler
Instead of returning HTTP 501 lets implement the
other HTTP methods and returns a HTTP 405 Method
Not Allowed.

Signed-off-by: Tobias Urdin <tobias.urdin@binero.com>
2025-06-24 08:57:25 +02:00
Alexander Zeijlon c44e432e14 Merge branch 'master' of https://github.com/he1f/websockify 2025-06-23 15:55:38 +02:00
Pierre Ossman c7f6a577d8 Merge branch 'run-script' of github.com:kajinamit/websockify 2025-06-09 11:23:25 +02:00
Takashi Kajinami 8984408af3 Remove run script alias
It was added 13 years ago for compatibility when the run script was
converted to a shell script by [1]. The long time has passed since then
and we can assume that users may no longer use it. Removing it allows
us to resolve the confusing name (.py which triggers shell).

[1] 4f6a82159c
2025-06-08 22:03:22 +09:00
Alexander Zeijlon cdc245273b Merge branch 'py3' of https://github.com/kajinamit/websockify 2025-06-05 10:00:11 +02:00
Alexander Zeijlon 15489fb72e Merge branch 'tox-update' of https://github.com/kajinamit/websockify 2025-06-04 15:36:26 +02:00
Takashi Kajinami 37b0f2643b Drop third party mock
It hasn't been used since python 2 support was removed by
96eda1a5c7 .
2025-06-04 01:05:33 +09:00
Takashi Kajinami aa5f0bf8ab Require Python >= 3.6
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.
2025-06-04 01:00:13 +09:00
Takashi Kajinami 03dba52b04 Fix test command to run unit tests
It should have been updated when nose was replaced by nose2[1].

[1] 9ac3272d2b
2025-06-04 00:54:44 +09:00
Takashi Kajinami c24fbbce94 tox: Update default env
Support for python 3.4 was removed long time ago. Use py3, which may
be translated to the default system python for convenience.
2025-06-04 00:51:46 +09:00
Dmitry Kozlov 008a13029f migrate TokenPlugins from os.path to pathlib to ensure all files are closed 2025-04-28 15:18:30 +03:00
Pierre Ossman 4acdb13d5b Also test on Python 3.13 2025-04-10 14:53:10 +02:00
Pierre Ossman 465eb1b5a0 Switch to containers for GitHub actions
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.
2025-04-10 14:52:02 +02:00
Alexander Zeijlon e818947513 websockify 0.13.0 2025-02-12 11:45:01 +01:00
Pierre Ossman 0d519b9c18 Fix fake headers dict in tests 2025-02-12 11:05:56 +01:00
Pierre Ossman 187e204ce4 Clear out sensitive fake headers from client
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.
2025-02-12 09:56:15 +01:00
Pierre Ossman 417210f2cf Merge branch 'master' of https://github.com/so-saf/websockify 2024-08-29 16:35:49 +02:00
Pierre Ossman 245fd08e52 Use standard line endings in sysloghandler.py
This file was accidentally using DOS file endings, unlike every other
file in this project.
2024-08-29 16:31:43 +02:00
Tomasz Kłoczko 3f205f7cc6 drop python<3.6 support
Filter all code over `pyupgrade --py36-plus` and update `classifiers`.
2024-08-29 16:30:36 +02:00
Insaf Nureev 0af3404ec9 Add namespace value to TokenRedis source 2024-08-22 17:51:56 +03:00
Insaf Nureev 5989d31ebf Add namespace value to TokenRedis source 2024-08-08 13:05:45 +03:00
Pierre Ossman b6c02b13e3 Include host in TLS setup
This enabled SNI, and allows it to check the certificate for the correct
host.
2024-07-30 09:21:03 +02:00
Pierre Ossman f632fa0285 Use SSLContext.wrap_context() for SSL/TLS sockets
ssl.wrap_context() has been deprecated for some time, and has now been
removed. Use the newer API instead.
2024-07-30 09:21:03 +02:00
Samuel Mannehed f05cd203de Exit gracefully when socket fails to open
This fixes prevents a traceback that was shown when trying to listen to
an address on which 'bind' fails.
2024-07-22 00:27:41 +02:00
Pierre Ossman 99f83ca083 websockify 0.12.0 2024-06-03 14:40:01 +02:00
Pierre Ossman eb4ea05ccd Use latest github actions
Avoids some complaints when running things.
2024-05-20 10:17:17 +02:00
Pierre Ossman 4a83562af7 Start testing Python 3.12
It is out and stable, so let's make sure we are compatible.
2024-05-20 10:16:58 +02:00
Pierre Ossman 4bae6a44ac Stop testing on Python 3.5
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.
2024-05-20 10:14:59 +02:00
Pierre Ossman a2362da1b7 Fix client mask generation
random.randrange() gives integers, which need to be explicitly converted
to bytes.
2024-05-20 10:01:18 +02:00
Pierre Ossman bccf1dd258 Patch redis module in tests
Make sure the tests can be run even if redis isn't installed.
2024-02-08 09:43:55 +01:00
shifengbin 0427f63f96 feat: TokenFileName 2024-02-08 09:33:46 +01:00
Pierre Ossman 43c371fc7a Don't fake a close code in close response
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.
2023-09-06 12:25:19 +02:00
Pierre Ossman 354668143f Use Ubuntu 20.04 runner for tests
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.
2023-08-23 08:49:17 +02:00
Pierre Ossman e28b7c8c75 Fix usage syntax in regular TCP case
You always need to specify the target on the command line as the system
has no default target address.
2023-08-21 16:28:58 +02:00
Pierre Ossman a1346552fb Merge branch 'token_redis_improvements' of https://github.com/javicacheiro/websockify 2023-01-20 17:01:32 +01:00
Javier Cacheiro 3d2e93aeb0 Allow empty options in redis token source string when using default values 2023-01-19 17:19:30 +01:00
Javier Cacheiro e23d4e337c Token Redis: Support both json and plain text tokens 2023-01-19 17:19:27 +01:00
Javier Cacheiro 8121a5265a Token Redis source: add optional redis port, redis database and redis password 2023-01-19 17:17:07 +01:00