mirror of
https://github.com/curl/curl.git
synced 2026-08-12 23:01:55 +03:00
http2: fix stream window size after unpausing
When pausing a HTTP/2 transfer, the stream's local window size is reduced to 0 to prevent the server from sending further data which curl cannot write out to the application. When unpausing again, the stream's window size was not correctly increased again. The attempt to trigger a window update was ignored by nghttp2, the server never received it and the transfer stalled. Add a debug feature to allow use of small window sizes which reproduces this bug in test_02_21. Fixes #16955 Closes #16960
This commit is contained in:
parent
dac78ae638
commit
5fbd78eb2d
3 changed files with 61 additions and 2 deletions
|
|
@ -313,9 +313,9 @@ class TestDownload:
|
|||
assert httpd.stop()
|
||||
assert httpd.start()
|
||||
|
||||
# download via lib client, 1 at a time, pause/resume at different offsets
|
||||
# download serial via lib client, pause/resume at different offsets
|
||||
@pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000])
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h3'])
|
||||
def test_02_21_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset):
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
|
|
@ -332,6 +332,29 @@ class TestDownload:
|
|||
srcfile = os.path.join(httpd.docs_dir, docname)
|
||||
self.check_downloads(client, srcfile, count)
|
||||
|
||||
# h2 download parallel via lib client, pause/resume at different offsets
|
||||
# debug-override stream window size to reproduce #16955
|
||||
@pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000])
|
||||
@pytest.mark.parametrize("swin_max", [0, 10*1024])
|
||||
def test_02_21_h2_lib_serial(self, env: Env, httpd, pause_offset, swin_max):
|
||||
proto = 'h2'
|
||||
count = 2
|
||||
docname = 'data-10m'
|
||||
url = f'https://localhost:{env.https_port}/{docname}'
|
||||
run_env = os.environ.copy()
|
||||
run_env['CURL_DEBUG'] = 'multi,http/2'
|
||||
if swin_max > 0:
|
||||
run_env['CURL_H2_STREAM_WIN_MAX'] = f'{swin_max}'
|
||||
client = LocalClient(name='hx-download', env=env, run_env=run_env)
|
||||
if not client.exists():
|
||||
pytest.skip(f'example client not built: {client.name}')
|
||||
r = client.run(args=[
|
||||
'-n', f'{count}', '-P', f'{pause_offset}', '-V', proto, url
|
||||
])
|
||||
r.check_exit_code(0)
|
||||
srcfile = os.path.join(httpd.docs_dir, docname)
|
||||
self.check_downloads(client, srcfile, count)
|
||||
|
||||
# download via lib client, several at a time, pause/resume
|
||||
@pytest.mark.parametrize("pause_offset", [100*1023])
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue