HTTP/[23]: continue upload when state.drain is set

- as reported in #10433, HTTP/2 uploads may stall when a response is
  received before the upload is done. This happens when the
  data->state.drain is set for such a transfer, as the special handling
  in transfer.c from then on only cared about downloads.
- add continuation of uploads, if applicable, in this case.
- add pytest case test_07_12_upload_seq_large to reproduce this scenario
  (although, current nghttp2 implementation is using drain less often)

Reported-by: Lucas Pardue

Fixes #10433
Closes #10443
This commit is contained in:
Stefan Eissing 2023-02-08 10:26:58 +01:00 committed by Daniel Stenberg
parent 8c762f5998
commit 3de3ea6a64
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 55 additions and 22 deletions

View file

@ -82,14 +82,14 @@ class EnvConfig:
lib.lower() for lib in m.group('libs').split(' ')
]
self.curl_props['libs'] = [
re.sub(r'/.*', '',lib) for lib in self.curl_props['lib_versions']
re.sub(r'/.*', '', lib) for lib in self.curl_props['lib_versions']
]
if l.startswith('Features: '):
self.curl_props['features'] = [
feat.lower() for feat in l[10:].split(' ')
]
if l.startswith('Protocols: '):
self.curl_props['protocols'] = [
self.curl_props['protocols'] = [
prot.lower() for prot in l[11:].split(' ')
]
self.nghttpx_with_h3 = re.match(r'.* nghttp3/.*', p.stdout.strip())
@ -222,11 +222,11 @@ class Env:
return 'unknown'
@staticmethod
def curl_os() -> bool:
def curl_os() -> str:
return Env.CONFIG.curl_props['os']
@staticmethod
def curl_version() -> bool:
def curl_version() -> str:
return Env.CONFIG.curl_props['version']
@staticmethod
@ -336,3 +336,17 @@ class Env:
if alpn_proto in ['h3']:
return f'{domain}:{self.h3_port}'
return f'{domain}:{self.http_port}'
def make_data_file(self, indir: str, fname: str, fsize: int) -> str:
fpath = os.path.join(indir, fname)
s10 = "0123456789"
s = (101 * s10) + s10[0:3]
with open(fpath, 'w') as fd:
for i in range(int(fsize / 1024)):
fd.write(f"{i:09d}-{s}\n")
remain = int(fsize % 1024)
if remain != 0:
i = int(fsize / 1024) + 1
s = f"{i:09d}-{s}\n"
fd.write(s[0:remain])
return fpath