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_auto_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#![cfg_attr(docsrs, feature(doc_cfg))]
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")]
46pub use client::{default_connector, tls, Builder, Connector, ConnectorBuilder};
47
48#[cfg(feature = "test-util")]
49pub mod test_util;
50
51mod error;
52pub use error::HttpClientError;
53
54#[allow(unused_macros, unused_imports)]
55#[macro_use]
56pub(crate) mod cfg {
57 /// Any TLS provider enabled
58 macro_rules! cfg_tls {
59 ($($item:item)*) => {
60 $(
61 #[cfg(any(
62 feature = "rustls-aws-lc",
63 feature = "rustls-aws-lc-fips",
64 feature = "rustls-ring",
65 feature = "s2n-tls",
66 ))]
67 #[cfg_attr(docsrs, doc(cfg(any(
68 feature = "rustls-aws-lc",
69 feature = "rustls-aws-lc-fips",
70 feature = "rustls-ring",
71 feature = "s2n-tls",
72 ))))]
73 $item
74 )*
75 }
76 }
77
78 /// Any rustls provider enabled
79 macro_rules! cfg_rustls {
80 ($($item:item)*) => {
81 $(
82 #[cfg(any(
83 feature = "rustls-aws-lc",
84 feature = "rustls-aws-lc-fips",
85 feature = "rustls-ring"
86 ))]
87 #[cfg_attr(docsrs, doc(cfg(any(feature = "rustls-aws-lc", feature = "rustls-aws-lc-fips", feature = "rustls-ring"))))]
88 $item
89 )*
90 }
91 }
92
93 macro_rules! cfg_s2n_tls {
94 ($($item:item)*) => {
95 $(
96 #[cfg(feature = "s2n-tls")]
97 #[cfg_attr(docsrs, doc(cfg(feature = "s2n-tls")))]
98 $item
99 )*
100 }
101 }
102
103 pub(crate) use cfg_rustls;
104 pub(crate) use cfg_s2n_tls;
105 pub(crate) use cfg_tls;
106}