diff options
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/easy.c b/lib/easy.c index 04e59144b..3b72ce7a4 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1072,7 +1072,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) /* even if one function returns error, this loops through and frees all buffers */ if(!result) - result = Curl_client_write(conn, writebuf[i].type, + result = Curl_client_write(data, writebuf[i].type, Curl_dyn_ptr(&writebuf[i].b), Curl_dyn_len(&writebuf[i].b)); Curl_dyn_free(&writebuf[i].b); @@ -1156,8 +1156,13 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, if(result) return result; + if(!data->conn) + /* on first invoke, the transfer has been detached from the connection and + needs to be reattached */ + Curl_attach_connnection(data, c); + *n = 0; - result = Curl_read(c, sfd, buffer, buflen, &n1); + result = Curl_read(data, sfd, buffer, buflen, &n1); if(result) return result; @@ -1186,8 +1191,13 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, if(result) return result; + if(!data->conn) + /* on first invoke, the transfer has been detached from the connection and + needs to be reattached */ + Curl_attach_connnection(data, c); + *n = 0; - result = Curl_write(c, sfd, buffer, buflen, &n1); + result = Curl_write(data, sfd, buffer, buflen, &n1); if(n1 == -1) return CURLE_SEND_ERROR; @@ -1206,16 +1216,16 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, * * Returns always 0. */ -static int conn_upkeep(struct connectdata *conn, +static int conn_upkeep(struct Curl_easy *data, + struct connectdata *conn, void *param) { /* Param is unused. */ (void)param; - if(conn->handler->connection_check) { + if(conn->handler->connection_check) /* Do a protocol-specific keepalive check on the connection. */ - conn->handler->connection_check(conn, CONNCHECK_KEEPALIVE); - } + conn->handler->connection_check(data, conn, CONNCHECK_KEEPALIVE); return 0; /* continue iteration */ } |