Skip to content

Commit cf292d5

Browse files
authored
Bump lambda_http dependency of aws-smithy-http-server to 0.8.0 (#2685) (#2691)
This is #2685 again, which was merged prematurely and reverted in #2690. This time we won't merge it until it's due time. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent 5126a61 commit cf292d5

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

CHANGELOG.next.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ message = "Code generation will abort if the `ignoreUnsupportedConstraints` code
8080
references = ["smithy-rs#2539"]
8181
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "server" }
8282
author = "david-perez"
83+
84+
[[smithy-rs]]
85+
message = "Bump dependency on `lambda_http` by `aws-smithy-http-server` to 0.8.0. This version of `aws-smithy-http-server` is only guaranteed to be compatible with 0.8.0, or semver-compatible versions of 0.8.0 of the `lambda_http` crate. It will not work with versions prior to 0.8.0 _at runtime_, making requests to your smithy-rs service unroutable, so please make sure you're running your service in a compatible configuration"
86+
author = "david-perez"
87+
references = ["smithy-rs#2676", "smithy-rs#2685"]
88+
meta = { "breaking" = true, "tada" = false, "bug" = false }

examples/pokemon-service-lambda/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tracing = "0.1"
1616
# `aws-smithy-http-server` is only guaranteed to be compatible with this
1717
# version of `lambda_http`, or semver-compatible versions of this version.
1818
# Depending on other versions of `lambda_http` may not work.
19-
lambda_http = "0.7.3"
19+
lambda_http = "0.8.0"
2020

2121
# Local paths
2222
aws-smithy-http-server = { path = "../../rust-runtime/aws-smithy-http-server", features = ["aws-lambda"] }

rust-runtime/aws-smithy-http-server-python/Cargo.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ hyper = { version = "0.14.20", features = ["server", "http1", "http2", "tcp", "s
2525
tls-listener = { version = "0.7.0", features = ["rustls", "hyper-h2"] }
2626
rustls-pemfile = "1.0.1"
2727
tokio-rustls = "0.24.0"
28-
lambda_http = { version = "0.7.1" }
29-
# There is a breaking change in `lambda_runtime` between `0.7.0` and `0.7.1`,
30-
# and `lambda_http` depends on `0.7` which by default resolves to `0.7.1` but in our CI
31-
# we are running `minimal-versions` which downgrades `lambda_runtime` to `0.7.0` and fails to compile
32-
# because of the breaking change. Here we are forcing it to use `lambda_runtime = 0.7.1`.
33-
lambda_runtime = { version = "0.7.1" }
28+
lambda_http = { version = "0.8.0" }
3429
num_cpus = "1.13.1"
3530
parking_lot = "0.12.1"
3631
pin-project-lite = "0.2"

rust-runtime/aws-smithy-http-server/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ futures-util = { version = "0.3.16", default-features = false }
2828
http = "0.2"
2929
http-body = "0.4"
3030
hyper = { version = "0.14.12", features = ["server", "http1", "http2", "tcp", "stream"] }
31-
lambda_http = { version = "0.7.1", optional = true }
32-
mime = "0.3"
31+
lambda_http = { version = "0.8.0", optional = true }
32+
mime = "0.3.4"
3333
nom = "7"
3434
pin-project-lite = "0.2"
3535
once_cell = "1.13"

rust-runtime/aws-smithy-http-server/src/routing/lambda_handler.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ where
5858
///
5959
/// [API Gateway Stage]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-stages.html
6060
fn convert_event(request: Request) -> HyperRequest {
61-
let raw_path = request.raw_http_path();
62-
let (mut parts, body) = request.into_parts();
63-
let mut path = String::from(parts.uri.path());
61+
let raw_path: &str = request.extensions().raw_http_path();
62+
let path: &str = request.uri().path();
6463

65-
if !raw_path.is_empty() && raw_path != path {
66-
path = raw_path;
64+
let (parts, body) = if !raw_path.is_empty() && raw_path != path {
65+
let mut path = raw_path.to_owned(); // Clone only when we need to strip out the stage.
66+
let (mut parts, body) = request.into_parts();
6767

6868
let uri_parts: uri::Parts = parts.uri.into();
6969
let path_and_query = uri_parts
@@ -81,7 +81,11 @@ fn convert_event(request: Request) -> HyperRequest {
8181
.path_and_query(path)
8282
.build()
8383
.expect("unable to construct new URI");
84-
}
84+
85+
(parts, body)
86+
} else {
87+
request.into_parts()
88+
};
8589

8690
let body = match body {
8791
lambda_http::Body::Empty => hyper::Body::empty(),

0 commit comments

Comments
 (0)