"""
self._max_body_size = max_body_size
- def write_headers(self, start_line, headers, chunk=None, callback=None,
- has_body=True):
+ def write_headers(self, start_line, headers, chunk=None, callback=None):
"""Implements `.HTTPConnection.write_headers`."""
if self.is_client:
self._request_start_line = start_line
# Client requests with a non-empty body must have either a
# Content-Length or a Transfer-Encoding.
self._chunking_output = (
- has_body and
+ start_line.method in ('POST', 'PUT', 'PATCH') and
'Content-Length' not in headers and
'Transfer-Encoding' not in headers)
else:
self._response_start_line = start_line
self._chunking_output = (
- has_body and
# TODO: should this use
# self._request_start_line.version or
# start_line.version?
.. versionadded:: 3.3
"""
- def write_headers(self, start_line, headers, chunk=None, callback=None,
- has_body=True):
+ def write_headers(self, start_line, headers, chunk=None, callback=None):
"""Write an HTTP header block.
:arg start_line: a `.RequestStartLine` or `.ResponseStartLine`.
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 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.
"""
self._sockaddr)
start_line = httputil.RequestStartLine(self.request.method,
req_path, 'HTTP/1.1')
- self.connection.write_headers(
- start_line, self.request.headers,
- has_body=(self.request.body is not None or
- self.request.body_producer is not None))
+ self.connection.write_headers(start_line, self.request.headers)
if self.request.expect_100_continue:
self._read_response()
else:
# so we can simply ignore the callback.
pass
- def write_headers(self, start_line, headers, chunk=None, callback=None,
- has_body=True):
+ def write_headers(self, start_line, headers, chunk=None, callback=None):
if self.method == 'HEAD':
self._expected_content_remaining = 0
elif 'Content-Length' in headers: