feat(conn/auto): allow serving connection with upgrade after config #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
Thanks for this crate, I've been using it with axum since converting to hyper 1.0.
However I had been using it with default values, and after https://seanmonstar.com/blog/hyper-http2-continuation-flood/ I wanted to set max_header_list_size as suggested, and realized I couldn't call .serve_connection_with_upgrades with that (I've seen
serve_connection().with_upgrades()
in another part of the code but that doesn't seem to make sense with this one that returns a futureResult<()>
-- and not using with_upgrades means I cannot create websockets anymore so that's not an option either)Happy to rework it otherwise, or if that's easier let someone else implement something different (or just tell me I could use xyz in my code!) and drop this.
Cheers,
When using hyper_util::server::conn::auto::Builder, if one wants to set http1 or http2 options one has to specialize the struct into Http1Builder or Http2Builder with .http1()/.http2() methods.
However, once the struct has been specialized there is no way to go back to the inner Builder to call serve_connection_with_upgrades(): one would need to either add make inner public, add an inner() method to get it back, or add a stub that just calls the method on inner like we have with serve_connection().
Since we already had one for serve_connection(), add an indentical one for serve_connection_with_upgrades()
Note that it does not make sense for serve_connection_with_upgrades() to be called without the http feature (I think?), so it has only been implemented for http1 if the http2 feature is set.