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

Clarify 'conn->httpversion' #16073

Closed
wants to merge 7 commits into from
Closed

Conversation

icing
Copy link
Contributor

@icing icing commented Jan 22, 2025

The variable conn->httpversion was used for several purposes and it was unclear at which time the value represents what.

  • rename conn->httpversion to conn->httpversion_seen This makes clear that the variable only records the last HTTP version seen on the connection - if any. And that it no longer is an indication of what version to use.
  • Change Alt-Svc handling to no longer modify conn->httpversion but set data->state.httpwant for influencing the HTTP version to use on a transfer.
  • Add data->req.httpversion_sent to have a record of what HTTP version was sent in a request
  • Add connection filter type CF_TYPE_HTTP
  • Add filter query CF_QUERY_HTTP_VERSION to ask what HTTP filter version is in place
  • Lookup filters HTTP version instead of using conn->httpversion

Test test_12_05 now switches to HTTP/1.1 correctly and the expectations have been fixed.

Removed the connection fitler "is_httpN()" checks and using the version query instead.

The variable `conn->httpversion` was used for several
purposes and it was unclear at which time the value
represents what.

- rename `conn->httpversion` to `conn->httpversion_seen`
  This makes clear that the variable only records the last
  HTTP version seen on the connection - if any. And that it
  no longer is an indication of what version to use.
- Change Alt-Svc handling to no longer modify `conn->httpversion`
  but set `data->state.httpwant` for influencing the HTTP version
  to use on a transfer.
- Add `data->req.httpversion_sent` to have a record of what
  HTTP version was sent in a request
- Add connection filter type CF_TYPE_HTTP
- Add filter query `CF_QUERY_HTTP_VERSION` to ask what HTTP
  filter version is in place
- Lookup filters HTTP version instead of using `conn->httpversion`

Test test_12_05 now switches to HTTP/1.1 correctly and the
expectations have been fixed.

Removed the connection fitler "is_httpN()" checks and using
the version query instead.
@github-actions github-actions bot added the tests label Jan 22, 2025
@icing icing added HTTP HTTP/2 HTTP/3 h3 or quic related labels Jan 22, 2025
@icing icing requested a review from bagder January 23, 2025 09:31
lib/http_proxy.c Outdated Show resolved Hide resolved
@bagder bagder closed this in e83818c Jan 24, 2025
vszakats added a commit that referenced this pull request Feb 5, 2025
seen with gcc 4.4.0:
```
../../lib/cfilters.c: In function 'Curl_conn_http_version':
../../lib/cfilters.c:523: error: conversion to 'unsigned char' from 'int' may alter its value
```
Ref: https://github.com/curl/curl/actions/runs/13124120573/job/36616761121?pr=15975#step:9:20

Follow-up to e83818c #16073

Closes #16171
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.

2 participants