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.
Ben Darnell [Fri, 17 Jul 2015 15:36:53 +0000 (11:36 -0400)]
Fix path traversal check in StaticFileHandler.
Previously StaticFileHandler would allow access to files whose name
starts with the static root directory, not just those that are actually
in the directory.
The bug was introduced in Tornado 3.1 via commits 7b03cd62fb and 60952528.
Ben Darnell [Sun, 5 Jul 2015 21:13:07 +0000 (17:13 -0400)]
Introduce `oneline` template whitespace mode.
This slightly-more-aggressive whitespace removal doesn't actually
save any space, but it removes the very conspicuous blank lines
that are often left around template directives.
Ben Darnell [Sun, 5 Jul 2015 02:40:23 +0000 (22:40 -0400)]
Reduce logging of errors inside IOStream (especially SSLError).
Coroutine-style usage converts most errors into StreamClosedErrors,
which are logged less noisily while still allowing the original error
to be seen via the new real_error attribute. SSL errors now typically
result in a single log line instead of a full stack trace.
Ben Darnell [Sun, 21 Jun 2015 17:57:28 +0000 (13:57 -0400)]
Clear __package__ in script run by autoreload CLI.
This prevents imports from incorrectly being interpreted as
relative to the 'tornado package, which would make the standard
'platform' module unimportable.
Greg Ward [Sun, 21 Jun 2015 14:29:45 +0000 (10:29 -0400)]
Tie the example for AsyncHTTPTestCase to real code.
Now all the reader has to do is copy one of the "Hello, world"
examples to hello.py, copy the test example to test_hello.py, import
AsyncHTTPTestCase, and run the test. It's still not entirely seamless
and idiot-proof, but it's progress!
Of note: the example test can now actually assert things about the
response it receives.
Greg Ward [Sun, 21 Jun 2015 14:04:21 +0000 (10:04 -0400)]
Consistently format the three "Hello, world" examples (docs and README)
- encourage use of make_app() (makes testing easier)
- use fully-qualified module paths (painful in real-world code,
but makes examples clearer)
- don't define a main() function that is never called: just
use a boring old "__name__ == __main__" block, so the code
can be copy + pasted + executed immediately
- just use a tuple when defining routes, not url(...): this is
supposed to be a simple, minimalist example
Ben Darnell [Wed, 20 May 2015 01:46:21 +0000 (21:46 -0400)]
Disable twisted's test_process on python 3.
The new twisted 15.2.0 has some failures in this test that appear to be
interactions between the two package's test suites rather than a problem
in the integration itself, so just disable the tests for now.
Alex Brandt [Sun, 3 May 2015 14:45:20 +0000 (09:45 -0500)]
add docs recursively to MANIFEST.in
When packaging tornado for Gentoo I found the documentation was not
available in the sdist provided on pypi. This adds the documentation so
that users can choose to install it locally.
Ben Darnell [Wed, 6 May 2015 05:16:30 +0000 (22:16 -0700)]
Remove weak reference from WaitIterator.
This reference is the only thing holding the asynchronous "stack"
together in some cases, so making it weak could allow coroutines
to be garbage collected while running. This was mainly a problem
on Python 3.4, which is much better at garbage collecting generators
than older versions.
While the existing code handles references like   properly,
it doesn't handle the valid case where the number is specified
in hex. For example 'foo bar', 'foo bar' and 'foo bar'
should all decode to 'foo bar'. The changes in escape.py check
for the 'x' and decode appropriately. Also added unit tests for
unescaping strings with numeric references.