← Commit list

ef49d42a2c

Stefan Eissing
Stefan Eissing
2026-04-09
SUCCESS Duration: 237s

Subject

cfilters: CF_TYPE_SETUP connection filter

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/cf-dns.c+1 -1
@@ -306,7 +306,7 @@ static CURLcode cf_dns_cntrl(struct Curl_cfilter *cf,
struct Curl_cftype Curl_cft_dns = {
"DNS",
- 0,
+ CF_TYPE_SETUP,
CURL_LOG_LVL_NONE,
cf_dns_destroy,
cf_dns_connect,
lib/cf-haproxy.c+1 -1
@@ -185,7 +185,7 @@ static CURLcode cf_haproxy_adjust_pollset(struct Curl_cfilter *cf,
struct Curl_cftype Curl_cft_haproxy = {
"HAPROXY",
- CF_TYPE_PROXY,
+ CF_TYPE_PROXY | CF_TYPE_SETUP,
0,
cf_haproxy_destroy,
cf_haproxy_connect,
lib/cf-https-connect.c+1 -1
@@ -743,7 +743,7 @@ static void cf_hc_destroy(struct Curl_cfilter *cf, struct Curl_easy *data)
struct Curl_cftype Curl_cft_http_connect = {
"HTTPS-CONNECT",
- 0,
+ CF_TYPE_SETUP,
CURL_LOG_LVL_NONE,
cf_hc_destroy,
cf_hc_connect,
lib/cf-ip-happy.c+1 -1
@@ -958,7 +958,7 @@ static void cf_ip_happy_destroy(struct Curl_cfilter *cf,
struct Curl_cftype Curl_cft_ip_happy = {
"HAPPY-EYEBALLS",
- 0,
+ CF_TYPE_SETUP,
CURL_LOG_LVL_NONE,
cf_ip_happy_destroy,
cf_ip_happy_connect,
lib/cfilters.c+19 -0
@@ -491,6 +491,24 @@ static void conn_report_connect_stats(struct Curl_cfilter *cf,
}
}
+static void conn_remove_setup_filters(struct Curl_easy *data,
+ int sockindex)
+{
+ struct Curl_cfilter **anchor = &data->conn->cfilter[sockindex];
+ while(*anchor) {
+ struct Curl_cfilter *cf = *anchor;
+ if(cf->connected && (cf->cft->flags & CF_TYPE_SETUP)) {
+ *anchor = cf->next;
+ cf->next = NULL;
+ CURL_TRC_CF(data, cf, "removing connected setup filter");
+ cf->cft->destroy(cf, data);
+ curlx_free(cf);
+ }
+ else
+ anchor = &cf->next;
+ }
+}
+
CURLcode Curl_conn_connect(struct Curl_easy *data,
int sockindex,
bool blocking,
@@ -544,6 +562,7 @@ CURLcode Curl_conn_connect(struct Curl_easy *data,
conn_report_connect_stats(cf, data);
data->conn->keepalive = *Curl_pgrs_now(data);
VERBOSE(result = cf_verboseconnect(data, cf));
+ conn_remove_setup_filters(data, sockindex);
goto out;
}
else if(result) {
lib/cfilters.h+3 -0
@@ -199,12 +199,15 @@ typedef CURLcode Curl_cft_query(struct Curl_cfilter *cf,
* CF_TYPE_MULTIPLEX: provides multiplexing of easy handles
* CF_TYPE_PROXY provides proxying
* CF_TYPE_HTTP implement a version of the HTTP protocol
+ * CF_TYPE_SETUP filter is only needed for connection setup and
+ * can be removed once connected
*/
#define CF_TYPE_IP_CONNECT (1 << 0)
#define CF_TYPE_SSL (1 << 1)
#define CF_TYPE_MULTIPLEX (1 << 2)
#define CF_TYPE_PROXY (1 << 3)
#define CF_TYPE_HTTP (1 << 4)
+#define CF_TYPE_SETUP (1 << 5)
/* A connection filter type, e.g. specific implementation. */
struct Curl_cftype {
lib/http_proxy.c+1 -1
@@ -391,7 +391,7 @@ static void http_proxy_cf_close(struct Curl_cfilter *cf,
struct Curl_cftype Curl_cft_http_proxy = {
"HTTP-PROXY",
- CF_TYPE_IP_CONNECT | CF_TYPE_PROXY,
+ CF_TYPE_IP_CONNECT | CF_TYPE_PROXY | CF_TYPE_SETUP,
0,
http_proxy_cf_destroy,
http_proxy_cf_connect,