mirror of
https://github.com/curl/curl.git
synced 2026-08-26 01:33:33 +03:00
lib: clarify 'conn->httpversion'
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. Closes #16073
This commit is contained in:
parent
7e814c8717
commit
e83818cae1
21 changed files with 206 additions and 203 deletions
|
|
@ -98,6 +98,7 @@ class TestReuse:
|
|||
for s in r.stats:
|
||||
assert s['http_version'] == '3', f'{s}'
|
||||
|
||||
@pytest.mark.skipif(condition=not Env.have_h3(), reason="h3 not supported")
|
||||
def test_12_04_alt_svc_h3h2(self, env: Env, httpd, nghttpx):
|
||||
httpd.clear_extra_configs()
|
||||
httpd.reload()
|
||||
|
|
@ -115,11 +116,12 @@ class TestReuse:
|
|||
'--alt-svc', f'{asfile}',
|
||||
])
|
||||
r.check_response(count=count, http_status=200)
|
||||
# We expect the connection to be reused
|
||||
# We expect the connection to be reused and use HTTP/2
|
||||
assert r.total_connects == 1
|
||||
for s in r.stats:
|
||||
assert s['http_version'] == '2', f'{s}'
|
||||
|
||||
@pytest.mark.skipif(condition=not Env.have_h3(), reason="h3 not supported")
|
||||
def test_12_05_alt_svc_h3h1(self, env: Env, httpd, nghttpx):
|
||||
httpd.clear_extra_configs()
|
||||
httpd.reload()
|
||||
|
|
@ -137,9 +139,7 @@ class TestReuse:
|
|||
'--alt-svc', f'{asfile}',
|
||||
])
|
||||
r.check_response(count=count, http_status=200)
|
||||
# We expect the connection to be reused
|
||||
# We expect the connection to be reused and use HTTP/1.1
|
||||
assert r.total_connects == 1
|
||||
# When using http/1.1 from alt-svc, we ALPN-negotiate 'h2,http/1.1' anyway
|
||||
# which means our server gives us h2
|
||||
for s in r.stats:
|
||||
assert s['http_version'] == '2', f'{s}'
|
||||
assert s['http_version'] == '1.1', f'{s}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue