MCPcopy Create free account
hub / github.com/EasyIME/PIME / __init__

Method __init__

python/python3/tornado/http1connection.py:111–166  ·  view source on GitHub ↗

: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,
        stream: iostream.IOStream,
        is_client: bool,
        params: Optional[HTTP1ConnectionParameters] = None,
        context: Optional[object] = None,
    )

Source from the content-addressed store, hash-verified

109 """
110
111 def __init__(
112 self,
113 stream: iostream.IOStream,
114 is_client: bool,
115 params: Optional[HTTP1ConnectionParameters] = None,
116 context: Optional[object] = None,
117 ) -> None:
118 """
119 :arg stream: an `.IOStream`
120 :arg bool is_client: client or server
121 :arg params: a `.HTTP1ConnectionParameters` instance or ``None``
122 :arg context: an opaque application-defined object that can be accessed
123 as ``connection.context``.
124 """
125 self.is_client = is_client
126 self.stream = stream
127 if params is None:
128 params = HTTP1ConnectionParameters()
129 self.params = params
130 self.context = context
131 self.no_keep_alive = params.no_keep_alive
132 # The body limits can be altered by the delegate, so save them
133 # here instead of just referencing self.params later.
134 self._max_body_size = (
135 self.params.max_body_size
136 if self.params.max_body_size is not None
137 else self.stream.max_buffer_size
138 )
139 self._body_timeout = self.params.body_timeout
140 # _write_finished is set to True when finish() has been called,
141 # i.e. there will be no more data sent. Data may still be in the
142 # stream's write buffer.
143 self._write_finished = False
144 # True when we have read the entire incoming body.
145 self._read_finished = False
146 # _finish_future resolves when all data has been written and flushed
147 # to the IOStream.
148 self._finish_future = Future() # type: Future[None]
149 # If true, the connection should be closed after this request
150 # (after the response has been written in the server side,
151 # and after it has been read in the client)
152 self._disconnect_on_finish = False
153 self._clear_callbacks()
154 # Save the start lines after we read or write them; they
155 # affect later processing (e.g. 304 responses and HEAD methods
156 # have content-length but no bodies)
157 self._request_start_line = None # type: Optional[httputil.RequestStartLine]
158 self._response_start_line = None # type: Optional[httputil.ResponseStartLine]
159 self._request_headers = None # type: Optional[httputil.HTTPHeaders]
160 # True if we are writing output with chunked encoding.
161 self._chunking_output = False
162 # While reading a body with a content-length, this is the
163 # amount left to read.
164 self._expected_content_remaining = None # type: Optional[int]
165 # A Future for our outgoing writes, returned by IOStream.write.
166 self._pending_write = None # type: Optional[Future[None]]
167
168 def read_response(self, delegate: httputil.HTTPMessageDelegate) -> Awaitable[bool]:

Callers

nothing calls this directly

Calls 2

_clear_callbacksMethod · 0.95

Tested by

no test coverage detected