MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

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

Source from the content-addressed store, hash-verified

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