Skip to content

Commit

Permalink
http2, http3: only return CURLE_PARTIAL_FILE when bytes were received
Browse files Browse the repository at this point in the history
- should resolve spurious pytest failures when stream were reset
  right after response header were received

Clsoes #13151
  • Loading branch information
icing authored and bagder committed Mar 21, 2024
1 parent 0f08b43 commit 98f67a6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/http2.c
Expand Up @@ -1666,7 +1666,7 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf,
}
else if(stream->reset) {
failf(data, "HTTP/2 stream %u was reset", stream->id);
*err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
return -1;
}

Expand Down Expand Up @@ -1807,7 +1807,7 @@ static ssize_t stream_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
(ctx->conn_closed && Curl_bufq_is_empty(&ctx->inbufq)) ||
(ctx->goaway && ctx->last_stream_id < stream->id)) {
CURL_TRC_CF(data, cf, "[%d] returning ERR", stream->id);
*err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
nread = -1;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_ngtcp2.c
Expand Up @@ -1032,7 +1032,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->id);
*err = stream->resp_hds_complete? CURLE_PARTIAL_FILE : CURLE_HTTP3;
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
goto out;
}
else if(!stream->resp_hds_complete) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_osslq.c
Expand Up @@ -1917,7 +1917,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->s.id);
*err = stream->resp_hds_complete? CURLE_PARTIAL_FILE : CURLE_HTTP3;
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
goto out;
}
else if(!stream->resp_hds_complete) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_quiche.c
Expand Up @@ -732,7 +732,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->id);
*err = stream->resp_got_header? CURLE_PARTIAL_FILE : CURLE_HTTP3;
*err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_recv, was reset -> %d",
stream->id, *err);
}
Expand Down

0 comments on commit 98f67a6

Please sign in to comment.