Skip to content

Conversation

daxpedda
Copy link
Collaborator

This PR changes dependencies to be more careful about the default features enabled.
Now HTTP/1 and HTTP/2 are enabled by default but can be disabled if so desired.
There is also now a way to set the server to only enable one of the two protocols.

This would re-open #80 and I have no clue how to solve that without a major redesign of the public API.
The only easier way that comes to mind is cloning the ServerConfig and then modifying the ALPN if it doesn't match while handling the Acceptor.

I will leave this open until the next version upgrade.

@programatik29
Copy link
Owner

I have no clue how to solve that without a major redesign of the public API.

Me either.

Comment on lines -127 to -129
/// Returns a mutable reference to the Http builder.
pub fn http_builder(&mut self) -> &mut Builder<TokioExecutor> {
&mut self.builder
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to see this API remain available, as I use it to configure many settings for both HTTP/1 and HTTP/2 👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea here is to expose anything Builder exposes through axum-servers interface.
What method exactly are you unable to access with the new API?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I don't see how I would access these:

serve
    .http_builder()
    .http1()
    .timer(hyper_util::rt::TokioTimer::new())
    .keep_alive(true)
    .header_read_timeout(Duration::from_secs(5))
    .max_buf_size(32768)
    .http2()
    .timer(hyper_util::rt::TokioTimer::new())
    .keep_alive_interval(Duration::from_secs(16))
    .keep_alive_timeout(Duration::from_secs(5))
    .max_header_list_size(512 * 1024)
    .max_send_buf_size(64 * 1024)
    .max_concurrent_streams(16);

Copy link
Collaborator Author

@daxpedda daxpedda Aug 19, 2024

Choose a reason for hiding this comment

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

Ah yes, I assume if we expose Builder::http1() and Builder::http2() this would cover all the methods you have listed?
The PR should probably be in draft mode.

Choose a reason for hiding this comment

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

I have an intermediate solution that does not breaks compatibility that can be used, see #156. Let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Glad it doesn't break compatibility. Still don't personally understand the API or the use-case but you have to convince the maintainer, not me ;)

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.

4 participants