]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
connect: turn conn_get_first_origin into static
authorDaniel Stenberg <daniel@haxx.se>
Wed, 10 Jun 2026 11:37:22 +0000 (13:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 10 Jun 2026 20:58:42 +0000 (22:58 +0200)
This function is only used within this source file.

Closes #21948

lib/connect.c
lib/connect.h

index 2a534aa8f3f165749d0e69a0103ffa01fd9efd37..a24530a6e0655a31c9f628442631a1f045c50887 100644 (file)
@@ -446,6 +446,20 @@ static CURLcode cf_setup_add_http_proxy(struct Curl_cfilter *cf,
 #endif /* !CURL_DISABLE_HTTP */
 #endif /* CURL_DISABLE_PROXY */
 
+/* Get the origin curl connects its socket to.
+ * Can be origin or the first proxy. */
+static struct Curl_peer *conn_get_first_origin(struct connectdata *conn,
+                                             int sockindex)
+{
+#ifndef CURL_DISABLE_PROXY
+  if(conn->socks_proxy.peer)
+    return conn->socks_proxy.peer;
+  if(conn->http_proxy.peer)
+    return conn->http_proxy.peer;
+#endif
+  return (sockindex == SECONDARYSOCKET) ? conn->origin2 : conn->origin;
+}
+
 static CURLcode cf_setup_add_ip_happy(struct Curl_cfilter *cf,
                                       struct Curl_easy *data)
 {
@@ -457,7 +471,7 @@ static CURLcode cf_setup_add_ip_happy(struct Curl_cfilter *cf,
      * do we use for it? Only on the first hop we can do Happy Eyeballs.
      * first_origin and first_peer differ on --connect-to. */
     struct Curl_peer *first_origin =
-      Curl_conn_get_first_origin(cf->conn, cf->sockindex);
+      conn_get_first_origin(cf->conn, cf->sockindex);
     struct Curl_peer *first_peer =
       Curl_conn_get_first_peer(cf->conn, cf->sockindex);
     struct Curl_peer *tunnel_peer = NULL;
@@ -818,18 +832,6 @@ struct Curl_peer *Curl_conn_get_destination(struct connectdata *conn,
     (conn->via_peer ? conn->via_peer : conn->origin);
 }
 
-struct Curl_peer *Curl_conn_get_first_origin(struct connectdata *conn,
-                                             int sockindex)
-{
-#ifndef CURL_DISABLE_PROXY
-  if(conn->socks_proxy.peer)
-    return conn->socks_proxy.peer;
-  if(conn->http_proxy.peer)
-    return conn->http_proxy.peer;
-#endif
-  return (sockindex == SECONDARYSOCKET) ? conn->origin2 : conn->origin;
-}
-
 struct Curl_peer *Curl_conn_get_first_peer(struct connectdata *conn,
                                            int sockindex)
 {
index 968314ea8e74f551df795356e8742167bc79651f..3530d7050402b174d948a72210577a4b364a92aa 100644 (file)
@@ -136,11 +136,6 @@ struct Curl_peer *Curl_conn_get_origin(struct connectdata *conn,
 struct Curl_peer *Curl_conn_get_destination(struct connectdata *conn,
                                             int sockindex);
 
-/* Get the origin curl connects its socket to.
- * Can be origin or the first proxy. */
-struct Curl_peer *Curl_conn_get_first_origin(struct connectdata *conn,
-                                             int sockindex);
-
 /* Get the peer curl connects its socket to.
  * Can be origin, "connect-to" or the first proxy. */
 struct Curl_peer *Curl_conn_get_first_peer(struct connectdata *conn,