From ecc4940df2c286702262f8c21d7369f893e78968 Mon Sep 17 00:00:00 2001 From: Yamada Yasuharu Date: Mon, 23 Mar 2015 22:46:58 +0100 Subject: curl_easy_recv/send: make them work with the multi interface By making sure Curl_getconnectinfo() uses the correct connection cache to find the last connection. --- lib/connect.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/connect.c b/lib/connect.c index b67db902f..68317d986 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1202,15 +1202,20 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data, DEBUGASSERT(data); - /* this only works for an easy handle that has been used for - curl_easy_perform()! */ - if(data->state.lastconnect && data->multi_easy) { + /* this works for an easy handle: + * - that has been used for curl_easy_perform() + * - that is associated with a multi handle, and whose connection + * was detached with CURLOPT_CONNECT_ONLY + */ + if(data->state.lastconnect && (data->multi_easy || data->multi)) { struct connectdata *c = data->state.lastconnect; struct connfind find; find.tofind = data->state.lastconnect; find.found = FALSE; - Curl_conncache_foreach(data->multi_easy->conn_cache, &find, conn_is_conn); + Curl_conncache_foreach(data->multi_easy? + data->multi_easy->conn_cache: + data->multi->conn_cache, &find, conn_is_conn); if(!find.found) { data->state.lastconnect = NULL; -- cgit v1.2.3