diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-04-07 18:16:01 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-04-08 08:14:23 +0200 |
commit | 0ef54abf52086e48e7c751747650584d51b9ebaa (patch) | |
tree | dff9d2e74f60d84658306727c091f876246baa52 /lib/transfer.c | |
parent | 3e376059bbc6e5e56013c383f3ae3eef6c3ae8bb (diff) | |
download | curl-0ef54abf52086e48e7c751747650584d51b9ebaa.tar.gz |
http: don't consider upload done if the request isn't completely sent off
Fixes #4919
Closes #5197
Diffstat (limited to 'lib/transfer.c')
-rw-r--r-- | lib/transfer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 27c984f8f..d5eb2c327 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1837,15 +1837,21 @@ Curl_setup_transfer( { struct SingleRequest *k = &data->req; struct connectdata *conn = data->conn; + struct HTTP *http = data->req.protop; + bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) && + (http->sending == HTTPSEND_REQUEST)); DEBUGASSERT(conn != NULL); DEBUGASSERT((sockindex <= 1) && (sockindex >= -1)); - if(conn->bits.multiplex || conn->httpversion == 20) { + if(conn->bits.multiplex || conn->httpversion == 20 || httpsending) { /* when multiplexing, the read/write sockets need to be the same! */ conn->sockfd = sockindex == -1 ? ((writesockindex == -1 ? CURL_SOCKET_BAD : conn->sock[writesockindex])) : conn->sock[sockindex]; conn->writesockfd = conn->sockfd; + if(httpsending) + /* special and very HTTP-specific */ + writesockindex = FIRSTSOCKET; } else { conn->sockfd = sockindex == -1 ? @@ -1873,7 +1879,6 @@ Curl_setup_transfer( k->keepon |= KEEP_RECV; if(writesockindex != -1) { - struct HTTP *http = data->req.protop; /* HTTP 1.1 magic: Even if we require a 100-return code before uploading data, we might |