Stefan Tjarks [Mon, 28 Sep 2015 21:58:15 +0000 (14:58 -0700)]
Perform sanity checks on request.body only if allow_nonstandard_methods is True. This makes CurlAsyncHTTPClient handle allow_nonstandard_methods the same as AsyncHTTPClient.
Ben Darnell [Mon, 28 Sep 2015 00:55:09 +0000 (20:55 -0400)]
Make HTTPError (both of them) copyable.
`Exception.__reduce__` causes copy.copy() to create a new argument
with the arguments from `Exception.__init__`, then overwrite
attributes from the original `__dict__`. This means that copying fails
if there are mandatory arguments that are not passed to `__init__`.
Ben Darnell [Mon, 28 Sep 2015 00:10:49 +0000 (20:10 -0400)]
Remove "IOLoop is closing" error.
Callbacks added while the IOLoop is closing will now simply not be
called (which has always been a possible fate for callbacks added
just *before* the close). This exception has not proved to be very
useful and sometimes has false positives that are tricky to work around,
as seen in the linked issues.
Ben Darnell [Tue, 15 Sep 2015 03:27:18 +0000 (23:27 -0400)]
Replace `gen.Multi` and `gen.multi_future` with `gen.multi`.
`multi_future` is awkward to type but is much more prominent
in native coroutines. The new function `multi` has a more
convenient name and delegates to either the YieldPoint
or Future version automatically.
For backwards compatibility, `multi_future` is still around,
and `Multi` was renamed to `MultiYieldPoint` so that we don't
have two different objects whose names differ only in case
(`Multi` is now an alias for `multi`).
Ben Darnell [Tue, 15 Sep 2015 02:42:41 +0000 (22:42 -0400)]
Import t.p.asyncio automatically when available in gen.
This makes the _wrap_awaitable infinite recursion less likely
to occur, although it could show up again when another coroutine
framework adopts PEP 492.
Ben Darnell [Mon, 14 Sep 2015 03:13:43 +0000 (23:13 -0400)]
Support coroutines compiled with cython
On Python 3.5, this means supporting awaitables that are not
iterables. On older versions of python, this includes
* In `@gen.coroutine`, recognizing cython's coroutines
via the backports_abc module.
* At various points in the gen module, recognize cython's
use of `StopIteration.args[0]` in place of `StopIteration.value`.
* Implementing Future.__await__ and _wrap_awaitable for
pre-3.3 versions of python.
Ben Darnell [Sun, 13 Sep 2015 17:15:06 +0000 (13:15 -0400)]
Make HTTPHeaders a subclass of MutableMapping ABC instead of dict.
This simplifies the implementation since MutableMapping is designed
for subclassing while dict has many special cases that need to be
overridden. In particular, this change fixes the setdefault()
method.
Remove synchronization for add_callback in the ioloop thread
It is not necessary, since it will never need to invoke
wake, and as noted in add_callback_from_signal it would pose
no race risk, and it is a considerable performance penalty.
Codeb Fan [Mon, 24 Aug 2015 07:02:55 +0000 (15:02 +0800)]
Fix incorrect inspection of WebSocket RSV1 bit.
`_frame_compressed` should not be overwrite in continuation frames. According to the Protocol:
https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-13#section-8.2.3.1
"the RSV1 bit is set only on the first frame"
Martin Sucha [Fri, 7 Aug 2015 13:42:48 +0000 (15:42 +0200)]
Fix error handling in read_until_close
When a callback is supplied, the future is not created. Make sure
it is used only if it was initialized, otherwise we lose the
error that was originally raised.
Ali Ebrahim [Thu, 30 Jul 2015 20:57:27 +0000 (13:57 -0700)]
Content-Type for compressed StaticFileHandler file
The python mimetypes module used by StaticFileHandler will recognize
compression (gzip, bz2, etc.) as the file encoding, and will give the
mime type for the uncompressed file. This commit will fix this
behavior, so a gzip file will end up as application/gzip.
Additionally, unknown file types (or known file types compressed with
anything other than gzip) are served as application/octet-stream.