Skip to content

Commit

Permalink
Make HTTP1Connection and WSGIConnection subclasses of HTTPConnection.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed Apr 27, 2014
1 parent b4dc5ae commit 42a00ef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tornado/http1connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, no_keep_alive=False, chunk_size=None,
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`
Expand Down
5 changes: 3 additions & 2 deletions tornado/httputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,9 @@ def write_headers(self, start_line, headers, chunk=None, callback=None,
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.
"""
Expand Down
5 changes: 3 additions & 2 deletions tornado/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __call__(self, environ, start_response):
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
Expand All @@ -99,7 +99,8 @@ def set_close_callback(self, callback):
# 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:
Expand Down

0 comments on commit 42a00ef

Please sign in to comment.