summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/transfer.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/transfer.c')
-rw-r--r--libs/libcurl/src/transfer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libs/libcurl/src/transfer.c b/libs/libcurl/src/transfer.c
index 4d466c145e..8fe343e0bd 100644
--- a/libs/libcurl/src/transfer.c
+++ b/libs/libcurl/src/transfer.c
@@ -431,6 +431,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
curl_off_t max_recv = data->set.max_recv_speed?
data->set.max_recv_speed : CURL_OFF_T_MAX;
char *buf = data->state.buffer;
+ bool data_eof_handled = FALSE;
DEBUGASSERT(buf);
*done = FALSE;
@@ -448,8 +449,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
to ensure that http2_handle_stream_close is called when we read all
incoming bytes for a particular stream. */
bool is_http3 = Curl_conn_is_http3(data, conn, FIRSTSOCKET);
- bool data_eof_handled = is_http3
- || Curl_conn_is_http2(data, conn, FIRSTSOCKET);
+ data_eof_handled = is_http3 || Curl_conn_is_http2(data, conn, FIRSTSOCKET);
if(!data_eof_handled && k->size != -1 && !k->header) {
/* make sure we don't read too much */
@@ -492,15 +492,16 @@ static CURLcode readwrite_data(struct Curl_easy *data,
if(0 < nread || is_empty_data) {
buf[nread] = 0;
}
- else {
+ if(!nread) {
/* if we receive 0 or less here, either the data transfer is done or the
server closed the connection and we bail out from this! */
if(data_eof_handled)
DEBUGF(infof(data, "nread == 0, stream closed, bailing"));
else
DEBUGF(infof(data, "nread <= 0, server closed connection, bailing"));
- k->keepon &= ~KEEP_RECV;
- break;
+ k->keepon = 0; /* stop sending as well */
+ if(!is_empty_data)
+ break;
}
/* Default buffer to use when we write the buffer, it may be changed
@@ -761,7 +762,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
}
if(((k->keepon & (KEEP_RECV|KEEP_SEND)) == KEEP_SEND) &&
- conn->bits.close) {
+ (conn->bits.close || data_eof_handled)) {
/* When we've read the entire thing and the close bit is set, the server
may now close the connection. If there's now any kind of sending going
on from our side, we need to stop that immediately. */
@@ -824,9 +825,6 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
bool sending_http_headers = FALSE;
struct SingleRequest *k = &data->req;
- if((k->bytecount == 0) && (k->writebytecount == 0))
- Curl_pgrsTime(data, TIMER_STARTTRANSFER);
-
*didwhat |= KEEP_SEND;
do {
@@ -1335,7 +1333,9 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
}
data->state.prefer_ascii = data->set.prefer_ascii;
+#ifdef CURL_LIST_ONLY_PROTOCOL
data->state.list_only = data->set.list_only;
+#endif
data->state.httpreq = data->set.method;
data->state.url = data->set.str[STRING_SET_URL];
@@ -1397,7 +1397,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
Curl_pgrsResetTransferSizes(data);
Curl_pgrsStartNow(data);
- /* In case the handle is re-used and an authentication method was picked
+ /* In case the handle is reused and an authentication method was picked
in the session we need to make sure we only use the one(s) we now
consider to be fine */
data->state.authhost.picked &= data->state.authhost.want;
@@ -1787,7 +1787,7 @@ CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
&& (data->set.rtspreq != RTSPREQ_RECEIVE)
#endif
)
- /* We got no data, we attempted to re-use a connection. For HTTP this
+ /* We got no data, we attempted to reuse a connection. For HTTP this
can be a retry so we try again regardless if we expected a body.
For other protocols we only try again only if we expected a body.