summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Allow empty options in redis token source string when using default valuesJavier Cacheiro2023-01-191-0/+64
|
* Token Redis: Support both json and plain text tokensJavier Cacheiro2023-01-191-0/+54
|
* Token Redis source: add optional redis port, redis database and redis passwordJavier Cacheiro2023-01-191-0/+32
|
* Don't include default message to send_error()Pierre Ossman2022-11-161-2/+2
| | | | Python can provide this for us, so avoid duplication.
* Add new websocket class HttpWebSocketLinn Mattsson2022-11-081-0/+69
| | | | | | 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().
* Support for jwcrypto>=1.3Javier Cacheiro2022-05-251-10/+10
|
* Add tests for TokenRedisJavier Cacheiro2022-04-121-1/+27
|
* Use RSA-OAEP instead of RSA1_5 for jwt testsPierre Ossman2021-07-231-1/+1
| | | | | The latest version of jwcrypto has disabled RSA1_5 by default, making the tests fail.
* Fix patching of open() for Python 3.4Pierre Ossman2021-05-031-3/+3
| | | | | It doesn't handle builtins automatically, so follow the recommendations from that time.
* Add unit test for token file with tabPierre Ossman2021-04-161-0/+15
|
* Add unit tests for ReadOnlyTokenFilePierre Ossman2021-04-161-2/+31
|
* Move JWT token plugins tests to separate filePierre Ossman2021-04-162-129/+135
| | | | Let's try to match the test units with the modules we have.
* Add unit tests for jwt token time checksPierre Ossman2021-01-291-0/+48
|
* Use assertRaises() as a context managerPierre Ossman2021-01-291-6/+6
| | | | Makes the code a lot easier to read.
* Use patch() as a decorator in testsPierre Ossman2021-01-291-17/+10
| | | | Cleaner and more robust.
* Remove Python version checkPierre Ossman2021-01-291-84/+83
| | | | We require Python 3 now, so no need for this check.
* Remove support for older PythonPierre Ossman2020-12-142-75/+30
| | | | | All active distributions should now support at least Python 3.4, so let's clean things up by removing older compatibility code.
* Convert tests from mox to mockPierre Ossman2020-08-212-88/+57
| | | | mox is deprecated upstream in favour of mock
* Remove all non-Python stuff from the treePierre Ossman2019-07-042-70/+0
| | | | | | | | 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.
* Use direct javascript in test filesPierre Ossman2019-07-035-158/+124
| | | | Avoid relying on our own modules as we are about to split things up.
* Add option for cert key passwordTommy Brunn2019-03-021-3/+3
|
* Added JWT/JWS/JWE tokens capabilityUXabre2019-02-154-0/+131
|
* Enable setting SSL ciphers and SSL optionsTomasz Barański2018-07-051-0/+86
| | | | | | | | 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.
* Added --host-token to allow choosing target by hostname.josedpedroso2018-07-051-3/+3
|
* Added --web-auth option to require authentication to access the webserver.josedpedroso2018-07-051-2/+2
| | | | BasicHTTPAuth plugin now issues 401 on bad credentials to allow the user to try again.
* Do not use base except: clausesAnders Kaseorg2017-11-103-9/+8
| | | | | | https://docs.python.org/2/howto/doanddont.html#except Signed-off-by: Anders Kaseorg <andersk@mit.edu>
* Added SSL-certificate-based client authentication.Hermann Höhne2017-10-261-1/+18
| | | | | | | * Incorporates #190 without breaking compatibility towards old Python versions. * A new plugin allows authenticating clients by the "common name" defined in their certificate. * Added manual for certificate-based client authentication, including hints to which Python versions allow client certificate authentication. * Adjusted test to work with new ssl.create_default_context.
* test_websockifyserver: add send_error stubZac Medico2017-05-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The socket.sendall method is called indirectly via calls to the python3.6 BaseHTTPRequestHandler.send_error method which is called by both the Web*RequestHandler classes as shown below: ====================================================================== ERROR: test_list_dir_with_file_only_returns_error (test_websockifyserver.WebSockifyRequestHandlerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/test_websockifyserver.py", line 115, in test_list_dir_with_file_only_returns_error FakeSocket('GET / HTTP/1.1'), '127.0.0.1', server) File "websockify/websockifyserver.py", line 94, in __init__ WebSocketRequestHandler.__init__(self, req, addr, server) File "websockify/websocketserver.py", line 34, in __init__ BaseHTTPRequestHandler.__init__(self, request, client_address, server) File "/usr/lib64/python3.6/socketserver.py", line 696, in __init__ self.handle() File "websockify/websockifyserver.py", line 293, in handle SimpleHTTPRequestHandler.handle(self) File "/usr/lib64/python3.6/http/server.py", line 418, in handle self.handle_one_request() File "websockify/websocketserver.py", line 46, in handle_one_request BaseHTTPRequestHandler.handle_one_request(self) File "/usr/lib64/python3.6/http/server.py", line 406, in handle_one_request method() File "websockify/websocketserver.py", line 58, in _websocket_do_GET self.do_GET() File "websockify/websockifyserver.py", line 259, in do_GET SimpleHTTPRequestHandler.do_GET(self) File "/usr/lib64/python3.6/http/server.py", line 636, in do_GET f = self.send_head() File "/usr/lib64/python3.6/http/server.py", line 679, in send_head return self.list_directory(path) File "websockify/websockifyserver.py", line 263, in list_directory self.send_error(404, "No such file") File "/usr/lib64/python3.6/http/server.py", line 470, in send_error self.end_headers() File "/usr/lib64/python3.6/http/server.py", line 520, in end_headers self.flush_headers() File "/usr/lib64/python3.6/http/server.py", line 524, in flush_headers self.wfile.write(b"".join(self._headers_buffer)) File "/usr/lib64/python3.6/socketserver.py", line 775, in write self._sock.sendall(b) AttributeError: 'FakeSocket' object has no attribute 'sendall' ====================================================================== ERROR: test_normal_get_with_only_upgrade_returns_error (test_websockifyserver.WebSockifyRequestHandlerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/test_websockifyserver.py", line 101, in test_normal_get_with_only_upgrade_returns_error FakeSocket('GET /tmp.txt HTTP/1.1'), '127.0.0.1', server) File "websockify/websockifyserver.py", line 94, in __init__ WebSocketRequestHandler.__init__(self, req, addr, server) File "websockify/websocketserver.py", line 34, in __init__ BaseHTTPRequestHandler.__init__(self, request, client_address, server) File "/usr/lib64/python3.6/socketserver.py", line 696, in __init__ self.handle() File "websockify/websockifyserver.py", line 293, in handle SimpleHTTPRequestHandler.handle(self) File "/usr/lib64/python3.6/http/server.py", line 418, in handle self.handle_one_request() File "websockify/websocketserver.py", line 46, in handle_one_request BaseHTTPRequestHandler.handle_one_request(self) File "/usr/lib64/python3.6/http/server.py", line 406, in handle_one_request method() File "websockify/websocketserver.py", line 58, in _websocket_do_GET self.do_GET() File "websockify/websockifyserver.py", line 257, in do_GET self.send_error(405, "Method Not Allowed") File "/usr/lib64/python3.6/http/server.py", line 470, in send_error self.end_headers() File "/usr/lib64/python3.6/http/server.py", line 520, in end_headers self.flush_headers() File "/usr/lib64/python3.6/http/server.py", line 524, in flush_headers self.wfile.write(b"".join(self._headers_buffer)) File "/usr/lib64/python3.6/socketserver.py", line 775, in write self._sock.sendall(b) AttributeError: 'FakeSocket' object has no attribute 'sendall'
* Add unittests for ping() and pong()Pierre Ossman2017-04-191-0/+26
|
* Avoid assertIn for Python 2.6 compatibilityPierre Ossman2017-02-091-5/+5
| | | | | It was added in 2.7, but we want to support older Python a while longer.
* Force choice of sub-protocolPierre Ossman2017-02-081-0/+98
| | | | | | The WebSocket standard require us to choose one of the protocols supported by the client. Enforce this with a specific check in the base class rather than relying on generous clients.
* Don't delay flushingPierre Ossman2017-02-031-16/+2
| | | | | | The native WebSocket is in a much better position to do queue management than us. Many callers also failed to notice this part of the API, causing stalls.
* Update websock.js from noVNCPierre Ossman2017-02-031-5/+7
| | | | | | | Sync with noVNC as of commit ae510306b5094b55aa08a2a0d15a151704f70993. The main change is to make it a more proper object that you can instantiate multiple times.
* Remove last bits of Flash WebSocket emulationPierre Ossman2017-02-033-41/+0
| | | | We require native support from the browsers now.
* Split out basic WebSocket server templatePierre Ossman2017-02-014-39/+39
|
* Separate out raw WebSocket protocol handlingPierre Ossman2017-02-016-377/+448
|
* Remove Base64 supportPierre Ossman2017-02-019-156/+1
| | | | | This is an older protocol used before browsers got native support for Websockets.
* TCP_KEEPCNT doesn't exist in non-linuxThomas Goirand2016-10-101-4/+6
| | | | | | | | The TCP_KEEPCNT option for sockets only work with the Linux kernel, this isn't available for example in FreeBSD and Hurd, which makes the package fail to build on these platforms. See Debian bug here: https://bugs.debian.org/840035
* Merge pull request #228 from jrziviani/masterSolly Ross2016-06-301-0/+10
|\ | | | | Enable unix socket to work with token plugin
| * Enable unix socket to work with token pluginJose Ricardo Ziviani2016-02-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | This commit adds support to unix sockets in the token plugin, thus it is possible to have a token files like: token: unix_socket:/path/to/socket_file A single websockify instance will be able to handle multiple sockets. Signed-off-by: Jose Ricardo Ziviani <jose@ziviani.net>
* | Switch test dependency to mox3James Page2016-06-302-2/+2
|/ | | | | | | | | mox is pretty much unmaintained these days, however the OpenStack project are actively maintaining mox3 (a Python 3 compatibile fork with some other improvements). websockify seems quite happy to use mox3 instead, so switch the test dependency and associated imports to use mox3.
* Verify username/password with BasicAuth pluginCeesjan Luiten2015-10-061-0/+28
|
* Rework Auth Plugins to Support HTTP Authfeature/http-auth-pluginsSolly Ross2015-08-251-7/+7
| | | | | | | | | This commit reworks auth plugins slightly to enable support for HTTP authentication. By raising an AuthenticationError, auth plugins can now return HTTP responses to the upgrade request (such as 401). Related to kanaka/noVNC#522
* Introduce strict modeSolly Ross2015-05-131-0/+85
| | | | | | | | This commit introduces strict mode, which is on by default. Currently strict mode only enforces client-to-server frame masking. However, in the future, it might enforce other parts of the RFC as well. Closes #164
* Update Tests and Test PluginsSolly Ross2015-05-133-274/+365
| | | | | This commit updates the unit tests to work with the current code and adds in tests for the auth and token plugin functionality.
* Fix default log level in echo and load testsSolly Ross2014-01-302-2/+6
| | | | | | | | | | | | | Since we switched to using the `logging` module to log in pull request #100, none of the messages on the 'INFO' level were being shown from `tests/echo.py` and `tests/load.py`, since the default log level is 'WARNING'. Now, the log level is set to INFO in `tests/echo.py` and `tests/load.py`, to match the log level in the main websockify executable. Fixes #109
* Merge remote branch 'upstream/master', after #110 was merged.Peter Åstrand (astrand)2013-12-162-2/+2
|\
| * Rename new_client to new_websocket_client, in order to have a betterPeter Åstrand (astrand)2013-11-284-4/+4
| | | | | | | | | | | | name in the SocketServer/HTTPServer request handler hierarchy. Prepare for merge pull request #72. This work has been picked out of 7b3dd8a6f5ef26dbfd6c34a91600ea1613aefaa2 .
| * Rename self.client to self.request, in preparation for merging pullPeter Åstrand (astrand)2013-11-282-5/+5
| | | | | | | | | | request #72. The standard Python SocketServer/BaseRequestHandler requires this name.
* | Merge commit 'a04edfe80f54b44df5a3579f71710560c6b7b4fc'Peter Åstrand (astrand)2013-11-283-100/+82
|\ \ | |/ | | | | | | * commit 'a04edfe80f54b44df5a3579f71710560c6b7b4fc': Added temp dir for unit test data and cleanup