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

HttpsConnectorBuilder::enable_all_versions doesn't enable ALPN for http/1.1 #208

Closed
mmalenic opened this issue Jun 20, 2023 · 1 comment · Fixed by #224
Closed

HttpsConnectorBuilder::enable_all_versions doesn't enable ALPN for http/1.1 #208

mmalenic opened this issue Jun 20, 2023 · 1 comment · Fixed by #224

Comments

@mmalenic
Copy link

When building a HttpsConnectorBuilder using enable_all_versions, ALPN does not seem to be enabled with http/1.1, and only h2 is enabled:

self.0.tls_config.alpn_protocols = vec![b"h2".to_vec()];

However, calling enable_http1 followed by enable_http2 does enable ALPN for both versions.

This causes the client example to fail when using a http/1.1 server, and a client built with enable_all_versions.

For example, with mmalenic@863812f, running the following:

cargo run --example server
cargo run --example client --features http2 "https://localhost:1337" examples/sample.pem

Results in the error:

FAILED: Could not get: hyper::Error(Connect, Custom { kind: Other, error: Custom { kind: InvalidData, error: AlertReceived(NoApplicationProtocol) } })

Is this the intended behaviour?

cc @norling @dbampalikis @brainstorm

@mmalenic mmalenic changed the title HttpsConnectorBuilder::enable_all_versions doesn't enable ALPN for http/1.1. HttpsConnectorBuilder::enable_all_versions doesn't enable ALPN for http/1.1 Jun 20, 2023
@djc
Copy link
Member

djc commented Jun 21, 2023

That seems like clearly a bug! Reading this code I forget how this was intended to work. IIRC the enable_all_versions() PR lay dormant for a pretty long while, so it's possible it got misrebased (and, appears to lack a test).

If one of you is able to submit a PR to fix (and, ideally add a test similar to the existing tests), I'd be happy to review and get a new release out!

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 a pull request may close this issue.

2 participants