@@ -9,30 +9,16 @@ pub async fn attested_get(
99 url_path : & str ,
1010 attestation_verifier : AttestationVerifier ,
1111 remote_certificate : Option < CertificateDer < ' static > > ,
12- allow_self_signed : bool ,
1312) -> Result < reqwest:: Response , ProxyError > {
14- let proxy_client = if allow_self_signed {
15- let client_config = crate :: self_signed:: client_tls_config_allow_self_signed ( ) ?;
16- ProxyClient :: new_with_tls_config (
17- client_config,
18- "127.0.0.1:0" . to_string ( ) ,
19- target_addr,
20- AttestationGenerator :: with_no_attestation ( ) ,
21- attestation_verifier,
22- None ,
23- )
24- . await ?
25- } else {
26- ProxyClient :: new (
27- None ,
28- "127.0.0.1:0" . to_string ( ) ,
29- target_addr,
30- AttestationGenerator :: with_no_attestation ( ) ,
31- attestation_verifier,
32- remote_certificate,
33- )
34- . await ?
35- } ;
13+ let proxy_client = ProxyClient :: new (
14+ None ,
15+ "127.0.0.1:0" . to_string ( ) ,
16+ target_addr,
17+ AttestationGenerator :: with_no_attestation ( ) ,
18+ attestation_verifier,
19+ remote_certificate,
20+ )
21+ . await ?;
3622
3723 attested_get_with_client ( proxy_client, url_path) . await
3824}
@@ -72,11 +58,11 @@ mod tests {
7258 ProxyServer ,
7359 attestation:: AttestationType ,
7460 file_server:: static_file_server,
75- test_helpers:: { generate_certificate_chain , generate_tls_config} ,
61+ test_helpers:: { generate_certificate_chain_for_host , generate_tls_config} ,
7662 } ;
7763 use tempfile:: tempdir;
7864
79- #[ tokio:: test]
65+ #[ tokio:: test( flavor = "multi_thread" ) ]
8066 async fn test_attested_get ( ) {
8167 // Create a temporary directory with a file to serve
8268 let dir = tempdir ( ) . unwrap ( ) ;
@@ -87,7 +73,7 @@ mod tests {
8773 let target_addr = static_file_server ( dir. path ( ) . to_path_buf ( ) ) . await . unwrap ( ) ;
8874
8975 // Create TLS configuration
90- let ( cert_chain, private_key) = generate_certificate_chain ( "127.0.0.1" . parse ( ) . unwrap ( ) ) ;
76+ let ( cert_chain, private_key) = generate_certificate_chain_for_host ( "localhost" ) ;
9177 let ( server_config, client_config) = generate_tls_config ( cert_chain. clone ( ) , private_key) ;
9278
9379 // Setup a proxy server targetting the static file server
@@ -113,7 +99,7 @@ mod tests {
11399 let proxy_client = ProxyClient :: new_with_tls_config (
114100 client_config,
115101 "127.0.0.1:0" . to_string ( ) ,
116- proxy_addr. to_string ( ) ,
102+ format ! ( "localhost:{}" , proxy_addr. port ( ) ) ,
117103 AttestationGenerator :: with_no_attestation ( ) ,
118104 AttestationVerifier :: mock ( ) ,
119105 None ,
0 commit comments