From cbab63c24e2d8d25b31246bc272a87967d84f074 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 16:41:25 -0500 Subject: [PATCH 1/6] Feature-gate http versions in aws-smithy-runtime-api --- aws/sdk/integration-tests/ec2/Cargo.toml | 2 +- .../codegen/core/rustlang/CargoDependency.kt | 2 +- .../aws-smithy-http-server/Cargo.toml | 2 +- rust-runtime/aws-smithy-http/Cargo.toml | 2 +- .../aws-smithy-runtime-api/Cargo.toml | 3 + .../aws-smithy-runtime-api/additional-ci | 5 ++ .../external-types-no-http.toml | 6 ++ .../src/client/interceptors/context.rs | 2 +- .../src/client/runtime_plugin.rs | 2 +- .../src/http/headers.rs | 6 ++ .../src/http/request.rs | 83 ++++++++++++++++--- .../src/http/response.rs | 5 +- 12 files changed, 100 insertions(+), 20 deletions(-) create mode 100644 rust-runtime/aws-smithy-runtime-api/external-types-no-http.toml diff --git a/aws/sdk/integration-tests/ec2/Cargo.toml b/aws/sdk/integration-tests/ec2/Cargo.toml index 7db6addb07..b019cd5014 100644 --- a/aws/sdk/integration-tests/ec2/Cargo.toml +++ b/aws/sdk/integration-tests/ec2/Cargo.toml @@ -10,7 +10,7 @@ publish = false aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] } aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async" } aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] } -aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client"] } +aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client", "http-02x"] } aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" } aws-sdk-ec2 = { path = "../../build/aws-sdk/sdk/ec2", features = ["behavior-version-latest"] } tokio = { version = "1.23.1", features = ["full"]} diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt index 1a858be198..76f368fa8f 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt @@ -305,7 +305,7 @@ data class CargoDependency( .withFeature("client") fun smithyRuntimeTestUtil(runtimeConfig: RuntimeConfig) = smithyRuntime(runtimeConfig).toDevDependency().withFeature("test-util") fun smithyRuntimeApi(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-runtime-api") - fun smithyRuntimeApiClient(runtimeConfig: RuntimeConfig) = smithyRuntimeApi(runtimeConfig).withFeature("client") + fun smithyRuntimeApiClient(runtimeConfig: RuntimeConfig) = smithyRuntimeApi(runtimeConfig).withFeature("client").withFeature("http-02x") fun smithyRuntimeApiTestUtil(runtimeConfig: RuntimeConfig) = smithyRuntimeApi(runtimeConfig).toDevDependency().withFeature("test-util") fun smithyTypes(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-types") diff --git a/rust-runtime/aws-smithy-http-server/Cargo.toml b/rust-runtime/aws-smithy-http-server/Cargo.toml index b686cb615a..fbfcd89998 100644 --- a/rust-runtime/aws-smithy-http-server/Cargo.toml +++ b/rust-runtime/aws-smithy-http-server/Cargo.toml @@ -21,7 +21,7 @@ request-id = ["dep:uuid"] async-trait = "0.1" aws-smithy-http = { path = "../aws-smithy-http", features = ["rt-tokio"] } aws-smithy-json = { path = "../aws-smithy-json" } -aws-smithy-runtime-api = { path = "../aws-smithy-runtime-api" } +aws-smithy-runtime-api = { path = "../aws-smithy-runtime-api", features = ["http-02x"] } aws-smithy-types = { path = "../aws-smithy-types", features = ["http-body-0-4-x", "hyper-0-14-x"] } aws-smithy-xml = { path = "../aws-smithy-xml" } bytes = "1.1" diff --git a/rust-runtime/aws-smithy-http/Cargo.toml b/rust-runtime/aws-smithy-http/Cargo.toml index a5bc6f4d64..2517342b79 100644 --- a/rust-runtime/aws-smithy-http/Cargo.toml +++ b/rust-runtime/aws-smithy-http/Cargo.toml @@ -16,7 +16,7 @@ rt-tokio = ["aws-smithy-types/rt-tokio"] [dependencies] aws-smithy-eventstream = { path = "../aws-smithy-eventstream", optional = true } -aws-smithy-runtime-api = { path = "../aws-smithy-runtime-api", features = ["client"] } +aws-smithy-runtime-api = { path = "../aws-smithy-runtime-api", features = ["client", "http-02x"] } aws-smithy-types = { path = "../aws-smithy-types", features = ["byte-stream-poll-next", "http-body-0-4-x"] } bytes = "1" bytes-utils = "0.1" diff --git a/rust-runtime/aws-smithy-runtime-api/Cargo.toml b/rust-runtime/aws-smithy-runtime-api/Cargo.toml index 3f6a96b518..003654b394 100644 --- a/rust-runtime/aws-smithy-runtime-api/Cargo.toml +++ b/rust-runtime/aws-smithy-runtime-api/Cargo.toml @@ -14,12 +14,15 @@ default = [] client = [] http-auth = ["dep:zeroize"] test-util = ["aws-smithy-types/test-util"] +http-02x = [] +http-1x = [] [dependencies] aws-smithy-async = { path = "../aws-smithy-async" } aws-smithy-types = { path = "../aws-smithy-types" } bytes = "1" http = "0.2.9" +http1 = { package = "http", version = "1" } pin-project-lite = "0.2" tokio = { version = "1.25", features = ["sync"] } tracing = "0.1" diff --git a/rust-runtime/aws-smithy-runtime-api/additional-ci b/rust-runtime/aws-smithy-runtime-api/additional-ci index b44c6c05be..c27a031c39 100755 --- a/rust-runtime/aws-smithy-runtime-api/additional-ci +++ b/rust-runtime/aws-smithy-runtime-api/additional-ci @@ -8,5 +8,10 @@ set -e +# NOTE: (rcoh) This seems to be pulling in workspace settings that pull in this dependency, but it passes if +# no other crates enable this dependency +# echo "### Checking external types w/ HTTP feature disabled" +# RUSTDOCFLAGS="" cargo +"${RUST_NIGHTLY_VERSION}" check-external-types --config external-types-no-http.toml --no-default-features + echo "### Testing every combination of features (excluding --all-features)" cargo hack test --feature-powerset --exclude-all-features diff --git a/rust-runtime/aws-smithy-runtime-api/external-types-no-http.toml b/rust-runtime/aws-smithy-runtime-api/external-types-no-http.toml new file mode 100644 index 0000000000..a58f0caeda --- /dev/null +++ b/rust-runtime/aws-smithy-runtime-api/external-types-no-http.toml @@ -0,0 +1,6 @@ +allowed_external_types = [ + "aws_smithy_async::*", + "aws_smithy_types::*", + + "bytes::bytes::Bytes", +] diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs index c7054c11c7..5d406bf846 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/interceptors/context.rs @@ -467,7 +467,7 @@ impl fmt::Display for RewindResult { } } -#[cfg(all(test, feature = "test-util"))] +#[cfg(all(test, feature = "test-util", feature = "http-02x"))] mod tests { use super::*; use aws_smithy_types::body::SdkBody; diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs b/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs index 757224051d..53812097f7 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin.rs @@ -297,7 +297,7 @@ impl RuntimePlugins { } } -#[cfg(all(test, feature = "test-util"))] +#[cfg(all(test, feature = "test-util", feature = "http-02x"))] mod tests { use super::{RuntimePlugin, RuntimePlugins}; use crate::client::http::{ diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs index 70361a1d86..2b2a0d8412 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs @@ -156,6 +156,7 @@ impl Headers { } } +#[cfg(feature = "http-02x")] impl TryFrom for Headers { type Error = HttpError; @@ -284,6 +285,11 @@ mod header_value { pub(crate) fn into_http02x(self) -> http0::HeaderValue { self._private } + + #[allow(dead_code)] + pub(crate) fn into_http1x(self) -> http1::HeaderValue { + http1::HeaderValue::from_bytes(self._private.as_bytes()).expect("proven valid") + } } impl AsRef for HeaderValue { diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs index e36f0bf28a..250a1a502e 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs @@ -30,7 +30,8 @@ pub struct Request { body: B, uri: Uri, method: Method, - extensions: Extensions, + extensions_02x: Extensions, + extensions_1x: http1::Extensions, headers: Headers, } @@ -77,6 +78,13 @@ impl Uri { pub fn query(&self) -> Option<&str> { self.parsed.query() } + + fn from_http0x_uri(uri: http0::Uri) -> Self { + Self { + as_string: uri.to_string(), + parsed: uri, + } + } } fn merge_paths(endpoint_path: Option, uri: &http0::Uri) -> Cow<'_, str> { @@ -119,15 +127,14 @@ impl<'a> TryFrom<&'a str> for Uri { } } +#[cfg(feature = "http-02x")] impl From for Uri { fn from(value: http::Uri) -> Self { - Self { - as_string: value.to_string(), - parsed: value, - } + Uri::from_http0x_uri(value) } } +#[cfg(feature = "http-02x")] impl TryInto> for Request { type Error = HttpError; @@ -136,11 +143,21 @@ impl TryInto> for Request { } } +#[cfg(feature = "http-1x")] +impl TryInto> for Request { + type Error = HttpError; + + fn try_into(self) -> Result, Self::Error> { + self.try_into_http_1x() + } +} + impl Request { /// Converts this request into an http 0.x request. /// /// Depending on the internal storage type, this operation may be free or it may have an internal /// cost. + #[cfg(feature = "http-02x")] pub fn try_into_http02x(self) -> Result, HttpError> { let mut req = http::Request::builder() .uri(self.uri.parsed) @@ -148,6 +165,7 @@ impl Request { .body(self.body) .expect("known valid"); let mut headers = HeaderMap::new(); + headers.reserve(self.headers.headers.len()); headers.extend( self.headers .headers @@ -155,7 +173,33 @@ impl Request { .map(|(k, v)| (k, v.into_http02x())), ); *req.headers_mut() = headers; - *req.extensions_mut() = self.extensions; + *req.extensions_mut() = self.extensions_02x; + Ok(req) + } + + /// Converts this request into an http 1.x request. + /// + /// Depending on the internal storage type, this operation may be free or it may have an internal + /// cost. + #[cfg(feature = "http-1x")] + pub fn try_into_http_1x(self) -> Result, HttpError> { + let mut req = http1::Request::builder() + .uri(self.uri.as_string) + .method(self.method.as_str()) + .body(self.body) + .expect("known valid"); + let mut headers = http1::HeaderMap::new(); + headers.reserve(self.headers.headers.len()); + headers.extend(self.headers.headers.into_iter().map(|(k, v)| { + ( + k.map(|n| { + http1::HeaderName::from_bytes(n.as_str().as_bytes()).expect("proven valid") + }), + v.into_http1x(), + ) + })); + *req.headers_mut() = headers; + *req.extensions_mut() = self.extensions_1x; Ok(req) } @@ -165,7 +209,8 @@ impl Request { body: f(self.body), uri: self.uri, method: self.method, - extensions: self.extensions, + extensions_02x: self.extensions_02x, + extensions_1x: self.extensions_1x, headers: self.headers, } } @@ -174,9 +219,10 @@ impl Request { pub fn new(body: B) -> Self { Self { body, - uri: Uri::from(http0::Uri::from_static("/")), + uri: Uri::from_http0x_uri(http0::Uri::from_static("/")), method: Method::GET, - extensions: Default::default(), + extensions_02x: Default::default(), + extensions_1x: Default::default(), headers: Default::default(), } } @@ -242,13 +288,16 @@ impl Request { /// Adds an extension to the request extensions pub fn add_extension(&mut self, extension: T) { - self.extensions.insert(extension); + self.extensions_02x.insert(extension.clone()); + self.extensions_1x.insert(extension.clone()); } } impl Request { /// Attempts to clone this request /// + /// On clone, any extensions will be cleared. + /// /// If the body is cloneable, this will clone the request. Otherwise `None` will be returned pub fn try_clone(&self) -> Option { let body = self.body().try_clone()?; @@ -256,7 +305,8 @@ impl Request { body, uri: self.uri.clone(), method: self.method.clone(), - extensions: Extensions::new(), + extensions_02x: Extensions::new(), + extensions_1x: http1::Extensions::new(), headers: self.headers.clone(), }) } @@ -279,23 +329,30 @@ impl Request { } } +#[cfg(feature = "http-02x")] impl TryFrom> for Request { type Error = HttpError; fn try_from(value: http::Request) -> Result { let (parts, body) = value.into_parts(); let headers = Headers::try_from(parts.headers)?; + if !parts.extensions.is_empty() { + return Err(HttpError::new( + "Cannot convert non-empty extensions. Clear extensions before converting", + )); + } Ok(Self { body, uri: parts.uri.into(), method: parts.method.clone(), - extensions: parts.extensions, + extensions_02x: http::Extensions::new(), + extensions_1x: http1::Extensions::new(), headers, }) } } -#[cfg(test)] +#[cfg(all(test, feature = "http-02x"))] mod test { use super::*; use aws_smithy_types::body::SdkBody; diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/response.rs b/rust-runtime/aws-smithy-runtime-api/src/http/response.rs index a32b3ee415..c9ed6589d9 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/response.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/response.rs @@ -49,6 +49,7 @@ impl TryFrom for StatusCode { } } +#[cfg(feature = "http-02x")] impl From for StatusCode { fn from(value: http0::StatusCode) -> Self { Self(value.as_u16()) @@ -81,6 +82,7 @@ impl Response { /// /// Depending on the internal storage type, this operation may be free or it may have an internal /// cost. + #[cfg(feature = "http-02x")] pub fn try_into_http02x(self) -> Result, HttpError> { let mut res = http::Response::builder() .status( @@ -169,6 +171,7 @@ impl Response { } } +#[cfg(feature = "http-02x")] impl TryFrom> for Response { type Error = HttpError; @@ -201,7 +204,7 @@ impl TryFrom> for Response { } } -#[cfg(test)] +#[cfg(all(test, feature = "http-02x"))] mod test { use super::*; use aws_smithy_types::body::SdkBody; From 8d45811e49ece78161fd1317fdbb1d6ab73fa2f2 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 16:56:38 -0500 Subject: [PATCH 2/6] Fix Clippy --- rust-runtime/aws-smithy-runtime-api/src/http/headers.rs | 1 + rust-runtime/aws-smithy-runtime-api/src/http/request.rs | 6 +++--- rust-runtime/aws-smithy-runtime-api/src/http/response.rs | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs index 2b2a0d8412..8ef9d6f5a5 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs @@ -282,6 +282,7 @@ mod header_value { Ok(Self { _private: value }) } + #[allow(dead_code)] pub(crate) fn into_http02x(self) -> http0::HeaderValue { self._private } diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs index 250a1a502e..fa2fa8cd8a 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs @@ -10,7 +10,7 @@ use crate::http::HttpError; use aws_smithy_types::body::SdkBody; use http as http0; use http0::uri::PathAndQuery; -use http0::{Extensions, HeaderMap, Method}; +use http0::{Extensions, Method}; use std::borrow::Cow; /// Parts struct useful for structural decomposition that the [`Request`] type can be converted into. @@ -164,7 +164,7 @@ impl Request { .method(self.method) .body(self.body) .expect("known valid"); - let mut headers = HeaderMap::new(); + let mut headers = http0::HeaderMap::new(); headers.reserve(self.headers.headers.len()); headers.extend( self.headers @@ -289,7 +289,7 @@ impl Request { /// Adds an extension to the request extensions pub fn add_extension(&mut self, extension: T) { self.extensions_02x.insert(extension.clone()); - self.extensions_1x.insert(extension.clone()); + self.extensions_1x.insert(extension); } } diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/response.rs b/rust-runtime/aws-smithy-runtime-api/src/http/response.rs index c9ed6589d9..84ad832758 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/response.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/response.rs @@ -5,10 +5,9 @@ //! Http Response Types -use crate::http::{HeaderValue, Headers, HttpError}; +use crate::http::{Headers, HttpError}; use aws_smithy_types::body::SdkBody; use http as http0; -use http0::{Extensions, HeaderMap}; use std::fmt; /// HTTP response status code @@ -74,7 +73,7 @@ pub struct Response { status: StatusCode, headers: Headers, body: B, - extensions: Extensions, + extensions: http0::Extensions, } impl Response { @@ -91,7 +90,7 @@ impl Response { ) .body(self.body) .expect("known valid"); - let mut headers = HeaderMap::new(); + let mut headers = http0::HeaderMap::new(); headers.extend( self.headers .headers @@ -176,6 +175,8 @@ impl TryFrom> for Response { type Error = HttpError; fn try_from(value: http0::Response) -> Result { + use crate::http::headers::HeaderValue; + use http0::HeaderMap; if let Some(e) = value .headers() .values() From 0bb183f9f55891082dfef219f5e47d8d03a998cb Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 17:01:24 -0500 Subject: [PATCH 3/6] Back out changes to add Http1x for simplicity --- .../aws-smithy-runtime-api/Cargo.toml | 2 - .../src/http/request.rs | 46 ++----------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/rust-runtime/aws-smithy-runtime-api/Cargo.toml b/rust-runtime/aws-smithy-runtime-api/Cargo.toml index 003654b394..3e7415448b 100644 --- a/rust-runtime/aws-smithy-runtime-api/Cargo.toml +++ b/rust-runtime/aws-smithy-runtime-api/Cargo.toml @@ -15,14 +15,12 @@ client = [] http-auth = ["dep:zeroize"] test-util = ["aws-smithy-types/test-util"] http-02x = [] -http-1x = [] [dependencies] aws-smithy-async = { path = "../aws-smithy-async" } aws-smithy-types = { path = "../aws-smithy-types" } bytes = "1" http = "0.2.9" -http1 = { package = "http", version = "1" } pin-project-lite = "0.2" tokio = { version = "1.25", features = ["sync"] } tracing = "0.1" diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs index fa2fa8cd8a..652ee8cbe3 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs @@ -31,7 +31,6 @@ pub struct Request { uri: Uri, method: Method, extensions_02x: Extensions, - extensions_1x: http1::Extensions, headers: Headers, } @@ -143,15 +142,6 @@ impl TryInto> for Request { } } -#[cfg(feature = "http-1x")] -impl TryInto> for Request { - type Error = HttpError; - - fn try_into(self) -> Result, Self::Error> { - self.try_into_http_1x() - } -} - impl Request { /// Converts this request into an http 0.x request. /// @@ -177,32 +167,6 @@ impl Request { Ok(req) } - /// Converts this request into an http 1.x request. - /// - /// Depending on the internal storage type, this operation may be free or it may have an internal - /// cost. - #[cfg(feature = "http-1x")] - pub fn try_into_http_1x(self) -> Result, HttpError> { - let mut req = http1::Request::builder() - .uri(self.uri.as_string) - .method(self.method.as_str()) - .body(self.body) - .expect("known valid"); - let mut headers = http1::HeaderMap::new(); - headers.reserve(self.headers.headers.len()); - headers.extend(self.headers.headers.into_iter().map(|(k, v)| { - ( - k.map(|n| { - http1::HeaderName::from_bytes(n.as_str().as_bytes()).expect("proven valid") - }), - v.into_http1x(), - ) - })); - *req.headers_mut() = headers; - *req.extensions_mut() = self.extensions_1x; - Ok(req) - } - /// Update the body of this request to be a new body. pub fn map(self, f: impl Fn(B) -> U) -> Request { Request { @@ -210,7 +174,6 @@ impl Request { uri: self.uri, method: self.method, extensions_02x: self.extensions_02x, - extensions_1x: self.extensions_1x, headers: self.headers, } } @@ -222,7 +185,6 @@ impl Request { uri: Uri::from_http0x_uri(http0::Uri::from_static("/")), method: Method::GET, extensions_02x: Default::default(), - extensions_1x: Default::default(), headers: Default::default(), } } @@ -289,7 +251,6 @@ impl Request { /// Adds an extension to the request extensions pub fn add_extension(&mut self, extension: T) { self.extensions_02x.insert(extension.clone()); - self.extensions_1x.insert(extension); } } @@ -306,7 +267,6 @@ impl Request { uri: self.uri.clone(), method: self.method.clone(), extensions_02x: Extensions::new(), - extensions_1x: http1::Extensions::new(), headers: self.headers.clone(), }) } @@ -336,17 +296,17 @@ impl TryFrom> for Request { fn try_from(value: http::Request) -> Result { let (parts, body) = value.into_parts(); let headers = Headers::try_from(parts.headers)?; - if !parts.extensions.is_empty() { + // we need to do this eventually. + /*if !parts.extensions.is_empty() { return Err(HttpError::new( "Cannot convert non-empty extensions. Clear extensions before converting", )); - } + }*/ Ok(Self { body, uri: parts.uri.into(), method: parts.method.clone(), extensions_02x: http::Extensions::new(), - extensions_1x: http1::Extensions::new(), headers, }) } From 51405f61de0b8aa6cf21fc5dc12e74193d3b105a Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 17:05:04 -0500 Subject: [PATCH 4/6] Changelog --- CHANGELOG.next.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 864e324bdf..3e0bec7c41 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -116,3 +116,9 @@ message = "Types/functions that were previously `#[doc(hidden)]` in `aws-config` references = ["smithy-rs#3226"] meta = { "breaking" = false, "tada" = false, "bug" = false } author = "ysaito1001" + +[[smithy-rs]] +message = "Conversions for HTTP request in aws-smithy-runtime-api are now feature gated behind the `http-02x` feature" +references = ["smithy-rs#3236"] +meta = { "breaking" = true, "tada" = false, "bug" = false } +author = "rcoh" From d2f11261150adde8f835684712568f6c0844fc99 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 17:08:02 -0500 Subject: [PATCH 5/6] remove lingering reference --- rust-runtime/aws-smithy-runtime-api/src/http/headers.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs index 8ef9d6f5a5..0a2dfd617e 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/headers.rs @@ -286,11 +286,6 @@ mod header_value { pub(crate) fn into_http02x(self) -> http0::HeaderValue { self._private } - - #[allow(dead_code)] - pub(crate) fn into_http1x(self) -> http1::HeaderValue { - http1::HeaderValue::from_bytes(self._private.as_bytes()).expect("proven valid") - } } impl AsRef for HeaderValue { From 3e7b01e910de7cdf02d5194eaf72a1d54890aca4 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 17 Nov 2023 17:23:07 -0500 Subject: [PATCH 6/6] Clippy again --- rust-runtime/aws-smithy-runtime-api/src/http/request.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs index 652ee8cbe3..ee87e57f1d 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/http/request.rs @@ -250,7 +250,7 @@ impl Request { /// Adds an extension to the request extensions pub fn add_extension(&mut self, extension: T) { - self.extensions_02x.insert(extension.clone()); + self.extensions_02x.insert(extension); } } @@ -305,7 +305,7 @@ impl TryFrom> for Request { Ok(Self { body, uri: parts.uri.into(), - method: parts.method.clone(), + method: parts.method, extensions_02x: http::Extensions::new(), headers, })