MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / create_http_client

Function create_http_client

rust/src/lib.rs:1878–1890  ·  view source on GitHub ↗
(timeout: u64, proxy: &str, insecure: bool)

Source from the content-addressed store, hash-verified

1876}
1877
1878pub fn create_http_client(timeout: u64, proxy: &str, insecure: bool) -> Result<Client, Error> {
1879 // Ensure the ring provider is installed. Returns Err if already set, which
1880 // is fine — we just need it present before ClientBuilder::build() runs.
1881 let _ = rustls::crypto::ring::default_provider().install_default();
1882 let mut client_builder = Client::builder().timeout(Duration::from_secs(timeout));
1883 if !proxy.is_empty() {
1884 client_builder = client_builder.proxy(Proxy::all(proxy)?);
1885 }
1886 if insecure {
1887 client_builder = client_builder.danger_accept_invalid_certs(true);
1888 }
1889 Ok(client_builder.build()?)
1890}
1891
1892pub fn format_error(err: &Error) -> String {
1893 if is_tls_certificate_error(err) {

Callers 1

get_http_clientMethod · 0.85

Calls 3

is_emptyMethod · 0.80
buildMethod · 0.65
proxyMethod · 0.45

Tested by

no test coverage detected