Skip to content
Open
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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ make docker-build # quiche-base + quiche-qns
## NOTES

- **No git submodules**: BoringSSL is built by `boring-sys`; `cmake` must be available.
- **MSRV 1.85**: `rust-version` field in Cargo.toml.
- **MSRV 1.87**: `rust-version` field in Cargo.toml.
- **Doc tests are separate**: `cargo test --all-targets` does NOT run doc tests (cargo#6669).
- **`BORING_BSSL_PATH`**: env var to point `boring-sys` at a custom BoringSSL source tree.
- **`RUSTFLAGS="-D warnings"`**: CI enforces; all warnings are errors.
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ anyhow = { version = "1" }
assert_matches = { version = "1" }
boring = { version = "4.3" }
buffer-pool = { version = "0.2.1", path = "./buffer-pool" }
bytemuck = { version = "1.25.0", features = ["derive", "min_const_generics", "must_cast"] }
bytes = { version = "1.11.1" }
crossbeam = { version = "0.8.1", default-features = false }
dashmap = { version = "6" }
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.86 AS build
FROM rust:1.87 AS build

WORKDIR /build

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ is disabled by default), by passing ``--features ffi`` to ``cargo``.
Building
--------

quiche requires Rust 1.85 or later to build. The latest stable Rust release can
quiche requires Rust 1.87 or later to build. The latest stable Rust release can
be installed using [rustup](https://rustup.rs/).

Once the Rust build environment is setup, the quiche source code can be fetched
Expand Down
2 changes: 1 addition & 1 deletion datagram-socket/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl std::fmt::Debug for DgramBuffer {
// Render payload bytes as two-char hex, underscore-separated after every
// 4.
for (i, byte) in self.as_slice().iter().enumerate() {
if i > 0 && i % 4 == 0 {
if i > 0 && i.is_multiple_of(4) {
f.write_str("_")?;
}
write!(f, "{:02x}", byte)?;
Expand Down
2 changes: 1 addition & 1 deletion h3i/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub(crate) fn parse_streams<F: quiche::BufFactory, C: Client>(

for stream in conn.readable() {
// TODO: ignoring control streams
if stream % 4 != 0 {
if !stream.is_multiple_of(4) {
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion quiche/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include = [
"/quiche.svg",
"/src",
]
rust-version = "1.85"
rust-version = "1.87"

[features]
default = ["boringssl-boring-crate"]
Expand Down Expand Up @@ -64,6 +64,7 @@ rustdoc-args = ["--cfg", "docsrs"]
cdylib-link-lines = { version = "0.1", optional = true }

[dependencies]
bytemuck = { workspace = true }
bytes = { workspace = true }
boring = { workspace = true, optional = true }
debug_panic = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions quiche/src/cid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ impl ConnectionIdentifiers {
// Record the zero-length SCID status.
let zero_length_scid = initial_scid.is_empty();

let initial_scid =
ConnectionId::from_ref(initial_scid.as_ref()).into_owned();
let initial_scid = initial_scid.clone().into_owned();

// We need to track up to (2 * source_conn_id_limit - 1) source
// Connection IDs when the host wants to force their renewal.
Expand Down
12 changes: 6 additions & 6 deletions quiche/src/h3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ impl Connection {
let len = body.as_ref().len();

// Validate that it is sane to send data on the stream.
if stream_id % 4 != 0 {
if !stream_id.is_multiple_of(4) {
return Err(Error::FrameUnexpected);
}

Expand Down Expand Up @@ -1917,7 +1917,7 @@ impl Connection {
return Err(Error::FrameUnexpected);
}

if stream_id % 4 != 0 {
if !stream_id.is_multiple_of(4) {
return Err(Error::FrameUnexpected);
}

Expand Down Expand Up @@ -2170,7 +2170,7 @@ impl Connection {
id = 0;
}

if self.is_server && id % 4 != 0 {
if self.is_server && !id.is_multiple_of(4) {
return Err(Error::IdError);
}

Expand Down Expand Up @@ -3039,7 +3039,7 @@ impl Connection {
},

frame::Frame::GoAway { id } => {
if !self.is_server && id % 4 != 0 {
if !self.is_server && !id.is_multiple_of(4) {
conn.close(
true,
Error::FrameUnexpected.to_wire(),
Expand Down Expand Up @@ -3101,7 +3101,7 @@ impl Connection {
return Err(Error::FrameUnexpected);
}

if stream_id % 4 != 0 {
if !stream_id.is_multiple_of(4) {
conn.close(
true,
Error::FrameUnexpected.to_wire(),
Expand Down Expand Up @@ -3132,7 +3132,7 @@ impl Connection {
return Err(Error::FrameUnexpected);
}

if prioritized_element_id % 4 != 0 {
if !prioritized_element_id.is_multiple_of(4) {
conn.close(
true,
Error::FrameUnexpected.to_wire(),
Expand Down
37 changes: 14 additions & 23 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ impl<F: BufFactory> Connection<F> {
if let Some(client_dcid) = client_dcid {
// The Minimum length is 8.
// See https://datatracker.ietf.org/doc/html/rfc9000#section-7.2-3
if client_dcid.to_vec().len() < 8 {
if client_dcid.len() < 8 {
return Err(Error::InvalidDcidInitialization);
}
}
Expand Down Expand Up @@ -2247,16 +2247,16 @@ impl<F: BufFactory> Connection<F> {
if let Some(retry_cids) = retry_cids {
conn.local_transport_params
.original_destination_connection_id =
Some(retry_cids.original_destination_cid.to_vec().into());
Some(retry_cids.original_destination_cid.clone().into_owned());

conn.local_transport_params.retry_source_connection_id =
Some(retry_cids.retry_source_cid.to_vec().into());
Some(retry_cids.retry_source_cid.clone().into_owned());

conn.did_retry = true;
}

conn.local_transport_params.initial_source_connection_id =
Some(conn.ids.get_scid(0)?.cid.to_vec().into());
Some(conn.ids.get_scid(0)?.cid.clone());

conn.handshake.init(is_server)?;

Expand Down Expand Up @@ -2286,11 +2286,7 @@ impl<F: BufFactory> Connection<F> {
)?;

let reset_token = conn.peer_transport_params.stateless_reset_token;
conn.set_initial_dcid(
dcid.to_vec().into(),
reset_token,
active_path_id,
)?;
conn.set_initial_dcid(dcid.into(), reset_token, active_path_id)?;

conn.crypto_ctx[packet::Epoch::Initial].crypto_open = Some(aead_open);
conn.crypto_ctx[packet::Epoch::Initial].crypto_seal = Some(aead_seal);
Expand Down Expand Up @@ -3369,8 +3365,7 @@ impl<F: BufFactory> Connection<F> {
// Now that we decrypted the packet, let's see if we can map it to an
// existing path.
let recv_pid = if hdr.ty == Type::Short && self.got_peer_conn_id {
let pkt_dcid = ConnectionId::from_ref(&hdr.dcid);
self.get_or_create_recv_path_id(recv_pid, &pkt_dcid, buf_len, info)?
self.get_or_create_recv_path_id(recv_pid, &hdr.dcid, buf_len, info)?
} else {
// During handshake, we are on the initial path.
self.paths.get_active_path_id()?
Expand Down Expand Up @@ -3454,8 +3449,7 @@ impl<F: BufFactory> Connection<F> {

if !self.did_retry {
self.local_transport_params
.original_destination_connection_id =
Some(hdr.dcid.to_vec().into());
.original_destination_connection_id = Some(hdr.dcid.clone());

self.encode_transport_params()?;
}
Expand Down Expand Up @@ -4426,11 +4420,10 @@ impl<F: BufFactory> Connection<F> {

let dcid_seq = path.active_dcid_seq.ok_or(Error::OutOfIdentifiers)?;

let dcid =
ConnectionId::from_ref(self.ids.get_dcid(dcid_seq)?.cid.as_ref());
let dcid = self.ids.get_dcid(dcid_seq)?.cid.clone();

let scid = if let Some(scid_seq) = path.active_scid_seq {
ConnectionId::from_ref(self.ids.get_scid(scid_seq)?.cid.as_ref())
self.ids.get_scid(scid_seq)?.cid.clone()
} else if pkt_type == Type::Short {
ConnectionId::default()
} else {
Expand Down Expand Up @@ -7286,7 +7279,7 @@ impl<F: BufFactory> Connection<F> {
&mut self, scid: &ConnectionId, reset_token: u128, retire_if_needed: bool,
) -> Result<u64> {
self.ids.new_scid(
scid.to_vec().into(),
scid.clone().into_owned(),
Some(reset_token),
true,
None,
Expand Down Expand Up @@ -7605,13 +7598,12 @@ impl<F: BufFactory> Connection<F> {
if let Ok(path) = self.paths.get_active() {
if let Some(active_scid_seq) = path.active_scid_seq {
if let Ok(e) = self.ids.get_scid(active_scid_seq) {
return ConnectionId::from_ref(e.cid.as_ref());
return e.cid.clone();
}
}
}

let e = self.ids.oldest_scid();
ConnectionId::from_ref(e.cid.as_ref())
self.ids.oldest_scid().cid.clone()
}

/// Returns all active source connection IDs.
Expand All @@ -7632,13 +7624,12 @@ impl<F: BufFactory> Connection<F> {
if let Ok(path) = self.paths.get_active() {
if let Some(active_dcid_seq) = path.active_dcid_seq {
if let Ok(e) = self.ids.get_dcid(active_dcid_seq) {
return ConnectionId::from_ref(e.cid.as_ref());
return e.cid.clone();
}
}
}

let e = self.ids.oldest_dcid();
ConnectionId::from_ref(e.cid.as_ref())
self.ids.oldest_dcid().cid.clone()
}

/// Returns the PMTU for the active path if it exists.
Expand Down
Loading
Loading