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-aws-lc",
62 feature = "rustls-aws-lc-fips",
63 feature = "rustls-ring",
64 feature = "s2n-tls",
65 ))]
66 #[cfg_attr(docsrs, doc(cfg(any(
67 feature = "rustls-aws-lc",
68 feature = "rustls-aws-lc-fips",
69 feature = "rustls-ring",
70 feature = "s2n-tls",
71 ))))]
72 $item
73 )*
74 }
75 }
76
77 /// Any rustls provider enabled
78 macro_rules! cfg_rustls {
79 ($($item:item)*) => {
80 $(
81 #[cfg(any(
82 feature = "rustls-aws-lc",
83 feature = "rustls-aws-lc-fips",
84 feature = "rustls-ring"
85 ))]
86 #[cfg_attr(docsrs, doc(cfg(any(feature = "rustls-aws-lc", feature = "rustls-aws-lc-fips", feature = "rustls-ring"))))]
87 $item
88 )*
89 }
90 }
91
92 macro_rules! cfg_s2n_tls {
93 ($($item:item)*) => {
94 $(
95 #[cfg(feature = "s2n-tls")]
96 #[cfg_attr(docsrs, doc(cfg(feature = "s2n-tls")))]
97 $item
98 )*
99 }
100 }
101
102 pub(crate) use cfg_rustls;
103 pub(crate) use cfg_s2n_tls;
104 pub(crate) use cfg_tls;
105}