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

http version negotiation #16100

Closed
wants to merge 6 commits into from
Closed

http version negotiation #16100

wants to merge 6 commits into from

Conversation

icing
Copy link
Contributor

@icing icing commented Jan 27, 2025

Translate the data->set.httpwant which is one of the consts from the public API (CURL_HTTP_VERSION_*) into a major version mask plus additional flags for internal handling.

Curl_http_neg_init() does the translation and flags setting in http.c, using new internal consts CURL_HTTP_V1x, CURL_HTTP_V2x and CURL_HTTP_V3x for the major versions. The flags are

  • only_10: when the application explicity asked fro HTTP/1.0
  • h2_upgrade: when the application asks for upgrading 1.1 to 2.
  • h2_prior_knowledge: when directly talking h2 without ALPN
  • accept_09: when a HTTP/0.9 response is acceptable.

The Alt-Svc and HTTPS RR redirections from one ALPN to another obey the allowed major versions. If a transfer has only h3 enabled, Alt-Svc redirection to h2 is ignored.

This is the current implementation. It can be debated if Alt-Svc should be able to override the allowed major versions. Added test_12_06 to verify the current restriction.

icing added a commit to icing/curl that referenced this pull request Jan 28, 2025
based on curl#16100

Add a 'wanted' major HTTP version bitmask next to the 'allowed'
bitmask in HTTP version negotiation. This will try connections
as specified in 'wanted', but enabled Alt-Svc and HTTPS-RR to
redirect to other major HTTP versions, if those are 'allowed'.

Changes libcurl internal default to `CURL_HTTP_VERSION_NONE`
and removes the code in curl that sets  `CURL_HTTP_VERSION_2TLS`
if the command line does not say anything else.
icing added a commit to icing/curl that referenced this pull request Jan 29, 2025
based on curl#16100

Add a 'wanted' major HTTP version bitmask next to the 'allowed'
bitmask in HTTP version negotiation. This will try connections
as specified in 'wanted', but enabled Alt-Svc and HTTPS-RR to
redirect to other major HTTP versions, if those are 'allowed'.

Changes libcurl internal default to `CURL_HTTP_VERSION_NONE`
and removes the code in curl that sets  `CURL_HTTP_VERSION_2TLS`
if the command line does not say anything else.
@testclutch
Copy link

Analysis of PR #16100 at 656c0da2:

Test http/test_09_push.py::TestPush::test_09_02_h2_push failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 1192 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 1198 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 1199 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 1916 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 2202 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

Test 2205 failed, which has NOT been flaky recently, so there could be a real issue in this PR.

There are more failures, but that's enough from Gha.

Generated by Testclutch

Translate the `data->set.httpwant` which is one of the consts from
the public API (CURL_HTTP_VERSION_*) into a major version mask
plus additional flags for internal handling.

`Curl_http_neg_init()` does the translation and flags setting
in http.c, using new internal consts CURL_HTTP_V1x, CURL_HTTP_V2x
and CURL_HTTP_V3x for the major versions. The flags are

- only_10: when the application explicity asked fro HTTP/1.0
- h2_upgrade: when the application asks for upgrading 1.1 to 2.
- h2_prior_knowledge: when directly talking h2 without ALPN
- accept_09: when a HTTP/0.9 response is acceptable.

The Alt-Svc and HTTPS RR redirections from one ALPN to
another obey the allowed major versions. If a transfer
has only h3 enabled, Alt-Svc redirection to h2 is ignored.

This is the current implementation. It can be debated if Alt-Svc
should be able to override the allowed major versions.
Added test_12_06 to verify the current restriction.
@icing icing requested a review from bagder February 18, 2025 11:07
@bagder bagder closed this in db72b8d Feb 18, 2025
icing added a commit to icing/curl that referenced this pull request Feb 20, 2025
based on curl#16100

Add a 'wanted' major HTTP version bitmask next to the 'allowed'
bitmask in HTTP version negotiation. This will try connections
as specified in 'wanted', but enabled Alt-Svc and HTTPS-RR to
redirect to other major HTTP versions, if those are 'allowed'.

Changes libcurl internal default to `CURL_HTTP_VERSION_NONE`
and removes the code in curl that sets  `CURL_HTTP_VERSION_2TLS`
if the command line does not say anything else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants