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//! - `rt-tokio`: Enable Tokio-specific runtime adapters for the default client.
16//! - `rustls-ring`: Enable TLS provider based on `rustls` using `ring` as the crypto provider
17//! - `rustls-aws-lc`: Enable TLS provider based on `rustls` using `aws-lc` as the crypto provider
18//! - `rustls-aws-lc-fips`: Same as `rustls-aws-lc` feature but using a FIPS compliant version of `aws-lc`
19//! - `s2n-tls`: Enable TLS provider based on `s2n-tls` using `aws-lc` as the crypto provider.
20//! - `hyper-014`: (Deprecated) HTTP client implementation based on hyper-0.14.x.
21//! - `test-util`: Enables utilities for unit tests. DO NOT ENABLE IN PRODUCTION.
22
23#![warn(
24 missing_docs,
25 rustdoc::missing_crate_level_docs,
26 unreachable_pub,
27 rust_2018_idioms
28)]
29
30// ideally hyper_014 would just be exposed as is but due to
31// https://github.com/rust-lang/rust/issues/47238 we get clippy warnings we can't suppress
32#[cfg(feature = "hyper-014")]
33pub(crate) mod hyper_legacy;
34
35/// Legacy HTTP and TLS connectors that use hyper 0.14.x and rustls.
36#[cfg(feature = "hyper-014")]
37#[deprecated = "hyper 0.14.x support is deprecated, please migrate to 1.x client"]
38pub mod hyper_014 {
39 pub use crate::hyper_legacy::*;
40}
41
42/// Default HTTP and TLS connectors
43#[cfg(feature = "default-client")]
44pub(crate) mod client;
45#[cfg(feature = "default-client")]
46mod sync;
47#[cfg(feature = "default-client")]
48pub use client::{default_connector, pool, proxy, tls, Builder, Connector, ConnectorBuilder};
49
50#[cfg(feature = "test-util")]
51pub mod test_util;
52
53mod error;
54pub use error::HttpClientError;
55
56#[allow(unused_macros, unused_imports)]
57#[macro_use]
58pub(crate) mod cfg {
59 /// Any TLS provider enabled
60 macro_rules! cfg_tls {
61 ($($item:item)*) => {
62 $(
63 #[cfg(any(
64 feature = "__rustls",
65 feature = "s2n-tls",
66 ))]
67 #[cfg_attr(docsrs, doc(cfg(any(
68 feature = "__rustls",
69 feature = "s2n-tls",
70 ))))]
71 $item
72 )*
73 }
74 }
75
76 /// Any rustls provider enabled
77 macro_rules! cfg_rustls {
78 ($($item:item)*) => {
79 $(
80 #[cfg(feature = "__rustls")]
81 #[cfg_attr(docsrs, doc(cfg(feature = "__rustls")))]
82 $item
83 )*
84 }
85 }
86
87 macro_rules! cfg_s2n_tls {
88 ($($item:item)*) => {
89 $(
90 #[cfg(feature = "s2n-tls")]
91 #[cfg_attr(docsrs, doc(cfg(feature = "s2n-tls")))]
92 $item
93 )*
94 }
95 }
96
97 pub(crate) use cfg_rustls;
98 pub(crate) use cfg_s2n_tls;
99 pub(crate) use cfg_tls;
100}