Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions neqo-bin/src/client/http3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::{

use neqo_common::{event::Provider, hex, qdebug, qerror, qinfo, qwarn, Datagram};
use neqo_crypto::{AuthenticationStatus, ResumptionToken};
use neqo_http3::{Error, Http3Client, Http3ClientEvent, Http3Parameters, Http3State, Priority};
use neqo_http3::{Error, Http3Client, Http3ClientEvent, Http3Parameters, Http3State, Priority, WebTransportEvent, features::extended_connect::session};
use neqo_transport::{
AppError, CloseReason, Connection, EmptyConnectionIdGenerator, Error as TransportError,
OutputBatch, RandomConnectionIdGenerator, StreamId,
Expand Down Expand Up @@ -96,6 +96,7 @@ pub fn create_client(
.max_table_size_encoder(args.shared.max_table_size_encoder)
.max_table_size_decoder(args.shared.max_table_size_decoder)
.max_blocked_streams(args.shared.max_blocked_streams)
.webtransport(true)
.max_concurrent_push_streams(args.max_concurrent_push_streams),
);

Expand Down Expand Up @@ -237,8 +238,8 @@ impl super::Handler for Handler {
}
Http3ClientEvent::StateChange(Http3State::Connected)
| Http3ClientEvent::RequestsCreatable => {
qinfo!("{event:?}");
self.url_handler.process_urls(client);
client.webtransport_create_session(Instant::now(), ("https", "https://fb.mvfst.net:8443", "/webtransport/devious-baton"), &[]);
// self.url_handler.process_urls(client);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a mistake.

}
Http3ClientEvent::ZeroRttRejected => {
qinfo!("{event:?}");
Expand All @@ -247,13 +248,19 @@ impl super::Handler for Handler {
self.url_handler.process_urls(client);
}
Http3ClientEvent::ResumptionToken(t) => self.token = Some(t),
Http3ClientEvent::WebTransport(WebTransportEvent::Negotiated(negotiated)) => assert!(negotiated),
Http3ClientEvent::WebTransport(WebTransportEvent::NewSession { status, ..}) => assert_eq!(status, 200),
Http3ClientEvent::WebTransport(WebTransportEvent::NewStream { stream_id, session_id }) => {
assert!(!stream_id.is_bidi());
}
Http3ClientEvent::WebTransport(e) => panic!("{e:?}"),
_ => {
qwarn!("Unhandled event {event:?}");
}
}
}

Ok(self.url_handler.done())
Ok(false)
}

fn take_token(&mut self) -> Option<ResumptionToken> {
Expand Down
1 change: 1 addition & 0 deletions neqo-http3/src/frames/wtframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl FrameDecoder<Self> for WebTransportFrame {
};
Ok(Some(Self::CloseSession { error, message }))
} else {
panic!();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does this.

Ok(None)
}
} else {
Expand Down
34 changes: 31 additions & 3 deletions neqo-http3/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::ops::Deref;

use neqo_common::{qdebug, Buffer, Decoder, Encoder};
use neqo_common::{Buffer, Decoder, Encoder, qdebug, qwarn};
use neqo_crypto::{ZeroRttCheckResult, ZeroRttChecker};

use crate::{Error, Http3Parameters, Res};
Expand All @@ -20,14 +20,21 @@ const SETTINGS_ZERO_RTT_VERSION: u64 = 1;
const SETTINGS_MAX_HEADER_LIST_SIZE: SettingsType = 0x6;
const SETTINGS_QPACK_MAX_TABLE_CAPACITY: SettingsType = 0x1;
const SETTINGS_QPACK_BLOCKED_STREAMS: SettingsType = 0x7;
const SETTINGS_ENABLE_WEB_TRANSPORT: SettingsType = 0x2b60_3742;
// draft-ietf-masque-h3-datagram-04.
// We also use this old value because the current web-platform test only supports
// this value.
const SETTINGS_H3_DATAGRAM_DRAFT04: SettingsType = 0x00ff_d277;

const SETTINGS_H3_DATAGRAM: SettingsType = 0x33;

/// WebTransport draft 4.
const SETTINGS_ENABLE_WEB_TRANSPORT: SettingsType = 0x2b60_3742;
/// WebTransport draft 14.
const SETTINGS_WT_MAX_SESSIONS: SettingsType = 0x14e9cd29;
const SETTINGS_WT_INITIAL_MAX_STREAMS_UNI: SettingsType = 0x2b64;
const SETTINGS_WT_INITIAL_MAX_STREAMS_BIDI: SettingsType = 0x2b65;
const SETTINGS_WT_INITIAL_MAX_DATA: SettingsType = 0x2b61;

/// Advertises support for HTTP Extended CONNECT.
///
/// See <https://www.rfc-editor.org/rfc/rfc9220#section-5>
Expand All @@ -48,9 +55,9 @@ pub enum HSettingType {
const fn hsetting_default(setting_type: HSettingType) -> u64 {
match setting_type {
HSettingType::MaxHeaderListSize => 1 << 62,
HSettingType::EnableWebTransport => 1,
HSettingType::MaxTableCapacity
| HSettingType::BlockedStreams
| HSettingType::EnableWebTransport
| HSettingType::EnableH3Datagram
| HSettingType::EnableConnect => 0,
}
Expand Down Expand Up @@ -112,6 +119,9 @@ impl HSettings {
HSettingType::EnableWebTransport => {
enc_inner.encode_varint(SETTINGS_ENABLE_WEB_TRANSPORT);
enc_inner.encode_varint(iter.value);

enc_inner.encode_varint(SETTINGS_WT_MAX_SESSIONS);
enc_inner.encode_varint(iter.value);
}
HSettingType::EnableH3Datagram => {
if iter.value == 1 {
Expand Down Expand Up @@ -162,6 +172,22 @@ impl HSettings {
self.settings
.push(HSetting::new(HSettingType::EnableWebTransport, value));
}
(Some(SETTINGS_WT_MAX_SESSIONS), Some(value)) => {
if value > 1 {
return Err(Error::HttpSettings);
}
self.settings
.push(HSetting::new(HSettingType::EnableWebTransport, value));
}
(Some(SETTINGS_WT_INITIAL_MAX_STREAMS_UNI), Some(value)) => {
qwarn!("SETTINGS_WT_INITIAL_MAX_STREAMS_UNI {value}");
}
(Some(SETTINGS_WT_INITIAL_MAX_STREAMS_BIDI), Some(value)) => {
qwarn!("SETTINGS_WT_INITIAL_MAX_STREAMS_BIDI {value}");
}
(Some(SETTINGS_WT_INITIAL_MAX_DATA), Some(value)) => {
qwarn!("SETTINGS_WT_INITIAL_MAX_DATA {value}");
}
(Some(SETTINGS_H3_DATAGRAM_DRAFT04), Some(value)) => {
if value > 1 {
return Err(Error::HttpSettings);
Expand Down Expand Up @@ -265,6 +291,8 @@ impl HttpZeroRttChecker {
if settings.get_webtransport() {
enc.encode_varint(SETTINGS_ENABLE_WEB_TRANSPORT)
.encode_varint(true);
enc.encode_varint(SETTINGS_WT_MAX_SESSIONS)
.encode_varint(true);
}
if settings.get_http3_datagram() {
enc.encode_varint(SETTINGS_H3_DATAGRAM).encode_varint(true);
Expand Down
Loading