Tornado 3.1 新特性¶

Jun 15, 2013¶

Multiple modules¶

  • Many reference cycles have been broken up throughout the package,allowing for more efficient garbage collection on CPython.
  • Silenced some log messages when connections are opened and immediatelyclosed (i.e. port scans), or other situations related to closedconnections.
  • Various small speedups: HTTPHeaders case normalization, UIModuleproxy objects, precompile some regexes.

tornado.auth¶

  • OAuthMixin always sends oauth_version=1.0 in itsrequest as required by the spec.
  • FacebookGraphMixin now uses self._FACEBOOK_BASE_URLin facebook_request to allow the base url to beoverridden.
  • The authenticate_redirect and authorize_redirect methods in thetornado.auth mixin classes all now return Futures. These methodsare asynchronous in OAuthMixin and derived classes, although theydo not take a callback. The Future these methods return must beyielded if they are called from a function decorated with gen.coroutine(but not gen.engine).
  • TwitterMixin now uses /account/verify_credentials to get informationabout the logged-in user, which is more robust against changing screennames.
  • The demos directory (in the source distribution) has a newtwitter demo using TwitterMixin.

tornado.escape¶

tornado.gen¶

  • Fixed a potential memory leak with long chains of tornado.gen coroutines.

tornado.httpclient¶

  • tornado.httpclient.HTTPRequest takes a new argument auth_mode,which can be either basic or digest. Digest authenticationis only supported with tornado.curl_httpclient.
  • tornado.curl_httpclient no longer goes into an infinite loop whenpycurl returns a negative timeout.
  • curl_httpclient now supports the PATCH and OPTIONS methodswithout the use of allow_nonstandard_methods=True.
  • Worked around a class of bugs in libcurl that would result inerrors from IOLoop.update_handler in various scenarios includingdigest authentication and socks proxies.
  • The TCP_NODELAY flag is now set when appropriate in simple_httpclient.
  • simple_httpclient no longer logs exceptions, since those exceptionsare made available to the caller as HTTPResponse.error.

tornado.httpserver¶

  • tornado.httpserver.HTTPServer handles malformed HTTP headers moregracefully.
  • HTTPServer now supports lists of IPs in X-Forwarded-For(it chooses the last, i.e. nearest one).
  • Memory is now reclaimed promptly on CPython when an HTTP requestfails because it exceeded the maximum upload size.
  • The TCP_NODELAY flag is now set when appropriate in HTTPServer.
  • The HTTPServer no_keep_alive option is now respected withHTTP 1.0 connections that explicitly pass Connection: keep-alive.
  • The Connection: keep-alive check for HTTP 1.0 connections is nowcase-insensitive.
  • The str and repr of tornado.httpserver.HTTPRequest no longerinclude the request body, reducing log spam on errors (and potentialexposure/retention of private data).

tornado.httputil¶

  • The cache used in HTTPHeaders will no longer grow without bound.

tornado.ioloop¶

  • Some IOLoop implementations (such as pyzmq) accept objectsother than integer file descriptors; these objects will now havetheir .close() method called when the IOLoop` is closed with
    ``all_fds=True.
  • The stub handles left behind by IOLoop.remove_timeout will now getcleaned up instead of waiting to expire.

tornado.iostream¶

  • Fixed a bug in BaseIOStream.read_until_close that would sometimescause data to be passed to the final callback instead of the streamingcallback.
  • The IOStream close callback is now run more reliably if there isan exception in _try_inline_read.
  • New method BaseIOStream.set_nodelay can be used to set theTCP_NODELAY flag.
  • Fixed a case where errors in SSLIOStream.connect (andSimpleAsyncHTTPClient) were not being reported correctly.

tornado.locale¶

tornado.netutil¶

  • The default Resolver implementation now works on Solaris.
  • Resolver now has a close method.
  • Fixed a potential CPU DoS when tornado.netutil.ssl_match_hostnameis used on certificates with an abusive wildcard pattern.
  • All instances of ThreadedResolver now share a single thread pool,whose size is set by the first one to be created (or the staticResolver.configure method).
  • ExecutorResolver is now documented for public use.
  • bind_sockets now works in configurations with incomplete IPv6 support.

tornado.options¶

tornado.process¶

  • tornado.process.Subprocess no longer leaks file descriptors intothe child process, which fixes a problem in which the child could notdetect that the parent process had closed its stdin pipe.
  • Subprocess.set_exit_callback now works for subprocesses createdwithout an explicit io_loop parameter.

tornado.stack_context¶

tornado.tcpserver¶

tornado.template¶

  • Some internal names used by the template system have been changed;now all “reserved” names in templates start with tt.

tornado.testing¶

tornado.util¶

tornado.web¶

tornado.websocket¶

tornado.wsgi¶

  • Fixed an exception in WSGIContainer when the connection is closedwhile output is being written.

原文:

https://tornado-zh-cn.readthedocs.io/zh_CN/latest/releases/v3.1.0.html