diff --git a/daphne/cli.py b/daphne/cli.py index 7361914..d9d9fb4 100755 --- a/daphne/cli.py +++ b/daphne/cli.py @@ -86,7 +86,7 @@ class CommandLineInterface(object): "--http-timeout", type=int, help="How long to wait for worker before timing out HTTP connections", - default=120, + default=None, ) self.parser.add_argument( "--access-log", diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index 060aab5..2c946e1 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -256,8 +256,12 @@ class WebRequest(http.Request): Called periodically to see if we should timeout something """ # Web timeout checking - if self.duration() > self.server.http_timeout: - self.basic_error(503, b"Service Unavailable", "Application failed to respond within time limit.") + if self.server.http_timeout and self.duration() > self.server.http_timeout: + if self._response_started: + logger.warning("Application timed out while sending response") + self.finish() + else: + self.basic_error(503, b"Service Unavailable", "Application failed to respond within time limit.") ### Utility functions diff --git a/daphne/server.py b/daphne/server.py index c9ab4a3..6a65ebb 100755 --- a/daphne/server.py +++ b/daphne/server.py @@ -42,7 +42,7 @@ class Server(object): endpoints=None, signal_handlers=True, action_logger=None, - http_timeout=120, + http_timeout=None, websocket_timeout=86400, websocket_connect_timeout=20, ping_interval=20,