Skip to content

webtransport: allow new streams in parallel to CONNECT req #3376

@mxinden

Description

@mxinden

IETF WebTransport allows opening new streams in parallel to the HTTP CONNECT session establishment request:

“The client MAY optimistically open unidirectional and bidirectional streams, as well as send datagrams, for a session that it has sent the CONNECT request for, even if it has not yet received the server’s response to the request. On the server side, opening streams and sending datagrams is possible as soon as the CONNECT request has been received.”

https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-14

W3C WebTransport allows the same, see w3c/webtransport#440.

Optimistically allowing streams and datagrams on a not-yet-confirmed WebTransport session saves 1RTT on the happy path.

Neqo currently does not. It only sets the session to State::Active after the response to the HTTP CONNECT request.

self.state = if (200..300).contains(&status) {
if fin {
self.events.session_end(
self.protocol.connect_type(),
self.id,
CloseReason::Clean {
error: 0,
message: String::new(),
},
Some(headers),
);
State::Done
} else {
self.events.session_start(
self.protocol.connect_type(),
self.id,
status,
headers,
);
self.protocol.session_start(&mut self.events)?;
State::Active

It requires a session to be State::Active in order to open new streams:

pub(crate) fn webtransport_create_stream_local(
&mut self,
conn: &mut Connection,
session_id: StreamId,
stream_type: StreamType,
send_events: Box<dyn SendStreamEvents>,
recv_events: Box<dyn RecvStreamEvents>,
) -> Res<StreamId> {
qtrace!("Create new WebTransport stream session={session_id} type={stream_type:?}");
let wt = self
.recv_streams
.get(&session_id)
.ok_or(Error::InvalidStreamId)?
.extended_connect_session()
.ok_or(Error::InvalidStreamId)?;
if !wt.borrow().is_active() {
return Err(Error::InvalidStreamId);
}

//CC @jesup, @jan-ivar

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3Backlogtask-mediumShould take between one and three days

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions