]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cfilters:Curl_conn_get_select_socks: use the first non-connected filter
authorDaniel Stenberg <daniel@haxx.se>
Mon, 26 Dec 2022 08:59:20 +0000 (09:59 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 27 Dec 2022 09:48:29 +0000 (10:48 +0100)
When there are filters addded for both socket and SSL, the code
previously checked the SSL sockets during connect when it *should* first
check the socket layer until that has connected.

Fixes #10157
Fixes #10146
Closes #10160

Reviewed-by: Stefan Eissing
lib/cfilters.c

index 8951533418915eaebdc37746fe0c5b7f0459ad89..8b05fbc8f4381bb5f457881ae848a4f9d1872df4 100644 (file)
@@ -437,6 +437,10 @@ int Curl_conn_get_select_socks(struct Curl_easy *data, int sockindex,
   DEBUGASSERT(data);
   DEBUGASSERT(data->conn);
   cf = data->conn->cfilter[sockindex];
+
+  /* if the next one is not yet connected, that's the one we want */
+  while(cf && cf->next && !cf->next->connected)
+    cf = cf->next;
   if(cf) {
     return cf->cft->get_select_socks(cf, data, socks);
   }