Unverified Commit c6193bd3 authored by Josh Triplett's avatar Josh Triplett Committed by GitHub
Browse files

`aws-config`: Fix compilation error with `rustls` and `native-tls` disabled (#1533)



* `aws-config`: Fix compilation error with `rustls` and `native-tls` disabled

The `ProviderConfig::with_tcp_connector` method uses
`aws_smithy_client::hyper_ext`, which only exists with the
`client-hyper` feature enabled. Add a feature enabling that, and enable
it by default.

Introducing this feature does not cause breakage, because aws-config
did not previously compile with `default-features = false` and neither
`rustls` nor `native-tls` enabled.

* CHANGELOG.next.toml: Update for aws-config compilation fix

* Fix doctest by adding feature gate

Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
parent c220b03a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -11,6 +11,17 @@
# meta = { "breaking" = false, "tada" = false, "bug" = false }
# author = "rcoh"

[[aws-sdk-rust]]
message = """
Fix compilation of `aws-config` with `rustls` and `native-tls` disabled. The
`ProviderConfig::with_tcp_connector` method uses
`aws_smithy_client::hyper_ext`, which only exists with the `client-hyper`
feature enabled. Add a feature enabling that, and enable it by default.
"""
references = ["smithy-rs#1541"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "joshtriplett"

[[aws-sdk-rust]]
message = """
Add support for aws-chunked content encoding. Only single-chunk encoding is supported. Multiple chunks and
+4 −3
Original line number Diff line number Diff line
@@ -9,17 +9,18 @@ license = "Apache-2.0"
repository = "https://github.com/awslabs/smithy-rs"

[features]
client-hyper = ["aws-smithy-client/client-hyper"]
rustls = ["aws-smithy-client/rustls"]
native-tls = ["aws-smithy-client/native-tls"]
rt-tokio = ["aws-smithy-async/rt-tokio"]
rt-tokio = ["aws-smithy-async/rt-tokio", "tokio/rt"]

default = ["rustls", "rt-tokio"]
default = ["client-hyper", "rustls", "rt-tokio"]

[dependencies]
aws-sdk-sts = { path = "../../sdk/build/aws-sdk/sdk/sts", default-features = false }
aws-sdk-sso = { path = "../../sdk/build/aws-sdk/sdk/sso", default-features = false }
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async" }
aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client" }
aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client", default-features = false }
aws-smithy-types = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-types" }
aws-types = { path = "../../sdk/build/aws-sdk/sdk/aws-types" }
tokio = { version = "1", features = ["sync"] }
+1 −0
Original line number Diff line number Diff line
@@ -359,6 +359,7 @@ mod test {

    #[tokio::test]
    #[traced_test]
    #[cfg(feature = "client-hyper")]
    async fn no_providers_configured_err() {
        use aws_smithy_async::rt::sleep::TokioSleep;
        use aws_smithy_client::erase::boxclone::BoxCloneService;
+1 −0
Original line number Diff line number Diff line
@@ -330,6 +330,7 @@ mod loader {
        ///
        /// # Examples
        /// ```no_run
        /// # #[cfg(feature = "hyper-client")]
        /// # async fn docs() {
        /// use aws_config::provider_config::ProviderConfig;
        /// let custom_https_connector = hyper_rustls::HttpsConnectorBuilder::new().
+9 −7
Original line number Diff line number Diff line
@@ -13,14 +13,10 @@ use aws_types::{
    region::Region,
};

use std::error::Error;
use std::fmt::{Debug, Formatter};
use std::sync::Arc;

use crate::connector::default_connector;
use http::Uri;
use hyper::client::connect::Connection;
use tokio::io::{AsyncRead, AsyncWrite};

/// Configuration options for Credential Providers
///
@@ -239,13 +235,19 @@ impl ProviderConfig {
    ///
    /// # Stability
    /// This method may change to support HTTP configuration.
    #[cfg(feature = "client-hyper")]
    pub fn with_tcp_connector<C>(self, connector: C) -> Self
    where
        C: Clone + Send + Sync + 'static,
        C: tower::Service<Uri>,
        C::Response: Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
        C: tower::Service<http::Uri>,
        C::Response: hyper::client::connect::Connection
            + tokio::io::AsyncRead
            + tokio::io::AsyncWrite
            + Send
            + Unpin
            + 'static,
        C::Future: Unpin + Send + 'static,
        C::Error: Into<Box<dyn Error + Send + Sync + 'static>>,
        C::Error: Into<Box<dyn std::error::Error + Send + Sync + 'static>>,
    {
        let connector_fn = move |settings: &HttpSettings, sleep: Option<Arc<dyn AsyncSleep>>| {
            let mut builder = aws_smithy_client::hyper_ext::Adapter::builder()