Build an HTTPS client *without* a client cert (simulates Cloudflare tunnel).
(
ca_pem: &[u8],
)
| 136 | |
| 137 | /// Build an HTTPS client *without* a client cert (simulates Cloudflare tunnel). |
| 138 | fn https_client_no_cert( |
| 139 | ca_pem: &[u8], |
| 140 | ) -> Client< |
| 141 | hyper_rustls::HttpsConnector<hyper_util::client::legacy::connect::HttpConnector>, |
| 142 | Empty<Bytes>, |
| 143 | > { |
| 144 | let roots = build_tls_root(ca_pem); |
| 145 | let tls_config = rustls::ClientConfig::builder() |
| 146 | .with_root_certificates(roots) |
| 147 | .with_no_client_auth(); |
| 148 | let https = HttpsConnectorBuilder::new() |
| 149 | .with_tls_config(tls_config) |
| 150 | .https_only() |
| 151 | .enable_http1() |
| 152 | .build(); |
| 153 | Client::builder(TokioExecutor::new()).build(https) |
| 154 | } |
| 155 | |
| 156 | // =========================================================================== |
| 157 | // Tests |
no test coverage detected