MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/http/client.py:266–294  ·  view source on GitHub ↗
(self, sock, debuglevel=0, method=None, url=None)

Source from the content-addressed store, hash-verified

264 # accepts iso-8859-1.
265
266 def __init__(self, sock, debuglevel=0, method=None, url=None):
267 # If the response includes a content-length header, we need to
268 # make sure that the client doesn't read more than the
269 # specified number of bytes. If it does, it will block until
270 # the server times out and closes the connection. This will
271 # happen if a self.fp.read() is done (without a size) whether
272 # self.fp is buffered or not. So, no self.fp.read() by
273 # clients unless they know what they are doing.
274 self.fp = sock.makefile("rb")
275 self.debuglevel = debuglevel
276 self._method = method
277
278 # The HTTPResponse object is returned via urllib. The clients
279 # of http and urllib expect different attributes for the
280 # headers. headers is used here and supports urllib. msg is
281 # provided as a backwards compatibility layer for http
282 # clients.
283
284 self.headers = self.msg = None
285
286 # from the Status-Line of the response
287 self.version = _UNKNOWN # HTTP-Version
288 self.status = _UNKNOWN # Status-Code
289 self.reason = _UNKNOWN # Reason-Phrase
290
291 self.chunked = _UNKNOWN # is "chunked" being used?
292 self.chunk_left = _UNKNOWN # bytes left to read in current chunk
293 self.length = _UNKNOWN # number of bytes left in response
294 self.will_close = _UNKNOWN # conn will close at end of response
295
296 def _read_status(self):
297 line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")

Callers

nothing calls this directly

Calls 1

makefileMethod · 0.45

Tested by

no test coverage detected