1use crate::core::{Profile, Result};
12
13pub fn supports_http3(tls_config: &rustls::ClientConfig) -> bool {
15 tls_config.alpn_protocols.iter().any(|p| p == b"h3")
16}
17
18pub fn enable_http3(profile: &Profile) -> Result<Profile> {
20 let mut updated = profile.clone();
21 updated.tls.alpn.push("h3".to_string());
22 Ok(updated)
23}
24
25#[cfg(feature = "http3")]
29pub type Http3Response = HttpResponse;
30
31#[cfg(feature = "http3")]
32#[derive(Debug, Clone)]
33pub struct HttpResponse {
34 pub status: u16,
35 pub headers: Vec<(String, String)>,
36 pub body: Vec<u8>,
37}
38
39#[cfg(test)]
40mod tests {
41 use super::*;
42
43 #[test]
44 fn test_enable_http3() {
45 let profile = Profile::chrome_143_windows();
46 let updated = enable_http3(&profile).unwrap();
47 assert!(updated.tls.alpn.contains(&"h3".to_string()));
48 }
49}