Skip to content

Commit

Permalink
transfer: don't unset writesockfd on setup of multiplexed conns
Browse files Browse the repository at this point in the history
Curl_setup_transfer() can be called to setup a new individual transfer
over a multiplexed connection so it shouldn't unset writesockfd.

Bug: #2520
  • Loading branch information
bagder committed May 4, 2018
1 parent e9d9d1a commit 3570c7c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/transfer.c
Expand Up @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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) */

}

0 comments on commit 3570c7c

Please sign in to comment.