summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-05-04 16:41:03 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-05-04 17:05:00 +0200
commit3570c7c3d590e04793f13af8f01e4b5eeccf6b0a (patch)
tree372ea34291aae2a7e41bfef501b57514adf6fdb0
parente9d9d1af8a512d4b4ed500308247766524b21763 (diff)
downloadcurl-bagder/transfer-setup-connection.tar.gz
transfer: don't unset writesockfd on setup of multiplexed connsbagder/transfer-setup-connection
Curl_setup_transfer() can be called to setup a new individual transfer over a multiplexed connection so it shouldn't unset writesockfd. Bug: #2520
-rw-r--r--lib/transfer.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 5c8eb31d3..6bf95c576 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -2018,11 +2018,18 @@ Curl_setup_transfer(
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
- /* now copy all input parameters */
- conn->sockfd = sockindex == -1 ?
+ if(conn->bits.multiplex || conn->httpversion == 20) {
+ /* when multiplexing, the read/write sockets need to be the same! */
+ conn->sockfd = sockindex == -1 ?
+ conn->sock[writesockindex] : conn->sock[sockindex];
+ conn->writesockfd = conn->sockfd;
+ }
+ else {
+ conn->sockfd = sockindex == -1 ?
CURL_SOCKET_BAD : conn->sock[sockindex];
- conn->writesockfd = writesockindex == -1 ?
+ conn->writesockfd = writesockindex == -1 ?
CURL_SOCKET_BAD:conn->sock[writesockindex];
+ }
k->getheader = getheader;
k->size = size;
@@ -2041,10 +2048,10 @@ Curl_setup_transfer(
/* we want header and/or body, if neither then don't do this! */
if(k->getheader || !data->set.opt_no_body) {
- if(conn->sockfd != CURL_SOCKET_BAD)
+ if(sockindex != -1)
k->keepon |= KEEP_RECV;
- if(conn->writesockfd != CURL_SOCKET_BAD) {
+ if(writesockindex != -1) {
struct HTTP *http = data->req.protop;
/* HTTP 1.1 magic:
@@ -2075,7 +2082,7 @@ Curl_setup_transfer(
/* enable the write bit when we're not waiting for continue */
k->keepon |= KEEP_SEND;
}
- } /* if(conn->writesockfd != CURL_SOCKET_BAD) */
+ } /* if(writesockindex != -1) */
} /* if(k->getheader || !data->set.opt_no_body) */
}