diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6369627..6238f69 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,23 @@ +1.2.0 (2017-04-01) +------------------ + +* The new process-specific channel support is now implemented, resulting in + significantly less traffic to your channel backend. + +* Native twisted blocking support for channel layers that support it is now + used. While it is a lot more efficient, it is also sometimes slightly more + latent; you can disable it using --force-sync. + +* Native SSL termination is now correctly reflected in the ASGI-HTTP `scheme` + key. + +* accept: False is now a valid way to deny a connection, as well as close: True. + +* HTTP version is now correctly sent as one of "1.0", "1.1" or "2". + +* More command line options for websocket timeouts + + 1.1.0 (2017-03-18) ------------------ diff --git a/daphne/__init__.py b/daphne/__init__.py index 6849410..c68196d 100755 --- a/daphne/__init__.py +++ b/daphne/__init__.py @@ -1 +1 @@ -__version__ = "1.1.0" +__version__ = "1.2.0" diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index a0ca5d2..77e2783 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -61,6 +61,7 @@ class WebRequest(http.Request): self._got_response_start = False except Exception: logger.error(traceback.format_exc()) + raise def process(self): try: @@ -310,6 +311,7 @@ class HTTPFactory(http.HTTPFactory): self.channel_layer = channel_layer self.action_logger = action_logger self.send_channel = send_channel + assert self.send_channel is not None self.timeout = timeout self.websocket_timeout = websocket_timeout self.websocket_connect_timeout = websocket_connect_timeout diff --git a/daphne/tests/factories.py b/daphne/tests/factories.py index fd9013a..11ad298 100644 --- a/daphne/tests/factories.py +++ b/daphne/tests/factories.py @@ -99,7 +99,7 @@ def _run_through_daphne(request, channel_name): but it works for now. """ channel_layer = ChannelLayer() - factory = HTTPFactory(channel_layer) + factory = HTTPFactory(channel_layer, send_channel="test!") proto = factory.buildProtocol(('127.0.0.1', 0)) transport = proto_helpers.StringTransport() proto.makeConnection(transport) diff --git a/daphne/tests/test_http_request.py b/daphne/tests/test_http_request.py index 4ba7dda..e10553e 100644 --- a/daphne/tests/test_http_request.py +++ b/daphne/tests/test_http_request.py @@ -152,7 +152,7 @@ class TestProxyHandling(unittest.TestCase): def setUp(self): self.channel_layer = ChannelLayer() - self.factory = HTTPFactory(self.channel_layer) + self.factory = HTTPFactory(self.channel_layer, send_channel="test!") self.proto = self.factory.buildProtocol(('127.0.0.1', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) diff --git a/daphne/tests/test_http_response.py b/daphne/tests/test_http_response.py index 0212df6..d1433d2 100644 --- a/daphne/tests/test_http_response.py +++ b/daphne/tests/test_http_response.py @@ -94,7 +94,7 @@ class TestHTTPResponse(TestCase): def setUp(self): self.channel_layer = ChannelLayer() - self.factory = HTTPFactory(self.channel_layer) + self.factory = HTTPFactory(self.channel_layer, send_channel="test!") self.proto = self.factory.buildProtocol(('127.0.0.1', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) diff --git a/daphne/tests/test_ws.py b/daphne/tests/test_ws.py index f289382..6acb529 100644 --- a/daphne/tests/test_ws.py +++ b/daphne/tests/test_ws.py @@ -14,7 +14,7 @@ class TestWebSocketProtocol(TestCase): def setUp(self): self.channel_layer = ChannelLayer() - self.factory = HTTPFactory(self.channel_layer) + self.factory = HTTPFactory(self.channel_layer, send_channel="test!") self.proto = self.factory.buildProtocol(('127.0.0.1', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) @@ -46,7 +46,7 @@ class TestWebSocketProtocol(TestCase): (b'sec-websocket-version', b'13'), (b'upgrade', b'websocket')] ) - self.assertTrue(message['reply_channel'].startswith("websocket.send!")) + self.assertTrue(message['reply_channel'].startswith("test!")) # Accept the connection self.factory.dispatch_reply( @@ -107,7 +107,7 @@ class TestWebSocketProtocol(TestCase): # Get the resulting message off of the channel layer _, message = self.channel_layer.receive(["websocket.connect"]) self.assertIn((b'origin', b'file://'), message['headers']) - self.assertTrue(message['reply_channel'].startswith("websocket.send!")) + self.assertTrue(message['reply_channel'].startswith("test!")) # Accept the connection self.factory.dispatch_reply( @@ -136,7 +136,7 @@ class TestWebSocketProtocol(TestCase): # Get the resulting message off of the channel layer _, message = self.channel_layer.receive(["websocket.connect"]) self.assertNotIn(b'origin', [header_tuple[0] for header_tuple in message['headers']]) - self.assertTrue(message['reply_channel'].startswith("websocket.send!")) + self.assertTrue(message['reply_channel'].startswith("test!")) # Accept the connection self.factory.dispatch_reply( diff --git a/daphne/tests/testcases.py b/daphne/tests/testcases.py index df1750b..f1a372d 100644 --- a/daphne/tests/testcases.py +++ b/daphne/tests/testcases.py @@ -50,7 +50,7 @@ class ASGITestCase(unittest.TestCase): # == Assertions about required channel_message fields == reply_channel = channel_message['reply_channel'] self.assertIsInstance(reply_channel, six.text_type) - self.assertTrue(reply_channel.startswith('http.response!')) + self.assertTrue(reply_channel.startswith('test!')) http_version = channel_message['http_version'] self.assertIsInstance(http_version, six.text_type) diff --git a/setup.py b/setup.py index f2b4095..ec8c0ab 100755 --- a/setup.py +++ b/setup.py @@ -23,9 +23,9 @@ setup( packages=find_packages() + ['twisted.plugins'], include_package_data=True, install_requires=[ - 'asgiref>=1.0.0', + 'asgiref~=1.1', 'twisted>=17.1', - 'autobahn>=0.12', + 'autobahn>=0.18', ], extras_require={ 'tests': ['hypothesis', 'tox']