v0.25.1
This commit is contained in:
1 parent
87e571c170
commit
fa7abc9e53
308 files changed
+49746
-50237
No files matched your search
+1
-77
@@ -495,80 +495,4 @@ impl Drop for ReceiveBody {
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn requested_defaults_and_infinite_idle_are_valid() {
|
||||
let s = Settings::default();
|
||||
assert_eq!(
|
||||
(
|
||||
s.alt_svc_max_age,
|
||||
s.max_concurrent_connections,
|
||||
s.max_concurrent_bidistream,
|
||||
s.max_concurrent_unistream,
|
||||
s.max_idle_timeout
|
||||
),
|
||||
(3600, 512, 100, 100, 10)
|
||||
);
|
||||
assert!(s.transport().is_ok());
|
||||
assert!(Settings {
|
||||
max_idle_timeout: 0,
|
||||
..s
|
||||
}
|
||||
.transport()
|
||||
.is_ok());
|
||||
}
|
||||
#[test]
|
||||
fn critical_streams_and_resource_limits_are_validated() {
|
||||
assert!(Settings {
|
||||
max_concurrent_unistream: 2,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
assert!(Settings {
|
||||
max_concurrent_connections: 0,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
assert!(Settings {
|
||||
max_concurrent_bidistream: 0,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.is_err());
|
||||
}
|
||||
#[test]
|
||||
fn alt_svc_only_for_actual_tls_udp_listener() {
|
||||
let binding = Listener {
|
||||
address: "127.0.0.1:8443".parse().unwrap(),
|
||||
tls: true,
|
||||
http2: true,
|
||||
http2_settings: Some(crate::settings::Http2Connections::default()),
|
||||
h2c: false,
|
||||
http3: Some(Settings::default()),
|
||||
};
|
||||
let mut h = HeaderMap::new();
|
||||
h.insert("alt-svc", "h3=\":9999\"".parse().unwrap());
|
||||
advertise(&mut h, Some(binding.address), true, &[binding]);
|
||||
assert_eq!(h["alt-svc"], "h3=\":8443\"; ma=3600");
|
||||
advertise(&mut h, Some(binding.address), false, &[binding]);
|
||||
assert!(!h.contains_key("alt-svc"));
|
||||
advertise(
|
||||
&mut h,
|
||||
Some("127.0.0.2:8443".parse().unwrap()),
|
||||
true,
|
||||
&[binding],
|
||||
);
|
||||
assert!(!h.contains_key("alt-svc"));
|
||||
}
|
||||
#[test]
|
||||
fn h3_rejects_http1_connection_specific_headers() {
|
||||
for name in ["connection", "transfer-encoding", "upgrade"] {
|
||||
let mut h = HeaderMap::new();
|
||||
h.insert(name, "anything".parse().unwrap());
|
||||
assert!(invalid_headers(&h));
|
||||
}
|
||||
}
|
||||
}
|
||||
include!("http3/tests.rs");
|
||||
Reference in new issue
Block a user