-
Refactor TCPServer and HTTPServer to support TLS NPN
alekstorm committedJun 8, 2012 * TLS NPN means that one of many protocols can be selected after a TCP connection is established. A layer of indirection was added to TCPServer to allow it to delegate handling of a TCP connection to whichever protocol handler was negotiated. If the `npn_protocols` parameter (a list of (name, handler) tuples in order of preference) was passed to the constructor, the connection is over TLS, and NPN succeeded, the handler for the chosen name will be called. Otherwise, the `protocol` constructor parameter will be called. For example, SPDYServer is essentially: class SPDYServer(TCPServer): def __init__(self, request_callback): http_protocol = HTTPServerProtocol(request_callback) TCPServer.__init__(self, http_protocol, npn_protocols=[ ('spdy/2', SPDYServerProtocol(request_callback)), ('http/1.1', http_protocol)]) * TCPServer was moved from netutil to its own module, tcpserver. * Since utilizing NPN support in Python 3.3 requires the `ssl.SSLContext` class, which isn't available in Python 2.x, the wrap_socket() top-level function was added to `netutil` to abstract away these details. In addition, the `SUPPORTS_NPN` constant was added as a convenience for determining if the system supported NPN. * Previously, `web.RequestHandler` formatted the HTTP response itself and wrote it directly to the IOStream. This responsibility has been moved to the HTTPRequest.connection object, which must provide the write_preamble() and write() methods - the former writes the response status line and headers, while the latter writes a chunk of the response body. * Although IOStream.connect() already takes a callback parameter, in SSLIOStream it's not called until the SSL handshake is completed (which contains TLS NPN) - and TCPServer, which doesn't call connect(), won't know which protocol handler to execute until that happens. To fix this, a set_connect_callback method was added to IOStream. * Snippets that conditionally imported BytesIO and ssl were moved into util and netutil, respectively. These symbols are now imported from there.
-
Merge pull request #521 from yoinc/master
bdarnell committedMay 31, 2012 Restore context for all read methods
-
Restore context for all read methods.
eden committedMay 31, 2012 Prior to 2db0ace this was being done properly, but the refactor removed stack_context.wrap causing some issues in our upstream context managers.
-
bdarnell committed
May 28, 2012 -
Quick hack to make this test pass on cygwin
bdarnell committedMay 28, 2012 -
Fix zope.interface/py25 dependencies for other tox.ini files
bdarnell committedMay 28, 2012 -
bdarnell committed
May 28, 2012 -
bdarnell committed
May 28, 2012 -
bdarnell committed
May 28, 2012 -
Add future import to this new file for consistency
bdarnell committedMay 28, 2012 -
Another round of minor whitespace cleanups from autopep8
bdarnell committedMay 28, 2012 -
Remove use of string exceptions in gen_test.
bdarnell committedMay 28, 2012 These lines are not reached, but if they were they would fail with a less clear message than intended. Closes #520.
-
Connection errors can happen here too.
bdarnell committedMay 27, 2012 -
IOStreams now save the exception object that caused them to close.
bdarnell committedMay 27, 2012 Closes #494.
-
Delay check for socket.family (and make it jython-friendly).
bdarnell committedMay 26, 2012 Now HTTPConnection.address will always be the socket address, and the fake "0.0.0.0" IP is only used in contexts that want an IP (i.e. HTTPRequest.remote_ip) but the connection is a non-IP socket.
-
Merge pull request #514 from ahassany/fix-connectin-check
bdarnell committedMay 26, 2012 Better connection check in RequestHandler
-
Extract constant, add comments
bdarnell committedMay 26, 2012 -
Merge remote-tracking branch 'ei-grad/master'
bdarnell committedMay 26, 2012 -
Override dict.copy in HTTPHeaders to return the correct type.
bdarnell committedMay 26, 2012 Closes #519.
-
Better connection check in RequestHandler
ahassany committedMay 24, 2012
-
Prevent leak of StackContexts in repeated gen.engine functions.
bdarnell committedMay 21, 2012 Internally, StackContexts now return a deactivation callback, which can be used to prevent that StackContext from propagating further. This is used in gen.engine because the decorator doesn't know which arguments are callbacks that need to be wrapped outside of its ExceptionStackContext. This is deliberately undocumented for now. Closes #507.
-
bdarnell committed
May 21, 2012
-
bdarnell committed
May 20, 2012 -
Merge remote-tracking branch 'jjwchoy/master'
bdarnell committedMay 20, 2012 Modified linkify to accept a callable for extra_params. Closes #506.
-
304 responses no longer include entity headers like Content-Length
bdarnell committedMay 20, 2012 This is required by the RFC as it may confuse caches.
-
Add status_code to the OutputTransform.transform_first_chunk interface.
bdarnell committedMay 20, 2012 This is needed for correct support of the 304 status code, which has no body and should not have either a Content-Length or Transfer-Encoding. This is a backwards-incompatible change to an interface that was never technically private, but not included in the documentation and as far as I can tell was never used outside tornado itself.
-
Fight bitrot in tornado.platform.twisted.
bdarnell committedMay 19, 2012 A new release of zope.interface breaks things on python 2.5, and sets off our (overly-sensitive?) deprecation checking.
-
Ignore .class files (create by jython)
bdarnell committedMay 12, 2012 -
Move tornado.platform.windows.Waker to new module platform.common.
bdarnell committedMay 12, 2012 Cleaned up the few windows-specific bits of code. The socket-based Waker is also usable on Jython.
-
Replace all occurrences of 3-argument raise statements with the
bdarnell committedMay 11, 2012 version from testing.py, which works better with 2to3. Closes #508
-
Fix path parsing in HTTPServer.
bdarnell committedMay 10, 2012 urlparse.urlsplit expects a full url, but we were using it for a bare path. This mostly worked but would parse paths beginning with "//" incorrectly. Fortunately all we really need to do is split the path on "?". Closes #509.