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

Method _get_chunk_left

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

Source from the content-addressed store, hash-verified

573 break
574
575 def _get_chunk_left(self):
576 # return self.chunk_left, reading a new chunk if necessary.
577 # chunk_left == 0: at the end of the current chunk, need to close it
578 # chunk_left == None: No current chunk, should read next.
579 # This function returns non-zero or None if the last chunk has
580 # been read.
581 chunk_left = self.chunk_left
582 if not chunk_left: # Can be 0 or None
583 if chunk_left is not None:
584 # We are at the end of chunk, discard chunk end
585 self._safe_read(2) # toss the CRLF at the end of the chunk
586 try:
587 chunk_left = self._read_next_chunk_size()
588 except ValueError:
589 raise IncompleteRead(b'')
590 if chunk_left == 0:
591 # last chunk: 1*("0") [ chunk-extension ] CRLF
592 self._read_and_discard_trailer()
593 # we read everything; close the "file"
594 self._close_conn()
595 chunk_left = None
596 self.chunk_left = chunk_left
597 return chunk_left
598
599 def _read_chunked(self, amt=None):
600 assert self.chunked != _UNKNOWN

Callers 4

_read_chunkedMethod · 0.95
_readinto_chunkedMethod · 0.95
_read1_chunkedMethod · 0.95
_peek_chunkedMethod · 0.95

Calls 5

_safe_readMethod · 0.95
_read_next_chunk_sizeMethod · 0.95
_close_connMethod · 0.95
IncompleteReadClass · 0.85

Tested by

no test coverage detected