mirror of
https://github.com/curl/curl.git
synced 2026-08-24 10:33:31 +03:00
http: fix HTTP/2 handling of TE request header using "trailers"
A "TE" request header is allowed in HTTP/2 when it only carries the "trailers" value. RFC 9113 ch. 8.2.2. Check client supplied TE values for the "trailers" token and only pass that one in a HTTP/2 request. Add test_01_17 to verify. Fixes #17122 Reported-by: epicmkirzinger on github Closes #17128
This commit is contained in:
parent
ebe6612505
commit
1d66a769d7
3 changed files with 67 additions and 7 deletions
|
|
@ -258,3 +258,24 @@ class TestBasic:
|
|||
r.check_exit_code(0)
|
||||
else:
|
||||
r.check_exit_code(43)
|
||||
|
||||
# http: special handling of TE request header
|
||||
@pytest.mark.parametrize("te_in, te_out", [
|
||||
['trailers', 'trailers'],
|
||||
['chunked', None],
|
||||
['gzip, trailers', 'trailers'],
|
||||
['gzip ;q=0.2;x="y,x", trailers', 'trailers'],
|
||||
['gzip ;x="trailers", chunks', None],
|
||||
])
|
||||
def test_01_17_TE(self, env: Env, httpd, te_in, te_out):
|
||||
proto = 'h2'
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo'
|
||||
r = curl.http_download(urls=[url], alpn_proto=proto, with_stats=True,
|
||||
with_headers=True,
|
||||
extra_args=['-H', f'TE: {te_in}'])
|
||||
r.check_response(200)
|
||||
if te_out is not None:
|
||||
assert r.responses[0]['header']['request-te'] == te_out, f'{r.responses[0]}'
|
||||
else:
|
||||
assert 'request-te' not in r.responses[0]['header'], f'{r.responses[0]}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue