Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Feb 15, 2025
1 parent d2e92d0 commit d60b984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions neqo-transport/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,6 @@ impl CryptoStreams {
};
while let Some((offset, data)) = cs.tx.next_bytes() {
let written = if sni_slicing && offset == 0 {
qdebug!("XXX SNI slicing enabled");
if let Some(sni) = find_sni(data) {
// Cut the crypto data in two at the midpoint of the SNI and swap the chunks.
let mid = sni.start + (sni.end - sni.start) / 2;
Expand All @@ -1585,7 +1584,7 @@ impl CryptoStreams {
(write_chunk(offset, data, builder), None)
}
} else {
// SNI slicing disabled, write the entire data.
// SNI slicing disabled or data not at offset 0, write the entire data.
(write_chunk(offset, data, builder), None)
};

Expand Down
7 changes: 6 additions & 1 deletion neqo-transport/src/shuffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn find_sni(buf: &[u8]) -> Option<Range<usize>> {

#[cfg(test)]
mod tests {
use test_fixture::{now, default_client, default_server};
use test_fixture::{default_client, default_server, now};

const BUF_WITH_SNI: &[u8] = &[
0x01, // msg_type == 1 (ClientHello)
Expand Down Expand Up @@ -154,10 +154,15 @@ mod tests {
let mut server = default_server();
let mut now = now();

// This packet will have two CRPYTO frames [y..end] and [0..x], where x < y.
let ch1 = client.process_output(now).dgram();
// This packet will have one CRYPTO frame [x..y].
let _ch2 = client.process_output(now).dgram();
// We are dropping the second packet and only deliver the first.
let ack = server.process(ch1, now).dgram();
// Client will now RTX the second packet.
now += client.process(ack, now).callback();
// Make sure it only has one CRYPTO frame.
let stats = client.stats().frame_tx;
_ = client.process_output(now).dgram();
assert_eq!(stats.crypto + 1, client.stats().frame_tx.crypto);
Expand Down

0 comments on commit d60b984

Please sign in to comment.