]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make HTTP1Connection and WSGIConnection subclasses of HTTPConnection.
authorBen Darnell <ben@bendarnell.com>
Sun, 27 Apr 2014 04:31:30 +0000 (00:31 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 27 Apr 2014 04:31:30 +0000 (00:31 -0400)
tornado/http1connection.py
tornado/httputil.py
tornado/wsgi.py

index 2e88f36426044b7b2a8c5204d4933c8623b0f89a..fbe65ebf0a2e3706b266c9757b7be127aa4ecbf8 100644 (file)
@@ -54,7 +54,7 @@ class HTTP1ConnectionParameters(object):
         self.body_timeout = body_timeout
         self.use_gzip = use_gzip
 
-class HTTP1Connection(object):
+class HTTP1Connection(httputil.HTTPConnection):
     """Implements the HTTP/1.x protocol.
 
     This class can be on its own for clients, or via `HTTP1ServerConnection`
index 5e29906ccca5eee29b4eb7c968a51452793fb139..23ef84b3eadcf436d2b25be4ba43f50a0f68cf9f 100644 (file)
@@ -542,8 +542,9 @@ class HTTPConnection(object):
             so that small responses can be written in the same call as their
             headers.
         :arg callback: a callback to be run when the write is complete.
-        :arg has_body: as an optimization, may be ``False`` to indicate
-            that no further writes will be coming.
+        :arg bool has_body: may be false to indicate that this message
+            has no body (and so does not need either a Content-Length
+            or Transfer-Encoding)
 
         Returns a `.Future` if no callback is given.
         """
index ad2d885ef6db7c3876a9770957e910bf25b3babd..e5bc9f96be6d1fbbee2ead9822f36ba08a10f086 100644 (file)
@@ -84,7 +84,7 @@ class WSGIApplication(web.Application):
         return WSGIAdapter(self)(environ, start_response)
 
 
-class _WSGIConnection(object):
+class _WSGIConnection(httputil.HTTPConnection):
     def __init__(self, method, start_response, context):
         self.method = method
         self.start_response = start_response
@@ -99,7 +99,8 @@ class _WSGIConnection(object):
         # so we can simply ignore the callback.
         pass
 
-    def write_headers(self, start_line, headers, chunk=None, callback=None):
+    def write_headers(self, start_line, headers, chunk=None, callback=None,
+                      has_body=True):
         if self.method == 'HEAD':
             self._expected_content_remaining = 0
         elif 'Content-Length' in headers: