Backends¶
- class urllib3.backend.BaseBackend(host, port=None, timeout=-1, source_address=None, blocksize=131072, *, socket_options=[(6, 1, 1, 'tcp')], disabled_svn=None, preemptive_quic_cache=None)¶
Bases:
objectThe goal here is to detach ourselves from the http.client package. At first, we’ll strictly follow the methods in http.client.HTTPConnection. So that we would be able to implement other backend without disrupting the actual code base. Extend that base class in order to ship another backend with urllib3.
- Parameters:
- close()¶
End the connection, do some reinit, closing of fd, etc…
- Return type:
None
- default_socket_options: ClassVar[_TYPE_SOCKET_OPTIONS] = [(6, 1, 1, 'tcp')]¶
Disable Nagle’s algorithm by default.
- endheaders(message_body=None, *, encode_chunked=False, expect_body_afterward=False)¶
This method conclude the request context construction.
- Parameters:
- Return type:
ResponsePromise | None
- getresponse(*, promise=None)¶
Fetch the HTTP response. You SHOULD not retrieve the body in that method, it SHOULD be done in the LowLevelResponse, so it enable stream capabilities and remain efficient.
- Parameters:
promise (ResponsePromise | None)
- Return type:
LowLevelResponse
- putheader(header, *values)¶
For a single header name, assign one or multiple value. This method is called right after putrequest() for each entries.
- putrequest(method, url, skip_host=False, skip_accept_encoding=False)¶
It is the first method called, setting up the request initial context.
- response_class¶
alias of
LowLevelResponse
- send(data, *, eot=False)¶
The send() method SHOULD be invoked after calling endheaders() if and only if the request context specify explicitly that a body is going to be sent.
- set_tunnel(host, port=None, headers=None, scheme='http')¶
Prepare the connection to set up a tunnel. Does NOT actually do the socket and http connect. Here host:port represent the target (final) server and not the intermediary.
- class urllib3.backend.hface.HfaceBackend(host, port=None, timeout=-1, source_address=None, blocksize=131072, *, socket_options=[(6, 1, 1, 'tcp')], disabled_svn=None, preemptive_quic_cache=None)¶
Bases:
BaseBackend- Parameters:
- close()¶
End the connection, do some reinit, closing of fd, etc…
- Return type:
None
- endheaders(message_body=None, *, encode_chunked=False, expect_body_afterward=False)¶
This method conclude the request context construction.
- Parameters:
- Return type:
ResponsePromise | None
- getresponse(*, promise=None, early_response_callback=None)¶
Fetch the HTTP response. You SHOULD not retrieve the body in that method, it SHOULD be done in the LowLevelResponse, so it enable stream capabilities and remain efficient.
- Parameters:
promise (ResponsePromise | None)
early_response_callback (Callable[[LowLevelResponse], None] | None)
- Return type:
LowLevelResponse
- putheader(header, *values)¶
For a single header name, assign one or multiple value. This method is called right after putrequest() for each entries.
- putrequest(method, url, skip_host=False, skip_accept_encoding=False)¶
Internally fhace translate this into what putrequest does. e.g. initial trame.
- send(data, *, eot=False)¶
We might be receiving a chunk constructed downstream
- set_tunnel(host, port=None, headers=None, scheme='http')¶
Prepare the connection to set up a tunnel. Does NOT actually do the socket and http connect. Here host:port represent the target (final) server and not the intermediary.
- class urllib3.backend.HttpVersion(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Describe possible SVN protocols that can be supported.
- class urllib3.backend.ResponsePromise(conn, stream_id, request_headers, **parameters)¶
- urllib3.backend.QuicPreemptiveCacheType¶
alias of
MutableMapping[Tuple[str,int],Tuple[str,int] |None]
- class urllib3.backend.ConnectionInfo¶
- destination_address: tuple[str, int] | None¶
The IP address used to reach the remote peer (not the proxy), that was yield by your resolver.
- http_version: HttpVersion | None¶
HTTP protocol used with the remote peer (not the proxy)
- issuer_certificate_der: bytes | None¶
The SSL issuer certificate for the remote peer certificate (not the proxy)
- request_sent_latency: timedelta | None¶
Time taken to encode and send the whole request through the socket.
- resolution_latency: timedelta | None¶
Time taken to resolve a domain name into a reachable IP address.