Ben Darnell [Sun, 31 Aug 2014 02:52:54 +0000 (22:52 -0400)]
Limit the number of connections we will accept per call to accept_handler.
This ensures that other callbacks scheduled on the IOLoop have a chance
to run. This shows up as increased memory usage in benchmark scenarios
(since 4.0 allowed simple http transactions to be processed synchronously).
Ben Darnell [Sat, 23 Aug 2014 22:12:19 +0000 (18:12 -0400)]
Fix a regression in gzip output for StaticFileHandler.
Streaming static responses confused the gzip output transform since
it could no longer set the correct outgoing content-length. Now
it will fall back to chunked encoding in this case.
Niko Wilbert [Fri, 22 Aug 2014 08:48:42 +0000 (10:48 +0200)]
Fixed support for test generators
This fixes the problem that AsyncTestCase no longer seemed to work with test generators (as supported by Nose, http://nose.readthedocs.org/en/latest/writing_tests.html#test-generators).
Ben Darnell [Sun, 10 Aug 2014 18:02:39 +0000 (14:02 -0400)]
Correctly handle 204 response codes that do not include a content-length.
If a server sends a 204 with no content-length we would wait for the server
to close the connection instead of ending the request (any such servers
are ignoring the "Connection: close" header we send, but apparently exist).
Move some content-length logic from simple_httpclient.py to http1connection.py.
Fix the client-side use of on_connection_close; this affects the
handling of any HTTPInputException.
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.