Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http = "1.0" support to the http request wrapper #3373

Merged
merged 7 commits into from
Jan 25, 2024
Merged

Conversation

rcoh
Copy link
Collaborator

@rcoh rcoh commented Jan 17, 2024

Motivation and Context

Description

Add try_from and try_into for HTTP 1.x to the HTTP request/response wrapper. This is a stepping stone en route to supporting Hyper 1.0

Testing

  • New unit tests

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rcoh rcoh requested a review from a team as a code owner January 17, 2024 21:47
- Requests are not creatible if extensions exist avoiding the cross-version extension issue.
- Response _were_ creatable. For responses, the wrapper will error if extensions existed and you attempt to cross convert Http versions.
@rcoh rcoh requested a review from a team as a code owner January 17, 2024 21:49
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Comment on lines 24 to +25
http = "0.2.9"
http1 = { package = "http", version = "1" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these both be optional dependencies enabled by the features?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe eventually? But they're both so small that the cost of having them both in tree is very small. When we refactor to use http 1.0 representations under the hood, we can make the http 0x dependency optional

rust-runtime/aws-smithy-runtime-api/src/http/request.rs Outdated Show resolved Hide resolved
rust-runtime/aws-smithy-runtime-api/src/http/request.rs Outdated Show resolved Hide resolved
rust-runtime/aws-smithy-runtime-api/src/http/response.rs Outdated Show resolved Hide resolved
Ok(Self {
status: StatusCode::try_from(parts.status.as_u16()).expect("validated by http 0.x"),
body,
extensions_0x: http0::Extensions::new(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this allocate anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, internally I think it's an Option or something

@@ -53,7 +53,8 @@ pretty_assertions = "1.4.0"
tokio = { version = "1.25", features = ["macros", "rt", "rt-multi-thread", "test-util", "full"] }
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tracing-test = "0.2.1"
hyper_0_14 = { package = "hyper", version = "0.14.27",features = ["client", "server", "tcp", "http1", "http2"] }
hyper_0_14 = { package = "hyper", version = "0.14.27", features = ["client", "server", "tcp", "http1", "http2"] }
http1 = { package = "http", version = "1" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to name this dependency something like http1x to make it every so slightly less likely to be confused with the HTTP 1 vs. HTTP 2 protocol versions, although that may not make it much better 🤔

Co-authored-by: John DiSanti <jdisanti@amazon.com>
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh disabled auto-merge January 24, 2024 19:04
@rcoh rcoh enabled auto-merge January 25, 2024 15:20
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@rcoh rcoh added this pull request to the merge queue Jan 25, 2024
Merged via the queue into main with commit 8873666 Jan 25, 2024
41 checks passed
@rcoh rcoh deleted the http1x-support branch January 25, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants