0.34.6_repo_cleanup
This commit is contained in:
1 parent
ce1a90397c
commit
133d2f0f91
273 files changed
+5969
-6926
No files matched your search
+1
-7
@@ -93,8 +93,6 @@ impl HttpBody for ReceiveBody {
|
||||
self.done
|
||||
}
|
||||
fn size_hint(&self) -> SizeHint {
|
||||
// A declared zero is not proof that the peer ended its stream. Unknown
|
||||
// lengths are verified by the cache's bounded empty-body probe.
|
||||
let mut hint = SizeHint::new();
|
||||
if self.done {
|
||||
hint.set_exact(0);
|
||||
@@ -109,9 +107,5 @@ impl HttpBody for ReceiveBody {
|
||||
}
|
||||
}
|
||||
impl Drop for ReceiveBody {
|
||||
fn drop(&mut self) {
|
||||
// Do not call stop_sending here: h3/quinn can still have a pending
|
||||
// receive read and has previously panicked on that cancellation path.
|
||||
// Protocol framing violations explicitly stop only from poll_frame.
|
||||
}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
@@ -50,8 +50,6 @@ fn log_protocol_error(
|
||||
);
|
||||
}
|
||||
|
||||
/// Service-level breadcrumbs for a full HTTP/3 GET / navigation. User-provided
|
||||
/// query strings, headers and error details must not reach this diagnostic.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn log_root_navigation(
|
||||
stage: &'static str,
|
||||
@@ -83,7 +81,12 @@ fn log_root_navigation(
|
||||
}
|
||||
}
|
||||
|
||||
fn log_h3_response_complete(peer: SocketAddr, stream_id: &str, response_status: u16, body_bytes_sent: u64) {
|
||||
fn log_h3_response_complete(
|
||||
peer: SocketAddr,
|
||||
stream_id: &str,
|
||||
response_status: u16,
|
||||
body_bytes_sent: u64,
|
||||
) {
|
||||
tracing::debug!(
|
||||
peer=%peer, stream_id=%stream_id, response_status, body_bytes_sent,
|
||||
"HTTP/3 response completed"
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/// A client can cancel an obsolete in-flight request during navigation/F5.
|
||||
/// RFC 9114 section 4.1.1 gives this a stream reset code, not an HTTP 400.
|
||||
/// Treat only peer-originated cancellation as benign; local protocol errors
|
||||
/// and other remote reset codes remain visible to operators.
|
||||
fn client_cancelled_code(code: Code) -> bool {
|
||||
code == Code::H3_REQUEST_CANCELLED || code == Code::H3_NO_ERROR
|
||||
}
|
||||
|
||||
@@ -5,11 +5,8 @@ pub struct Settings {
|
||||
pub max_concurrent_connections: u32,
|
||||
pub max_concurrent_bidistream: u32,
|
||||
pub max_concurrent_unistream: u32,
|
||||
/// QUIC idle timeout in seconds; zero disables the transport idle timeout.
|
||||
pub max_idle_timeout: u64,
|
||||
/// Desired effective UDP socket receive buffer (bytes). 0 = OS default.
|
||||
pub udp_receive_buffer_bytes: u32,
|
||||
/// Desired effective UDP socket send buffer (bytes). 0 = OS default.
|
||||
pub udp_send_buffer_bytes: u32,
|
||||
}
|
||||
impl Default for Settings {
|
||||
|
||||
+54
-18
@@ -41,12 +41,24 @@ mod tests {
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
assert!(Settings { udp_receive_buffer_bytes: 1, ..Default::default() }
|
||||
.validate().is_err());
|
||||
assert!(Settings { udp_send_buffer_bytes: 16 * 1024 * 1024 + 1, ..Default::default() }
|
||||
.validate().is_err());
|
||||
assert!(Settings { udp_send_buffer_bytes: 0, ..Default::default() }
|
||||
.validate().is_ok());
|
||||
assert!(Settings {
|
||||
udp_receive_buffer_bytes: 1,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
assert!(Settings {
|
||||
udp_send_buffer_bytes: 16 * 1024 * 1024 + 1,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
assert!(Settings {
|
||||
udp_send_buffer_bytes: 0,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn alt_svc_uses_latest_committed_lifetime_and_only_bound_udp() {
|
||||
@@ -66,18 +78,45 @@ mod tests {
|
||||
|
||||
let mut updated = binding;
|
||||
updated.http3.as_mut().unwrap().alt_svc_max_age = 19;
|
||||
advertise(&mut h, Some(binding.address), true, &active, &[updated], true);
|
||||
advertise(
|
||||
&mut h,
|
||||
Some(binding.address),
|
||||
true,
|
||||
&active,
|
||||
&[updated],
|
||||
true,
|
||||
);
|
||||
assert_eq!(h["alt-svc"], "h3=\":8443\"; ma=19");
|
||||
|
||||
advertise(&mut h, Some(binding.address), false, &active, &[updated], true);
|
||||
advertise(
|
||||
&mut h,
|
||||
Some(binding.address),
|
||||
false,
|
||||
&active,
|
||||
&[updated],
|
||||
true,
|
||||
);
|
||||
assert!(!h.contains_key("alt-svc"));
|
||||
advertise(&mut h, Some("127.0.0.2:8443".parse().unwrap()), true, &active, &[updated], true);
|
||||
advertise(
|
||||
&mut h,
|
||||
Some("127.0.0.2:8443".parse().unwrap()),
|
||||
true,
|
||||
&active,
|
||||
&[updated],
|
||||
true,
|
||||
);
|
||||
assert!(!h.contains_key("alt-svc"));
|
||||
|
||||
// An intended but not bound H3 socket MUST NOT be advertised.
|
||||
let mut previously_h2_only = binding;
|
||||
previously_h2_only.http3 = None;
|
||||
advertise(&mut h, Some(binding.address), true, &[previously_h2_only], &[updated], true);
|
||||
advertise(
|
||||
&mut h,
|
||||
Some(binding.address),
|
||||
true,
|
||||
&[previously_h2_only],
|
||||
&[updated],
|
||||
true,
|
||||
);
|
||||
assert!(!h.contains_key("alt-svc"));
|
||||
}
|
||||
#[test]
|
||||
@@ -92,11 +131,8 @@ mod tests {
|
||||
};
|
||||
let local = Some("192.0.2.2:443".parse().unwrap());
|
||||
let mut h = HeaderMap::new();
|
||||
// Vhost opt-out: immediate Alt-Svc: clear without affecting another host.
|
||||
advertise(&mut h, local, true, &[binding], &[binding], false);
|
||||
assert_eq!(h["alt-svc"], "clear");
|
||||
// Listener opt-out: listener removal requires restart but the header
|
||||
// is withdrawn immediately, while existing H3 sessions may survive.
|
||||
let mut disabled = binding;
|
||||
disabled.http3 = None;
|
||||
advertise(&mut h, local, true, &[binding], &[disabled], true);
|
||||
@@ -127,7 +163,6 @@ mod tests {
|
||||
h3.max_concurrent_unistream = 30;
|
||||
h3.max_idle_timeout = 90;
|
||||
assert!(!listeners_require_restart(&[active], &[next]));
|
||||
// A capacity increase above the startup socket/permit cap needs restart.
|
||||
next.http3.as_mut().unwrap().max_concurrent_connections = 513;
|
||||
assert!(listeners_require_restart(&[active], &[next]));
|
||||
next = active;
|
||||
@@ -153,7 +188,10 @@ mod tests {
|
||||
let settings: Settings = serde_json::from_str(old).unwrap();
|
||||
assert_eq!(settings.udp_receive_buffer_bytes, 4 * 1024 * 1024);
|
||||
assert_eq!(settings.udp_send_buffer_bytes, 4 * 1024 * 1024);
|
||||
assert_eq!(serde_json::from_str::<Settings>(&serde_json::to_string(&settings).unwrap()).unwrap(), settings);
|
||||
assert_eq!(
|
||||
serde_json::from_str::<Settings>(&serde_json::to_string(&settings).unwrap()).unwrap(),
|
||||
settings
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn udp_socket_tuning_produces_readable_socket_options() {
|
||||
@@ -166,8 +204,6 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn client_cancellation_is_a_stream_event_not_an_http_400() {
|
||||
// Exercise the production classifier; RemoteTerminate is
|
||||
// non-exhaustive in hpx-h3 and cannot be constructed by this crate.
|
||||
assert!(client_cancelled_code(Code::H3_REQUEST_CANCELLED));
|
||||
assert!(client_cancelled_code(Code::H3_NO_ERROR));
|
||||
assert!(!client_cancelled_code(Code::H3_MESSAGE_ERROR));
|
||||
|
||||
Reference in new issue
Block a user