Ben Darnell [Tue, 1 Jul 2014 03:28:10 +0000 (23:28 -0400)]
Rename the new-in-4.0 gzip parameter to HTTPServer.
All the gzip-related parameters are now explicit about whether
they compress or decompress and whether they apply to requests or
responses. For all the parameters that existed prior to 4.0
the old names are accepted as well, but for the new ones in 4.0
we don't need to worry about backwards-compatibility.
This is motivated by the potential confusion around the use of
gzip as a parameter to the Application constructor to indicate
compression of responses and to the HTTPServer constructor to
indicate decompression of requests.
Ben Darnell [Sat, 21 Jun 2014 17:50:56 +0000 (13:50 -0400)]
Drop support for the draft76 version of WebSockets.
Browsers that only support draft76 are now less common than those
that do not support websockets at all, so applications should
use their non-websocket workarounds for these browsers.
Ben Darnell [Thu, 19 Jun 2014 13:28:45 +0000 (09:28 -0400)]
Add new exception tornado.web.Finish to quietly end a request.
This allows error pages to be generated inline with the main code
instead of in write_error and is friendlier to generating error pages
from library code.
Ben Darnell [Wed, 18 Jun 2014 14:29:28 +0000 (10:29 -0400)]
Introduce IOLoop.call_later and call_at.
call_later is a less-verbose alternative to add_timeout with a
timedelta; call_at exists for symmetry. Both are named after
methods on the asyncio event loop, although there are small
variations (we support both args and kwargs while asyncio only supports
args; we use remove_timeout(handle) instead of handle.cancel()).
Ben Darnell [Mon, 16 Jun 2014 03:35:02 +0000 (23:35 -0400)]
Relax restrictions on HTTP methods in WebSocketHandler.
Methods like set_status are now disallowed once the websocket handshake
has begun, but may be used before then. This applies to application
overrides of prepare() and to WebSocketHandler.get's internal error
handling.
drewbrew [Tue, 3 Jun 2014 18:22:08 +0000 (13:22 -0500)]
ioloop.py: use itertools.count() as tiebreaker to preserve FIFO in case of tie
Current implementation does not function as a FIFO. When adding multiple
timeouts with the same deadline, order is currently consistently mangled in the
event of a garbage collect.
As suggested by Ben Darnell at
https://groups.google.com/forum/#!topic/python-tornado/w8aKm6ZabUQ/discussion,
we need to add a sequence number to the Timeout class to serve as tiebreaker.
This code uses the model suggested by
https://docs.python.org/2/library/heapq.html#priority-queue-implementation-notes,
which uses itertools.count() to serve as our counter.
Ben Darnell [Sun, 25 May 2014 16:50:51 +0000 (12:50 -0400)]
Stream large response bodies from StaticFileHandler.
The get_content interface is still synchronous so it's not a complete
solution, but this will keep the server from buffering the whole file in
memory while writing it out to the client.
Return Futures from the wsgi interface, allowing @gen.coroutine to be
used there in limited circumstances.
Ben Darnell [Sun, 25 May 2014 15:39:12 +0000 (11:39 -0400)]
Remove HTTP method check from HTTPServerRequest._parse_body.
The semantics of a body are not well-defined for some methods,
but if a client sends a body with the correct content-type,
we might as well parse it no matter what the method.
Ben Darnell [Mon, 19 May 2014 03:19:41 +0000 (23:19 -0400)]
Make gen.Task a function returning a Future instead of a YieldPoint subclass.
This improves performance of applications that mix Tasks and Futures
by only entering a stack context for the duration of the Tasks. It
also fixes an obscure regression (#1058). This might get reverted before
the final release if any backwards-compatibility issues turn up, but
since the status quo also had a regression it's worth a try.
Ben Darnell [Mon, 19 May 2014 01:57:27 +0000 (21:57 -0400)]
Remove test_websocket_network_timeout.
It wasn't testing what it appeared to be (it was hitting exactly the
same code paths as test_websocket_network_fail on posix, but was failing
on windows).
Ben Darnell [Mon, 19 May 2014 00:20:29 +0000 (20:20 -0400)]
Raise StreamClosedError instead of IOError for ECONNRESET.
This allows application code to only catch one kind of exception
(an ECONNRESET exception is raised from
tornado.test.httpserver_test.KeepAliveTest.test_pipeline_cancel
on linux but not on mac)