nopasaran.tools.http_3_overwrite.H3Connection¶
- class nopasaran.tools.http_3_overwrite.H3Connection(quic: QuicConnection, enable_webtransport: bool = False, skip_settings_frame: bool = False)¶
Bases:
objectA low-level HTTP/3 connection object.
- Parameters:
quic – A
QuicConnectioninstance.skip_settings_frame – If True, do not send the SETTINGS frame on the control stream (for non-conformance testing).
- __init__(quic: QuicConnection, enable_webtransport: bool = False, skip_settings_frame: bool = False) None¶
Methods
__init__(quic[, enable_webtransport, ...])create_webtransport_stream(session_id[, ...])Create a WebTransport stream and return the stream ID.
handle_event(event)Handle a QUIC event and return a list of HTTP events.
send_data(stream_id, data, end_stream)Send data on the given stream.
send_datagram(stream_id, data)Send a datagram for the specified stream.
send_headers(stream_id, headers[, end_stream])Send headers on the given stream.
send_push_promise(stream_id, headers)Send a push promise related to the specified stream.
Attributes
Return the received SETTINGS frame, or None.
Return the sent SETTINGS frame, or None.
- create_webtransport_stream(session_id: int, is_unidirectional: bool = False) int¶
Create a WebTransport stream and return the stream ID.
- Parameters:
session_id – The WebTransport session identifier.
is_unidirectional – Whether to create a unidirectional stream.
- handle_event(event: QuicEvent) List[H3Event]¶
Handle a QUIC event and return a list of HTTP events.
- Parameters:
event – The QUIC event to handle.
- property received_settings: Dict[int, int] | None¶
Return the received SETTINGS frame, or None.
- send_data(stream_id: int, data: bytes, end_stream: bool) None¶
Send data on the given stream.
- Parameters:
stream_id – The stream ID on which to send the data.
data – The data to send.
end_stream – Whether to end the stream.
- send_datagram(stream_id: int, data: bytes) None¶
Send a datagram for the specified stream.
If the stream ID is not a client-initiated bidirectional stream, an
InvalidStreamTypeErrorexception is raised.- Parameters:
stream_id – The stream ID.
data – The HTTP/3 datagram payload.
- send_headers(stream_id: int, headers: list[tuple[bytes, bytes]], end_stream: bool = False) None¶
Send headers on the given stream.
- Parameters:
stream_id – The stream ID on which to send the headers.
headers – The HTTP headers to send.
end_stream – Whether to end the stream.
- send_push_promise(stream_id: int, headers: list[tuple[bytes, bytes]]) int¶
Send a push promise related to the specified stream.
Returns the stream ID on which headers and data can be sent.
If the stream ID is not a client-initiated bidirectional stream, an
InvalidStreamTypeErrorexception is raised.If there are not available push IDs, an
NoAvailablePushIDErrorexception is raised.- Parameters:
stream_id – The stream ID on which to send the data.
headers – The HTTP request headers for this push.
- property sent_settings: Dict[int, int] | None¶
Return the sent SETTINGS frame, or None.