pub struct Http3 { /* private fields */ }Implementations§
Source§impl Http3
impl Http3
pub fn new(is_server: bool, cfg: Config) -> Self
pub fn poll_event(&mut self) -> Option<H3Event>
Sourcepub fn peer_connect_protocol(&self) -> Option<bool>
pub fn peer_connect_protocol(&self) -> Option<bool>
The peer (a server) accepts extended CONNECT (RFC 9220): its SETTINGS carried
SETTINGS_ENABLE_CONNECT_PROTOCOL = 1. None until its SETTINGS arrived.
Sourcepub fn peer_settings(&self) -> Option<&Settings>
pub fn peer_settings(&self) -> Option<&Settings>
The peer’s SETTINGS, once received.
Sourcepub fn active_streams(&self) -> usize
pub fn active_streams(&self) -> usize
Request streams currently tracked.
Sourcepub fn open(&mut self, conn: &mut Connection)
pub fn open(&mut self, conn: &mut Connection)
Opens the control and QPACK streams and sends SETTINGS. Http3::handle does this
on Event::Connected; call it directly if the connection was established before.
Sourcepub fn handle(&mut self, now: Instant, conn: &mut Connection, ev: &Event)
pub fn handle(&mut self, now: Instant, conn: &mut Connection, ev: &Event)
Feeds one QUIC event of this connection.
Sourcepub fn recv_body(
&mut self,
now: Instant,
conn: &mut Connection,
stream: u64,
out: &mut [u8],
) -> Result<(usize, bool), SendError>
pub fn recv_body( &mut self, now: Instant, conn: &mut Connection, stream: u64, out: &mut [u8], ) -> Result<(usize, bool), SendError>
Reads body bytes; returns (bytes, finished). Finished is reported once the peer’s fin was received and every body byte was read.
Sourcepub fn send_headers(
&mut self,
conn: &mut Connection,
stream: u64,
fields: &[(&[u8], &[u8])],
fin: bool,
) -> Result<(), SendError>
pub fn send_headers( &mut self, conn: &mut Connection, stream: u64, fields: &[(&[u8], &[u8])], fin: bool, ) -> Result<(), SendError>
Sends response headers (server) or request headers (client). Interim 1xx responses may precede the final one.
Sourcepub fn send_body(
&mut self,
conn: &mut Connection,
stream: u64,
data: &[u8],
fin: bool,
) -> Result<usize, SendError>
pub fn send_body( &mut self, conn: &mut Connection, stream: u64, data: &[u8], fin: bool, ) -> Result<usize, SendError>
Sends body bytes in a DATA frame; returns how many were accepted. Zero means the
stream is blocked: wait for H3Event::Writable.
Sourcepub fn send_trailers(
&mut self,
conn: &mut Connection,
stream: u64,
fields: &[(&[u8], &[u8])],
) -> Result<(), SendError>
pub fn send_trailers( &mut self, conn: &mut Connection, stream: u64, fields: &[(&[u8], &[u8])], ) -> Result<(), SendError>
Sends trailers and finishes the stream.
Sourcepub fn reset_stream(&mut self, conn: &mut Connection, stream: u64, code_: u64)
pub fn reset_stream(&mut self, conn: &mut Connection, stream: u64, code_: u64)
Abandons a request with a stream error (both directions).
Sourcepub fn send_request(
&mut self,
conn: &mut Connection,
fields: &[(&[u8], &[u8])],
fin: bool,
) -> Result<u64, SendError>
pub fn send_request( &mut self, conn: &mut Connection, fields: &[(&[u8], &[u8])], fin: bool, ) -> Result<u64, SendError>
Client: opens a request stream and sends its headers.
Sourcepub fn goaway(&mut self, conn: &mut Connection) -> u64
pub fn goaway(&mut self, conn: &mut Connection) -> u64
Server: starts a graceful shutdown. Requests on streams below the returned ID are still served; later ones are rejected with H3_REQUEST_REJECTED.
Sourcepub fn is_idle_after_goaway(&self) -> bool
pub fn is_idle_after_goaway(&self) -> bool
True once GOAWAY was sent and no request streams remain.