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

Method _read_status

Lib/http/client.py:296–327  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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")
298 if len(line) > _MAXLINE:
299 raise LineTooLong("status line")
300 if self.debuglevel > 0:
301 print("reply:", repr(line))
302 if not line:
303 # Presumably, the server closed the connection before
304 # sending a valid response.
305 raise RemoteDisconnected("Remote end closed connection without"
306 " response")
307 try:
308 version, status, reason = line.split(None, 2)
309 except ValueError:
310 try:
311 version, status = line.split(None, 1)
312 reason = ""
313 except ValueError:
314 # empty version will cause next test to fail.
315 version = ""
316 if not version.startswith("HTTP/"):
317 self._close_conn()
318 raise BadStatusLine(line)
319
320 # The status code is a three-digit number
321 try:
322 status = int(status)
323 if status < 100 or status > 999:
324 raise BadStatusLine(line)
325 except ValueError:
326 raise BadStatusLine(line)
327 return version, status, reason
328
329 def begin(self):
330 if self.headers is not None:

Callers 2

beginMethod · 0.95
_tunnelMethod · 0.80

Calls 11

_close_connMethod · 0.95
strFunction · 0.85
lenFunction · 0.85
LineTooLongClass · 0.85
reprFunction · 0.85
RemoteDisconnectedClass · 0.85
BadStatusLineClass · 0.85
printFunction · 0.50
readlineMethod · 0.45
splitMethod · 0.45
startswithMethod · 0.45

Tested by

no test coverage detected