(self)
| 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 |
no test coverage detected