diff options
author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2022-07-08 18:48:09 +0900 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-07-10 23:18:00 +0200 |
commit | 4989cd099e118271070c28df311bd7d9e757bf9d (patch) | |
tree | 0da2907049a3a1b1ecd94e9bf658dd3770151ee5 /lib/transfer.c | |
parent | d123f0e5908fc041beeb413bf6541b6942fd2bcd (diff) | |
download | curl-4989cd099e118271070c28df311bd7d9e757bf9d.tar.gz |
ngtcp2: fix stall or busy loop on STOP_SENDING with upload data
Fixes #9122
Closes #9123
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 1720b24b1..6560d9607 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -539,6 +539,13 @@ static CURLcode readwrite_data(struct Curl_easy *data, bool is_http2 = ((conn->handler->protocol & PROTO_FAMILY_HTTP) && (conn->httpversion == 20)); #endif + bool is_http3 = +#ifdef ENABLE_QUIC + ((conn->handler->protocol & PROTO_FAMILY_HTTP) && + (conn->httpversion == 30)); +#else + FALSE; +#endif if( #ifdef USE_NGHTTP2 @@ -549,6 +556,7 @@ static CURLcode readwrite_data(struct Curl_easy *data, for a particular stream. */ !is_http2 && #endif + !is_http3 && /* Same reason mentioned above. */ k->size != -1 && !k->header) { /* make sure we don't read too much */ curl_off_t totalleft = k->size - k->bytecount; @@ -596,6 +604,9 @@ static CURLcode readwrite_data(struct Curl_easy *data, DEBUGF(infof(data, "nread == 0, stream closed, bailing")); else #endif + if(is_http3 && !nread) + DEBUGF(infof(data, "nread == 0, stream closed, bailing")); + else DEBUGF(infof(data, "nread <= 0, server closed connection, bailing")); k->keepon &= ~KEEP_RECV; break; @@ -753,7 +764,13 @@ static CURLcode readwrite_data(struct Curl_easy *data, if(nread < 0) /* this should be unusual */ nread = 0; - k->keepon &= ~KEEP_RECV; /* we're done reading */ + /* HTTP/3 over QUIC should keep reading until QUIC connection + is closed. In contrast to HTTP/2 which can stop reading + from TCP connection, HTTP/3 over QUIC needs ACK from server + to ensure stream closure. It should keep reading. */ + if(!is_http3) { + k->keepon &= ~KEEP_RECV; /* we're done reading */ + } } k->bytecount += nread; |