summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-07 18:16:01 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-07 22:40:37 +0200
commit02d03c20aa46e6428868cdebfdd12f98e0591541 (patch)
tree30be9e9bd006c527ee86bd027aad9d66574e8184
parent0f3310b68c488e9070b169fce1b465e0f5ae9e89 (diff)
downloadcurl-02d03c20aa46e6428868cdebfdd12f98e0591541.tar.gz
http: don't consider upload done if the request isn't completely sent off
Fixes #4919
-rw-r--r--lib/http.c2
-rw-r--r--lib/transfer.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/http.c b/lib/http.c
index e53f0d482..5a2edf09e 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -3057,7 +3057,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
if(result)
return result;
- if(!postsize)
+ if(!postsize && (http->sending != HTTPSEND_REQUEST))
data->req.upload_done = TRUE;
if(data->req.writebytecount) {
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