Skip to main content

aws_smithy_http_client/
lib.rs

1/*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/* Automatically managed default lints */
7#![cfg_attr(docsrs, feature(doc_cfg))]
8/* End of automatically managed default lints */
9
10//! HTTP client implementation for smithy-rs generated code.
11//!
12//! # Crate Features
13//!
14//! - `default-client`: Enable default HTTP client implementation (based on hyper 1.x).
15//! - `rustls-ring`: Enable TLS provider based on `rustls` using `ring` as the crypto provider
16//! - `rustls-aws-lc`: Enable TLS provider based on `rustls` using `aws-lc` as the crypto provider
17//! - `rustls-aws-lc-fips`: Same as `rustls-aws-lc` feature but using a FIPS compliant version of `aws-lc`
18//! - `s2n-tls`: Enable TLS provider based on `s2n-tls` using `aws-lc` as the crypto provider.
19//! - `hyper-014`: (Deprecated) HTTP client implementation based on hyper-0.14.x.
20//! - `test-util`: Enables utilities for unit tests. DO NOT ENABLE IN PRODUCTION.
21
22#![warn(
23    missing_docs,
24    rustdoc::missing_crate_level_docs,
25    unreachable_pub,
26    rust_2018_idioms
27)]
28
29// ideally hyper_014 would just be exposed as is but due to
30// https://github.com/rust-lang/rust/issues/47238 we get clippy warnings we can't suppress
31#[cfg(feature = "hyper-014")]
32pub(crate) mod hyper_legacy;
33
34/// Legacy HTTP and TLS connectors that use hyper 0.14.x and rustls.
35#[cfg(feature = "hyper-014")]
36#[deprecated = "hyper 0.14.x support is deprecated, please migrate to 1.x client"]
37pub mod hyper_014 {
38    pub use crate::hyper_legacy::*;
39}
40
41/// Default HTTP and TLS connectors
42#[cfg(feature = "default-client")]
43pub(crate) mod client;
44#[cfg(feature = "default-client")]
45pub use client::{default_connector, proxy, tls, Builder, Connector, ConnectorBuilder};
46
47#[cfg(feature = "test-util")]
48pub mod test_util;
49
50mod error;
51pub use error::HttpClientError;
52
53#[allow(unused_macros, unused_imports)]
54#[macro_use]
55pub(crate) mod cfg {
56    /// Any TLS provider enabled
57    macro_rules! cfg_tls {
58        ($($item:item)*) => {
59            $(
60                #[cfg(any(
61                    feature = "__rustls",
62                    feature = "s2n-tls",
63                ))]
64                #[cfg_attr(docsrs, doc(cfg(any(
65                    feature = "__rustls",
66                    feature = "s2n-tls",
67                ))))]
68                $item
69            )*
70        }
71    }
72
73    /// Any rustls provider enabled
74    macro_rules! cfg_rustls {
75        ($($item:item)*) => {
76            $(
77                #[cfg(feature = "__rustls")]
78                #[cfg_attr(docsrs, doc(cfg(feature = "__rustls")))]
79                $item
80            )*
81        }
82    }
83
84    macro_rules! cfg_s2n_tls {
85        ($($item:item)*) => {
86            $(
87                #[cfg(feature = "s2n-tls")]
88                #[cfg_attr(docsrs, doc(cfg(feature = "s2n-tls")))]
89                $item
90            )*
91        }
92    }
93
94    pub(crate) use cfg_rustls;
95    pub(crate) use cfg_s2n_tls;
96    pub(crate) use cfg_tls;
97}