class_docstr: Implements the HTTP/1.x protocol.
  
  This class can be on its own for clients, or via `HTTP1ServerConnection`
  for servers.
class_docstr_tok: ["Implements","the","HTTP\/1.x","protocol",".","This","class","can","be","on","its","own","for","clients",",","or","via","`","HTTP1ServerConnection","`","for","servers","."]
docstr: Implements `.HTTPConnection.finish`.
docstr_tok: ["Implements","`",".HTTPConnection.finish","`","."]
code: def finish(self):
      """Implements `.HTTPConnection.finish`."""
      if (
          self._expected_content_remaining is not None
          and self._expected_content_remaining != 0
          and not self.stream.closed()
      ):
          self.stream.close()
          raise httputil.HTTPOutputError(
              "Tried to write %d bytes less than Content-Length"
              % self._expected_content_remaining
          )
      if self._chunking_output:
          if not self.stream.closed():
              self._pending_write = self.stream.write(b"0\r\n\r\n")
              self._pending_write.add_done_callback(
                  self._on_write_complete
              )
      self._write_finished = True
      # If the app finished the request while we're still reading,
      # divert any remaining data away from the delegate and
      # close the connection when we're done sending our response.
      # Closing the connection is the only way to avoid reading the
      # whole input body.
      if not self._read_finished:
          self._disconnect_on_finish = True
      # No more data is coming, so instruct TCP to send any remaining
      # data immediately instead of waiting for a full packet or ack.
      self.stream.set_nodelay(True)
      if self._pending_write is None:
          self._finish_request(None)
      else:
          self._pending_write.add_done_callback(self._finish_request)
  
imports: from __future__ import absolute_import, division, print_function
  import re
  from tornado.concurrent import Future
  from tornado.escape import native_str, utf8
  from tornado import gen
  from tornado import httputil
  from tornado import iostream
  from tornado.log import gen_log, app_log
  from tornado import stack_context
  from tornado.util import GzipDecompressor, PY3
label_desc: Use image node_id 14 for calling the HTTP1Connection obj's underlying member method code with example usage: obj.finish() without return types