struct Curl_cftype Curl_cft_dns = {
"DNS",
- 0,
+ CF_TYPE_SETUP,
CURL_LOG_LVL_NONE,
cf_dns_destroy,
cf_dns_connect,
struct Curl_cftype Curl_cft_haproxy = {
"HAPROXY",
- CF_TYPE_PROXY,
+ CF_TYPE_PROXY | CF_TYPE_SETUP,
0,
cf_haproxy_destroy,
cf_haproxy_connect,
struct Curl_cftype Curl_cft_http_connect = {
"HTTPS-CONNECT",
- 0,
+ CF_TYPE_SETUP,
CURL_LOG_LVL_NONE,
cf_hc_destroy,
cf_hc_connect,
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,
}
}
+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,
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) {
* 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 {
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,