Commit Graph

62 Commits

Author SHA1 Message Date
Adam Johnson
ca61162129
Lint with pre-commit (#365)
* Lint with pre-commit

* Move existing tox qa hooks into pre-commit.
* Set up GitHub Action based on https://github.com/pre-commit/action/ (we could also use https://pre-commit.ci ).
* Add `pyupgrade` to drop old Python syntax.
* Add `flake8-bugbear` plugin to prevent flake8 errors.

* Drop custom GHA
2021-04-07 20:11:21 +02:00
Simon Willison
333f4644d1 Added support for raw_path in scope. (#268)
As per https://github.com/django/asgiref/pull/92

Required valid URI path fragments to be used in tests:
- Test case must ensure paths are correctly quoted before calling
   run_daphne_request() & co.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2019-07-03 20:22:03 +02:00
Andrew Godwin
0ed6294406 Implement Black code formatting 2018-08-27 12:29:57 +10:00
Nick Sellen
2f94210321 Add x-forwarded-proto support (#219) 2018-07-24 13:25:03 -07:00
Anders Jensen
adb622d4f5 Removed deferToThread for ASGI instance constructor (#218)
The previous behaviour was from an older spec.
2018-07-22 09:54:42 -07:00
Brian May
d5611bccb6 Don't crash if connection closed before application started (#213)
Fixes #205.
2018-07-05 18:26:34 -07:00
Andrew Godwin
84466d4ae4 Fixed #207: Do header transforms for WebSocket XFF right 2018-05-26 12:16:07 +02:00
Andrew Godwin
9f7e19cf2d Use clean headers to fix decoding issues 2018-05-25 15:11:09 +02:00
Andrew Godwin
dd2c8b2a0f Don't try to send disconnect when we never made an app instance 2018-05-03 09:47:12 -07:00
Andrew Godwin
a7ccfab495 Run server constructor in a threadpool as it's synchronous 2018-04-18 10:57:58 -07:00
Andrew Godwin
173617ad3b Fixed #172: Outgoing frames do not reset ping clock (incoming does) 2018-02-16 09:56:40 -08:00
Andrew Godwin
678a97ec7f Fixed #152: Give ASGI apps a grace period after close before killing
Also adds a warning when they do not correctly exit before killing.
2018-02-07 12:02:30 -08:00
Andrew Godwin
db68c43de1 Fix imports and use of six 2018-02-01 21:02:37 -08:00
Andrew Godwin
7f5fe7370f Add flake8 linting 2017-11-28 23:42:35 -08:00
Andrew Godwin
08e7841718 Fix import ordering 2017-11-28 18:03:29 -08:00
Andrew Godwin
567c27504d Add websocket tests to make sure everything important is covered. 2017-11-27 00:00:34 -08:00
Andrew Godwin
0626f39214 Unify all strings to double quotes 2017-11-25 13:41:38 -08:00
Andrew Godwin
017797c05b Change to scope-based code 2017-11-12 16:32:30 -08:00
Andrew Godwin
01f174bf26 Trying out asyncio based interface 2017-09-07 21:24:14 -07:00
Andrew Godwin
a656c9f4c6 Initial refactor to get HTTP working in new style 2017-08-07 14:15:35 +10:00
Andrew Godwin
eb195c6004 Don't break if protocol is removed before it's put into reply_protocols 2017-05-15 09:39:03 -07:00
Andrew Godwin
6318bae452 Fixed #110: Use raw WS query string rather than reconstructing it 2017-04-29 19:09:07 -07:00
Maik Hoepfel
2bcec3fe94 Websockets test and unicode fix for Python 2 (#111)
* Python 2 fix for host address

This is a copy of
57051a48cd
for the Websocket protocol.

In Python 2, Twisted returns a byte string for the host address, while
the spec requires a unicode string. A simple cast gives us consistency.

* Test suite for websocket tests

This commit

* introduces some new helpers to test the Websocket protocol
* renames the old ASGITestCase class to ASGIHTTPTestCase, and
  introduces a test case for testing Websockets
* moves some helper methods that are shared between HTTP and Websockets
  into a mutual base class
* uses the new helpers to simplfiy the existing tests
* and adds a couple new tests.
2017-04-28 14:45:07 -07:00
Andrew Godwin
3937489c4a Update Daphne for new process-local channel style 2017-03-27 19:49:50 -07:00
Andrew Godwin
bd9b8d0068 Improve accept flow handling to allow accept: False and match spec 2017-03-27 10:02:35 -07:00
Andrew Godwin
4d23655b5c Fixed #78: Use right variable for WS headers 2017-02-10 09:52:16 -08:00
Raphael Michel
2ffed27a77 Fixed a regression introduced in fixing #55 2016-11-05 14:18:54 +01:00
Andrew Godwin
a672da7b21 Merge pull request #58 from rixx/
Respond with a code when closing a connection
2016-11-05 13:38:25 +01:00
Tobias Kunze
c6e4ea25d1 Respond with a code when closing a connection
Regards django/channels#414
2016-11-05 12:27:16 +01:00
Raphael Michel
61ed32d500 Fix #55 -- Optionally parse X-Forwarded-For header 2016-11-05 11:45:48 +01:00
Andrew Godwin
b537bed180 Make accept silently pass if already accepted 2016-10-05 16:00:11 -07:00
Andrew Godwin
685f3aed1e Switch to new explicit WebSocket acceptance 2016-10-05 13:45:12 -07:00
globophobe
9a2748d7da Implement connection force-close via ping timeout
Logging will show WSDISCONNECT.
2016-08-04 20:26:57 +09:00
Andrew Godwin
2bb68654fc Send WebSocket close code on disconnect 2016-07-21 11:53:16 -04:00
Andrew Godwin
8619c31cf9 Better logging for muting 2016-07-21 11:53:15 -04:00
Andrew Godwin
45e67d8e60 Use lower-level autobahn API so it likes us 2016-07-06 12:08:44 -07:00
Andrew Godwin
4c2c2d0fff Also close the socket on receive backpressure 2016-07-06 12:05:14 -07:00
Andrew Godwin
d9ba4c500a Send a closure code with the backpressure close 2016-07-06 11:49:43 -07:00
Andrew Godwin
0f1b0b85b6 Fixed #18: Drop WebSocket connections on .connect backpressure 2016-07-06 11:41:24 -07:00
Flavio Curella
9392e526ea parse multiple subprotocols and return the first match 2016-06-29 11:21:50 -05:00
Andrew Godwin
81d99a34d3 Modify Daphne to send WS headers as a tuple. 2016-05-18 09:58:07 -07:00
Andrew Godwin
2d777e75f9 Take note of backpressure 2016-05-07 13:00:09 -07:00
Andrew Godwin
c863e2f378 Fixed #8: UNIX sockets now don't try and send client/server info 2016-05-04 11:30:37 -07:00
Andrew Godwin
13bac47d70 Don't decode + in URLs 2016-04-27 09:50:39 +01:00
Andrew Godwin
8581192cad Update path encoding for WebSockets 2016-04-27 09:44:46 +01:00
Andrew Godwin
e9d61fc1c8 Fix up path encoding for WS too 2016-04-26 13:37:50 +01:00
Flavio Curella
1d1b397aa2 add support for websocket protocols 2016-04-07 10:03:05 -05:00
Andrew Godwin
ca35d6c18f Add WebSocket keepalive ping support with configurable interval 2016-03-29 03:28:05 -07:00
Andrew Godwin
037f129117 Add timeout to WebSockets as per ASGI spec 2016-03-28 03:28:15 -07:00
Andrew Godwin
e7b323893f Change to new style of single-reader channel 2016-03-21 16:40:29 -07:00