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

h2 crate still pulled in after disabling "http2" feature #2386

Closed
1 task done
w-flo opened this issue Dec 1, 2023 · 4 comments · Fixed by #2605
Closed
1 task done

h2 crate still pulled in after disabling "http2" feature #2386

w-flo opened this issue Dec 1, 2023 · 4 comments · Fixed by #2605
Labels
A-axum C-bug Category: This is a bug.

Comments

@w-flo
Copy link

w-flo commented Dec 1, 2023

  • I have looked for existing issues (including closed) about this

Bug Report

Version

├── axum v0.7.1
│   ├── axum-core v0.4.0
├── axum-extra v0.9.0
│   ├── axum v0.7.1 (*)
│   ├── axum-core v0.4.0 (*)

Platform

Linux [..] 6.2.0-36-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 4 10:14:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Description

The issue title says it all: After disabling the "http2" feature in axum, the h2 crate is still getting built in in the cargo build process if the "tokio" feature is enabled. I use these (and no hyper dep):

axum = { version = "0.7", default-features = false, features = ["http1", "tokio"] }
axum-extra = { version = "0.9", features = ["cookie"] }

Suspected cause

The reason for this unexpected behavior appears to be that hyper's "http2" feature is still enabled through the optional hyper-util dependency with the "server-auto" feature enabled, which is enabled in axum when enabling the "tokio" feature.

@davidpdrsn davidpdrsn added C-bug Category: This is a bug. A-axum labels Dec 1, 2023
@jplatte
Copy link
Member

jplatte commented Dec 8, 2023

Can confirm the suspected cause. I think this should likely be considered a bug in hyper-util (though unfortunately fixing it will be a breaking change).

@davidpdrsn
Copy link
Member

Moving issue to hyper-util (hyperium/hyper#3493) since we can't do anything about it from axum's side.

@w-flo
Copy link
Author

w-flo commented Feb 9, 2024

If I understand hyperium/hyper-util#80 correctly, hyper-util now supports enabling just the server feature with http1, which would still make the auto builder available without http2 support.

So if I got that right, axum could now drop the server-auto feature in hyper-util. I think the http1 and http2 features in axum would then need to enable hyper-util?/http1 and hyper-util?/http2, respectively.

@davidpdrsn
Copy link
Member

Yes it should be possible to fix now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-axum C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants