Commit Graph

134 Commits

Author SHA1 Message Date
Pierre Ossman 08f1aea97e Fix mocked socket address
These are tuples, not just strings.
2026-02-11 16:18:07 +01:00
Pierre Ossman bdf1ebf24e Merge branch 'flake8' of github.com:kajinamit/websockify 2025-07-03 16:13:08 +02:00
Takashi Kajinami e2d2931237 Ignore false flake8 error 2025-07-03 23:01:44 +09:00
Takashi Kajinami c00cfc735a Avoid nested import
... to get rid of F401 error by flake8.
2025-07-03 23:01:44 +09:00
Takashi Kajinami 9a38c0ce17 Fix flake8 caused by top level imports 2025-07-03 23:01:44 +09:00
Takashi Kajinami 4aa05c7499 Fix indentations
... which are now complained by flake8.
2025-07-03 23:01:44 +09:00
Alexander Zeijlon 22eaccdc83 Fix iterating over files in dir with pathlib
PosixPath-objects aren't iterable and we need to call the
iterdir()-method if we want to loop over files in the current dir-Path

Closes #612
2025-07-01 14:37:14 +02:00
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 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
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
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 0d519b9c18 Fix fake headers dict in tests 2025-02-12 11:05:56 +01:00
Pierre Ossman 417210f2cf Merge branch 'master' of https://github.com/so-saf/websockify 2024-08-29 16:35:49 +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 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
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
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
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
Javier Cacheiro 0f17500348 Support for jwcrypto>=1.3 2022-05-25 12:40:29 +02:00
Javier Cacheiro d5e8d709d7 Add tests for TokenRedis 2022-04-12 10:58:42 +02:00
Pierre Ossman dc345815c0 Use RSA-OAEP instead of RSA1_5 for jwt tests
The latest version of jwcrypto has disabled RSA1_5 by default, making
the tests fail.
2021-07-23 09:38:58 +02:00
Pierre Ossman eca301c05b Fix patching of open() for Python 3.4
It doesn't handle builtins automatically, so follow the recommendations
from that time.
2021-05-03 14:34:07 +02:00
Pierre Ossman b9b269c73f Add unit test for token file with tab 2021-04-16 13:02:07 +02:00
Pierre Ossman 100a776409 Add unit tests for ReadOnlyTokenFile 2021-04-16 12:59:17 +02:00
Pierre Ossman 984dcc62d3 Move JWT token plugins tests to separate file
Let's try to match the test units with the modules we have.
2021-04-16 11:27:56 +02:00
Pierre Ossman b22a6b0ce0 Add unit tests for jwt token time checks 2021-01-29 13:11:07 +01:00
Pierre Ossman fadb25e026 Use assertRaises() as a context manager
Makes the code a lot easier to read.
2021-01-29 13:10:16 +01:00
Pierre Ossman 3f17696dc6 Use patch() as a decorator in tests
Cleaner and more robust.
2021-01-29 13:09:19 +01:00
Pierre Ossman a82eb10b48 Remove Python version check
We require Python 3 now, so no need for this check.
2021-01-29 12:58:26 +01:00
Pierre Ossman 96eda1a5c7 Remove support for older Python
All active distributions should now support at least Python 3.4, so
let's clean things up by removing older compatibility code.
2020-12-14 13:48:54 +01:00
Pierre Ossman 992e09eac4 Convert tests from mox to mock
mox is deprecated upstream in favour of mock
2020-08-21 10:50:11 +02:00
Pierre Ossman 368ec2c06e Remove all non-Python stuff from the tree
We're splitting the repository into multiple ones. This one will
only retain the Python stuff (and rebind, used by websocketproxy).

Only once license is needed after this, so use the standard COPYING
filename.
2019-07-04 11:27:40 +02:00
Pierre Ossman 60acf3cd3c Use direct javascript in test files
Avoid relying on our own modules as we are about to split things up.
2019-07-03 15:56:25 +02:00
Tommy Brunn 0163e4060b Add option for cert key password 2019-03-02 17:21:28 +01:00
UXabre f2031eff05 Added JWT/JWS/JWE tokens capability 2019-02-15 03:45:57 -05:00
Tomasz Barański 51ad14d16c Enable setting SSL ciphers and SSL options
The change adds two options to WebSockifyServer. The first is a list of
SSL ciphers. The second is SSL options (intended use is to force a
specific TLS version).

Those two options allow for greater security of WebSocket Proxy.
2018-07-05 21:54:20 +02:00
josedpedroso af85184e28 Added --host-token to allow choosing target by hostname. 2018-07-05 00:54:19 +01:00
josedpedroso 8964adf111 Added --web-auth option to require authentication to access the webserver.
BasicHTTPAuth plugin now issues 401 on bad credentials to allow the user to try again.
2018-07-05 00:48:08 +01:00
Anders Kaseorg 3c1655322d Do not use base except: clauses
https://docs.python.org/2/howto/doanddont.html#except

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2017-11-10 05:48:20 -05:00