MCPcopy
hub / github.com/urllib3/urllib3 / drain_conn

Method drain_conn

src/urllib3/response.py:794–808  ·  view source on GitHub ↗

Read and discard any remaining HTTP response data in the response connection. Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.

(self)

Source from the content-addressed store, hash-verified

792 self._connection = None
793
794 def drain_conn(self) -> None:
795 """
796 Read and discard any remaining HTTP response data in the response connection.
797
798 Unread data in the HTTPResponse connection blocks the connection from being released back to the pool.
799 """
800 try:
801 self._raw_read()
802 except (HTTPError, OSError, BaseSSLError, HTTPException):
803 pass
804 if self._has_decoded_content:
805 # `_raw_read` skips decompression, so we should clean up the
806 # decoder to avoid keeping unnecessary data in memory.
807 self._decoded_buffer = BytesQueueBuffer()
808 self._decoder = None
809
810 @property
811 def data(self) -> bytes:

Calls 2

_raw_readMethod · 0.95
BytesQueueBufferClass · 0.85