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: :arg stream: an `.IOStream`
  :arg bool is_client: client or server
  :arg params: a `.HTTP1ConnectionParameters` instance or ``None``
  :arg context: an opaque application-defined object that can be accessed
      as ``connection.context``.
code: def __init__(
      self,
      stream: iostream.IOStream,
      is_client: bool,
      params: Optional[HTTP1ConnectionParameters] = None,
      context: Optional[object] = None,
  ) -> None:
      """
      :arg stream: an `.IOStream`
      :arg bool is_client: client or server
      :arg params: a `.HTTP1ConnectionParameters` instance or ``None``
      :arg context: an opaque application-defined object that can be accessed
          as ``connection.context``.
      """
      self.is_client = is_client
      self.stream = stream
      if params is None:
          params = HTTP1ConnectionParameters()
      self.params = params
      self.context = context
      self.no_keep_alive = params.no_keep_alive
      # The body limits can be altered by the delegate, so save them
      # here instead of just referencing self.params later.
      self._max_body_size = (
          self.params.max_body_size
          if self.params.max_body_size is not None
          else self.stream.max_buffer_size
      )
      self._body_timeout = self.params.body_timeout
      # _write_finished is set to True when finish() has been called,
      # i.e. there will be no more data sent.  Data may still be in the
      # stream's write buffer.
      self._write_finished = False
      # True when we have read the entire incoming body.
      self._read_finished = False
      # _finish_future resolves when all data has been written and flushed
      # to the IOStream.
      self._finish_future = Future()  # type: Future[None]
      # If true, the connection should be closed after this request
      # (after the response has been written in the server side,
      # and after it has been read in the client)
      self._disconnect_on_finish = False
      self._clear_callbacks()
      # Save the start lines after we read or write them; they
      # affect later processing (e.g. 304 responses and HEAD methods
      # have content-length but no bodies)
      self._request_start_line = (
          None
      )  # type: Optional[httputil.RequestStartLine]
      self._response_start_line = (
          None
      )  # type: Optional[httputil.ResponseStartLine]
      self._request_headers = (
          None
      )  # type: Optional[httputil.HTTPHeaders]
      # True if we are writing output with chunked encoding.
      self._chunking_output = False
      # While reading a body with a content-length, this is the
      # amount left to read.
      self._expected_content_remaining = None  # type: Optional[int]
      # A Future for our outgoing writes, returned by IOStream.write.
      self._pending_write = None
  
imports: import asyncio
  import logging
  import re
  import types
  from tornado.concurrent import Future, future_add_done_callback, future_set_result_unless_cancelled
  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.util import GzipDecompressor
  from typing import cast, Optional, Type, Awaitable, Callable, Union, Tuple
label_desc: Use image node_id 1 to create a new HTTP1Connection object from inherited base classes: httputil with example: obj = HTTP1Connection(stream, is_client, params, context)