Commit Graph

949 Commits

Author SHA1 Message Date
Doctor 3eca8ad195 run `ruff format .` 2025-03-12 20:55:57 +03:00
Doctor 4fc7e52352 ci: add lint workflow 2025-03-12 20:53:31 +03:00
Doctor a994cd869e build: migrate from `setup.py` to `pyproject.toml` 2025-03-12 20:53:21 +03: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
Javier Cacheiro 5dd81a0363 Remove simplejson dependency: use json module from stdlib.
Add missing redis dependency.
2023-01-19 16:35:53 +01:00
don bright 7f53e9c22c
Update README.md
adding WSS exceptions for dummies
2023-01-07 16:34:17 -06:00
Pierre Ossman d54020538d Merge branch 'master' of https://github.com/shiomax/websockify 2022-12-22 14:15:46 +01:00
Pierre Ossman ac74ade2ca Test current versions of Python 2022-12-16 14:15:23 +01:00
Pierre Ossman 9ac3272d2b Switch to nose2 for tests
The original nosetests is long abandoned, and doesn't work properly on
newer versions of Python.
2022-12-16 14:14:54 +01:00
Pierre Ossman 5d17281187 Remove redundant test requirements
These should get pulled in via setup.py.
2022-12-16 14:14:54 +01:00
Pierre Ossman 789b80f719 Explicitly install dependencies
It is very buggy if we let setuptools do it for some reason, so have
this as an explicit step instead.
2022-12-16 14:14:23 +01:00
Pierre Ossman 06e61fa4cc websockify 0.11.0 2022-12-16 13:11:04 +01:00
Pierre Ossman 4f9d496dfe Use local websockify when building container
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.
2022-12-16 13:10:58 +01:00
Pierre Ossman 1979e92f0e Also require all token plugin requirements
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.
2022-12-16 13:08:23 +01:00
max 63eb24dd8e Add option to listen to unix socket 2022-12-14 20:51:29 +01:00
Adam Tilghman d2affc73b5 Insert rebinder at the head of the (possibly empty) LD_PRELOAD pathlist,
required for use cases relying on other preloaded libraries e.g. nss_wrapper.
2022-11-16 16:35:39 -08:00
Pierre Ossman 27ee353401 Don't include default message to send_error()
Python can provide this for us, so avoid duplication.
2022-11-16 15:28:18 +01:00
Pierre Ossman 39c7cb0115 Merge branch 'http_api' of https://github.com/CendioOssman/websockify 2022-11-08 14:29:12 +01:00
Linn Mattsson be7b868518 Remove logging from handle_upgrade()
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.
2022-11-08 14:24:46 +01:00
Linn Mattsson 4695f96728 Add new websocket class HttpWebSocket
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().
2022-11-08 14:24:46 +01:00
Linn Mattsson 832ae23f00 Make websocket's API more intuitive
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.
2022-11-08 14:05:46 +01:00
Jokin c123bfbbff
Add requests module 2022-10-20 11:28:34 +00:00
Manoj Ghosh 70579756f3 expose --file-only option to disable dir listing 2022-10-18 04:10:44 -07:00
Pierre Ossman e9c80aa32a Merge branch 'master' of https://github.com/msnatepg/websockify 2022-10-10 10:13:01 +02:00
Maximilian Sesterhenn caef680fff ensure that queues are empty when closing connections 2022-10-07 14:24:53 +02:00
Pierre Ossman 7133f85df6 Merge branch 'verbose_logging' of https://github.com/javicacheiro/websockify 2022-08-18 11:11:22 +02:00