aws-smithy-http-server - http/1 support#4373
Conversation
rust-runtime/aws-smithy-http-server/benches/compare_hyper_versions.rs
Outdated
Show resolved
Hide resolved
| // The listener limits concurrent connections to 100. | ||
| // Once 100 connections are active, new connections will wait at the OS level | ||
| // until an existing connection completes. | ||
| let listener = TcpListener::bind("0.0.0.0:3000").await?.limit_connections(100); |
There was a problem hiding this comment.
huh...I wonder if we want an extension trait here or something more explicit.
There was a problem hiding this comment.
It comes from ListenerExt imported at the top—happy to hear what you had in mind for making it more explicit.
There was a problem hiding this comment.
On second thought, let's remove this example. Examples should focus specifically on demonstrating functionality that is related to aws-smithy-http-server rather than other types.
rust-runtime/aws-smithy-http-server/examples/request_concurrency_limiting.rs
Outdated
Show resolved
Hide resolved
rust-runtime/aws-smithy-http-server/examples/serve_comparison.rs
Outdated
Show resolved
Hide resolved
| #![cfg_attr( | ||
| not(feature = "request-id"), | ||
| allow(unused_imports, dead_code, unreachable_code) | ||
| )] |
There was a problem hiding this comment.
I think you can cfg out the entire example? Or can you not because its an example and not a module?
There was a problem hiding this comment.
We keep the example visible because users might try to run it without the feature flag. In that case, we print helpful guidance via eprintln!('cargo run --example request_id --features request-id'). Not everyone will know they need to enable the feature flag initially, so this provides better user experience.
|
rust-runtime/cargo.lock is deleted which is presumably unintentional |
This PR migrates
aws-smithy-http-serverfromhttp@0.x/hyper@0.14tohttp@1.x/hyper@1.x.Background
This is the second PR in the HTTP 1.x migration series:
aws-smithy-legacy-httpandaws-smithy-legacy-http-serverforhttp@0.xsupportaws-smithy-http-servertohttp@1.x/hyper@1.xhttp-1xflag and conditional dependency logicKey Changes
1. Dependency Upgrades
0.2.9→1.x0.4.5→1.00.14.26→1.x(withserver,http1,http2features)0.1for server utilities (server-auto,server-graceful, etc.)0.1for body utilities0.3→0.60.8.4→0.17(for AWS Lambda support)Updated
aws-smithy-typesto usehttp-body-1-xfeature instead ofhttp-body-0-4-x.2. New
serveModuleAdded a comprehensive
servemodule (inspired byaxum::serve) that provides:serve(listener, service)functionListenertrait supporting TCP, Unix sockets, and custom transportslimit_connections()viaListenerExt.with_graceful_shutdown().configure_hyper()for protocol and performance tuningFiles:
src/serve/mod.rs(794 lines),src/serve/listener.rs(269 lines)3. API Updates Throughout
Updated all modules to work with
http@1.xAPIs:http-body@1.0traits (+176 lines)lambda_http@0.17(+299 lines)http@1.xerror types4. Comprehensive Testing
Migration Impact
Breaking Change: This updates the public API to use
http@1.xtypes (http::Request,http::Response, etc.).Users will need to:
http@1.xserve()API or update tohyper@1.xconnection APIsBenefits
servemodule provides simpler server setuphyper@1.xperformance improvementsTesting
Next Steps
The next PR will update the codegen to conditionally generate code that uses either:
aws-smithy-legacy-http-server(forhttp@0.x- default)aws-smithy-http-server(forhttp@1.x- whenhttp-1xflag enabled)