Tornado 2.3 新特性¶

    • tornado.httpclient.HTTPClient now supports the same constructorkeyword arguments as .
    • The max_clients keyword argument to AsyncHTTPClient.configure now works.
    • tornado.simple_httpclient now supports the OPTIONS and PATCHHTTP methods.
    • tornado.simple_httpclient is better about closing its socketsinstead of leaving them for garbage collection.
    • tornado.simple_httpclient correctly verifies SSL certificates forURLs containing IPv6 literals (This bug affected Python 2.5 and 2.6).
    • tornado.simple_httpclient no longer includes basic auth credentialsin the Host header when those credentials are extracted from the URL.
    • tornado.curl_httpclient now supports client SSL certificates (usingthe same client_cert and client_key arguments astornado.simple_httpclient)

    HTTP Server¶

    • HTTPServer now works correctly with paths starting with //
    • HTTPHeaders.copy (inherited from ) now works correctly.
    • HTTPConnection.address is now always the socket address, even for non-IPsockets. HTTPRequest.remote_ip is still always an IP-style address(fake data is used for non-IP sockets)
    • Extra data at the end of multipart form bodies is now ignored, which fixesa compatibility problem with an iOS HTTP client library.
    • IOStream now has an error attribute that can be used to determinewhy a socket was closed.
    • tornado.iostream.IOStream.read_until and read_until_regex are muchfaster with large input.
    • IOStream.write performs better when given very large strings.
    • is now thread-safe.

    tornado.options¶

    • options with multiple=True that are set more thanonce now overwrite rather than append. This makes it possible to overridevalues set in parse_config_file with parse_command_line.
    • tornado.options —help output is now prettier.
    • now supports attribute assignment.
    • Template files containing non-ASCII (utf8) characters now work on Python 3regardless of the locale environment variables.
    • Templates now support else clauses intry/except/finally/else blocks.

    tornado.web¶

    • and removeslash decorators now send permanentredirects (301) instead of temporary (302).
    • RequestHandler.flush now invokes its callback whether there was any datato flush or not.
    • Repeated calls to with the same name nowoverwrite the previous cookie instead of producing additional copies.
    • tornado.web.OutputTransform.transform_first_chunk now takes and returnsa status code in addition to the headers and chunk. This is abackwards-incompatible change to an interface that was never technicallyprivate, but was not included in the documentation and does not appearto have been used outside Tornado itself.
    • Fixed a bug on python versions before 2.6.5 when URLSpec regexesare constructed from unicode strings and keyword arguments are extracted.
    • The reverse_url function in the template namespace now comes fromthe rather than the Application. (Unless overridden, is just an alias for the Applicationmethod).
    • The Etag header is now returned on 304 responses to an If-None-Matchrequest, improving compatibility with some caches.
    • will no longer produce responses with status code 304that also have entity headers such as Content-Length.
    • tornado.auth.FacebookGraphMixin no longer sends post_args redundantlyin the url.
    • The extra_params argument to may now bea callable, to allow parameters to be chosen separately for each link.
    • tornado.gen no longer leaks StackContexts when a .engine wrappedfunction is called repeatedly.
    • tornado.locale.get_supported_locales no longer takes a meaninglesscls argument.
    • instances now have a deactivation callback that can beused to prevent further propagation.
    • tornado.testing.AsyncTestCase.wait now resets its timeout on each call.
    • Exception handling on Python 3 has been improved; previously some exceptionssuch as would generate TypeErrors