Lines Matching refs:conn

565 void Curl_conn_free(struct Curl_easy *data, struct connectdata *conn)  in Curl_conn_free()  argument
569 DEBUGASSERT(conn); in Curl_conn_free()
571 for(i = 0; i < ARRAYSIZE(conn->cfilter); ++i) { in Curl_conn_free()
572 Curl_conn_cf_discard_all(data, conn, (int)i); in Curl_conn_free()
575 Curl_free_idnconverted_hostname(&conn->host); in Curl_conn_free()
576 Curl_free_idnconverted_hostname(&conn->conn_to_host); in Curl_conn_free()
578 Curl_free_idnconverted_hostname(&conn->http_proxy.host); in Curl_conn_free()
579 Curl_free_idnconverted_hostname(&conn->socks_proxy.host); in Curl_conn_free()
580 Curl_safefree(conn->http_proxy.user); in Curl_conn_free()
581 Curl_safefree(conn->socks_proxy.user); in Curl_conn_free()
582 Curl_safefree(conn->http_proxy.passwd); in Curl_conn_free()
583 Curl_safefree(conn->socks_proxy.passwd); in Curl_conn_free()
584 Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */ in Curl_conn_free()
585 Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */ in Curl_conn_free()
587 Curl_safefree(conn->user); in Curl_conn_free()
588 Curl_safefree(conn->passwd); in Curl_conn_free()
589 Curl_safefree(conn->sasl_authzid); in Curl_conn_free()
590 Curl_safefree(conn->options); in Curl_conn_free()
591 Curl_safefree(conn->oauth_bearer); in Curl_conn_free()
592 Curl_safefree(conn->host.rawalloc); /* hostname buffer */ in Curl_conn_free()
593 Curl_safefree(conn->conn_to_host.rawalloc); /* hostname buffer */ in Curl_conn_free()
594 Curl_safefree(conn->hostname_resolve); in Curl_conn_free()
595 Curl_safefree(conn->secondaryhostname); in Curl_conn_free()
596 Curl_safefree(conn->localdev); in Curl_conn_free()
597 Curl_ssl_conn_config_cleanup(conn); in Curl_conn_free()
600 Curl_safefree(conn->unix_domain_socket); in Curl_conn_free()
602 Curl_safefree(conn->destination); in Curl_conn_free()
604 free(conn); /* free all the connection oriented data */ in Curl_conn_free()
620 struct connectdata *conn, bool aborted) in Curl_on_disconnect() argument
623 DEBUGASSERT(conn); in Curl_on_disconnect()
626 DEBUGASSERT(!conn->bits.in_cpool); in Curl_on_disconnect()
632 DEBUGASSERT(!data->conn); in Curl_on_disconnect()
635 conn->connection_id, aborted)); in Curl_on_disconnect()
637 if(conn->dns_entry) in Curl_on_disconnect()
638 Curl_resolv_unlink(data, &conn->dns_entry); in Curl_on_disconnect()
641 Curl_http_auth_cleanup_ntlm(conn); in Curl_on_disconnect()
644 Curl_http_auth_cleanup_negotiate(conn); in Curl_on_disconnect()
646 if(conn->connect_only) in Curl_on_disconnect()
660 const struct connectdata *conn) in xfer_may_multiplex() argument
663 if((conn->handler->protocol & PROTO_FAMILY_HTTP) && in xfer_may_multiplex()
664 (!conn->bits.protoconnstart || !conn->bits.close)) { in xfer_may_multiplex()
716 struct connectdata *conn, in conn_maxage() argument
721 idletime = Curl_timediff(now, conn->lastused); in conn_maxage()
730 lifetime = Curl_timediff(now, conn->created); in conn_maxage()
747 bool Curl_conn_seems_dead(struct connectdata *conn, in Curl_conn_seems_dead() argument
751 DEBUGASSERT(!data->conn); in Curl_conn_seems_dead()
752 if(!CONN_INUSE(conn)) { in Curl_conn_seems_dead()
762 if(conn_maxage(data, conn, *pnow)) { in Curl_conn_seems_dead()
766 else if(conn->handler->connection_check) { in Curl_conn_seems_dead()
773 Curl_attach_connection(data, conn); in Curl_conn_seems_dead()
775 state = conn->handler->connection_check(data, conn, CONNCHECK_ISDEAD); in Curl_conn_seems_dead()
784 Curl_attach_connection(data, conn); in Curl_conn_seems_dead()
785 dead = !Curl_conn_is_alive(data, conn, &input_pending); in Curl_conn_seems_dead()
804 conn->connection_id); in Curl_conn_seems_dead()
812 struct connectdata *conn, in Curl_conn_upkeep() argument
816 if(Curl_timediff(*now, conn->keepalive) <= data->set.upkeep_interval_ms) in Curl_conn_upkeep()
820 Curl_attach_connection(data, conn); in Curl_conn_upkeep()
821 if(conn->handler->connection_check) { in Curl_conn_upkeep()
824 rc = conn->handler->connection_check(data, conn, CONNCHECK_KEEPALIVE); in Curl_conn_upkeep()
830 result = Curl_conn_keep_alive(data, conn, FIRSTSOCKET); in Curl_conn_upkeep()
834 conn->keepalive = *now; in Curl_conn_upkeep()
864 static bool url_match_conn(struct connectdata *conn, void *userdata) in url_match_conn() argument
872 if(conn->connect_only || conn->bits.close) in url_match_conn()
877 && data->set.ipver != conn->ip_version) { in url_match_conn()
894 if((conn->localport != needle->localport) || in url_match_conn()
895 (conn->localportrange != needle->localportrange) || in url_match_conn()
897 (!conn->localdev || strcmp(conn->localdev, needle->localdev)))) in url_match_conn()
901 if(needle->bits.conn_to_host != conn->bits.conn_to_host) in url_match_conn()
906 if(needle->bits.conn_to_port != conn->bits.conn_to_port) in url_match_conn()
911 if(!Curl_conn_is_connected(conn, FIRSTSOCKET) || in url_match_conn()
912 conn->bits.asks_multiplex) { in url_match_conn()
919 " is not open enough, cannot reuse", conn->connection_id); in url_match_conn()
926 if(CONN_INUSE(conn)) { in url_match_conn()
927 if(!conn->bits.multiplex) { in url_match_conn()
938 struct Curl_llist_node *e = Curl_llist_head(&conn->easyq); in url_match_conn()
950 if(!conn->unix_domain_socket) in url_match_conn()
952 if(strcmp(needle->unix_domain_socket, conn->unix_domain_socket)) in url_match_conn()
954 if(needle->bits.abstract_unix_socket != conn->bits.abstract_unix_socket) in url_match_conn()
957 else if(conn->unix_domain_socket) in url_match_conn()
962 (conn->handler->flags&PROTOPT_SSL)) in url_match_conn()
964 if(get_protocol_family(conn->handler) != in url_match_conn()
965 needle->handler->protocol || !conn->bits.tls_upgraded) in url_match_conn()
970 if(needle->bits.httpproxy != conn->bits.httpproxy || in url_match_conn()
971 needle->bits.socksproxy != conn->bits.socksproxy) in url_match_conn()
976 &conn->socks_proxy)) in url_match_conn()
980 if(needle->bits.tunnel_proxy != conn->bits.tunnel_proxy) in url_match_conn()
983 if(!proxy_info_matches(&needle->http_proxy, &conn->http_proxy)) in url_match_conn()
988 if(needle->http_proxy.proxytype != conn->http_proxy.proxytype) in url_match_conn()
991 if(!Curl_ssl_conn_config_match(data, conn, TRUE)) { in url_match_conn()
995 conn->connection_id)); in url_match_conn()
1007 !conn->httpversion) { in url_match_conn()
1021 if(Curl_timestrcmp(needle->user, conn->user) || in url_match_conn()
1022 Curl_timestrcmp(needle->passwd, conn->passwd) || in url_match_conn()
1023 Curl_timestrcmp(needle->sasl_authzid, conn->sasl_authzid) || in url_match_conn()
1024 Curl_timestrcmp(needle->oauth_bearer, conn->oauth_bearer)) { in url_match_conn()
1032 if(needle->gssapi_delegation != conn->gssapi_delegation) in url_match_conn()
1041 if((conn->httpversion >= 20) && in url_match_conn()
1045 conn->connection_id, conn->httpversion)); in url_match_conn()
1047 if((conn->httpversion >= 30) && in url_match_conn()
1051 conn->connection_id, conn->httpversion)); in url_match_conn()
1057 if(!ssh_config_matches(needle, conn)) in url_match_conn()
1065 conn->proto.ftpc.account) || in url_match_conn()
1067 conn->proto.ftpc.alternative_to_user) || in url_match_conn()
1068 (needle->proto.ftpc.use_ssl != conn->proto.ftpc.use_ssl) || in url_match_conn()
1069 (needle->proto.ftpc.ccc != conn->proto.ftpc.ccc)) in url_match_conn()
1083 if(!strcasecompare(needle->handler->scheme, conn->handler->scheme) && in url_match_conn()
1084 (get_protocol_family(conn->handler) != in url_match_conn()
1085 needle->handler->protocol || !conn->bits.tls_upgraded)) in url_match_conn()
1090 needle->conn_to_host.name, conn->conn_to_host.name)) || in url_match_conn()
1092 needle->conn_to_port != conn->conn_to_port)) in url_match_conn()
1096 if(!strcasecompare(needle->host.name, conn->host.name) || in url_match_conn()
1097 needle->remote_port != conn->remote_port) in url_match_conn()
1102 !Curl_ssl_conn_config_match(data, conn, FALSE)) { in url_match_conn()
1106 conn->connection_id)); in url_match_conn()
1118 if(Curl_timestrcmp(needle->user, conn->user) || in url_match_conn()
1119 Curl_timestrcmp(needle->passwd, conn->passwd)) { in url_match_conn()
1123 if(conn->http_ntlm_state == NTLMSTATE_NONE) in url_match_conn()
1124 match->found = conn; in url_match_conn()
1128 else if(conn->http_ntlm_state != NTLMSTATE_NONE) { in url_match_conn()
1138 if(!conn->http_proxy.user || !conn->http_proxy.passwd) in url_match_conn()
1142 conn->http_proxy.user) || in url_match_conn()
1144 conn->http_proxy.passwd)) in url_match_conn()
1147 else if(conn->proxy_ntlm_state != NTLMSTATE_NONE) { in url_match_conn()
1157 match->found = conn; in url_match_conn()
1160 (conn->http_ntlm_state != NTLMSTATE_NONE)) || in url_match_conn()
1162 (conn->proxy_ntlm_state != NTLMSTATE_NONE))) { in url_match_conn()
1172 if(CONN_INUSE(conn)) { in url_match_conn()
1174 DEBUGASSERT(conn->bits.multiplex); in url_match_conn()
1176 if(CONN_INUSE(conn) >= in url_match_conn()
1179 ", skip (%zu)", CONN_INUSE(conn)); in url_match_conn()
1182 if(CONN_INUSE(conn) >= in url_match_conn()
1183 Curl_conn_get_max_concurrent(data, conn, FIRSTSOCKET)) { in url_match_conn()
1185 CONN_INUSE(conn)); in url_match_conn()
1191 else if(Curl_conn_seems_dead(conn, data, NULL)) { in url_match_conn()
1193 Curl_cpool_disconnect(data, conn, FALSE); in url_match_conn()
1198 match->found = conn; in url_match_conn()
1282 struct connectdata *conn, int sockindex) in Curl_verboseconnect() argument
1286 conn->secondary.remote_ip, conn->secondary.remote_port); in Curl_verboseconnect()
1289 CURL_CONN_HOST_DISPNAME(conn), conn->primary.remote_ip, in Curl_verboseconnect()
1290 conn->primary.remote_port); in Curl_verboseconnect()
1292 if(conn->handler->protocol & PROTO_FAMILY_HTTP) { in Curl_verboseconnect()
1293 switch(conn->alpn) { in Curl_verboseconnect()
1314 struct connectdata *conn = calloc(1, sizeof(struct connectdata)); in allocate_conn() local
1315 if(!conn) in allocate_conn()
1320 conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ in allocate_conn()
1321 conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ in allocate_conn()
1322 conn->sockfd = CURL_SOCKET_BAD; in allocate_conn()
1323 conn->writesockfd = CURL_SOCKET_BAD; in allocate_conn()
1324 conn->connection_id = -1; /* no ID */ in allocate_conn()
1325 conn->primary.remote_port = -1; /* unknown at this point */ in allocate_conn()
1326 conn->remote_port = -1; /* unknown at this point */ in allocate_conn()
1331 connclose(conn, "Default to force-close"); in allocate_conn()
1334 conn->created = Curl_now(); in allocate_conn()
1337 conn->keepalive = conn->created; in allocate_conn()
1340 conn->http_proxy.proxytype = data->set.proxytype; in allocate_conn()
1341 conn->socks_proxy.proxytype = CURLPROXY_SOCKS4; in allocate_conn()
1345 conn->bits.proxy = (data->set.str[STRING_PROXY] && in allocate_conn()
1347 conn->bits.httpproxy = (conn->bits.proxy && in allocate_conn()
1348 (conn->http_proxy.proxytype == CURLPROXY_HTTP || in allocate_conn()
1349 conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0 || in allocate_conn()
1350 IS_HTTPS_PROXY(conn->http_proxy.proxytype))); in allocate_conn()
1351 conn->bits.socksproxy = (conn->bits.proxy && !conn->bits.httpproxy); in allocate_conn()
1354 conn->bits.proxy = TRUE; in allocate_conn()
1355 conn->bits.socksproxy = TRUE; in allocate_conn()
1358 conn->bits.proxy_user_passwd = !!data->state.aptr.proxyuser; in allocate_conn()
1359 conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy; in allocate_conn()
1363 conn->bits.ftp_use_epsv = data->set.ftp_use_epsv; in allocate_conn()
1364 conn->bits.ftp_use_eprt = data->set.ftp_use_eprt; in allocate_conn()
1366 conn->ip_version = data->set.ipver; in allocate_conn()
1367 conn->connect_only = data->set.connect_only; in allocate_conn()
1368 conn->transport = TRNSPRT_TCP; /* most of them are TCP streams */ in allocate_conn()
1371 Curl_llist_init(&conn->easyq, NULL); in allocate_conn()
1374 conn->data_prot = PROT_CLEAR; in allocate_conn()
1379 conn->localdev = strdup(data->set.str[STRING_DEVICE]); in allocate_conn()
1380 if(!conn->localdev) in allocate_conn()
1384 conn->localportrange = data->set.localportrange; in allocate_conn()
1385 conn->localport = data->set.localport; in allocate_conn()
1390 conn->fclosesocket = data->set.fclosesocket; in allocate_conn()
1391 conn->closesocket_client = data->set.closesocket_client; in allocate_conn()
1392 conn->lastused = conn->created; in allocate_conn()
1393 conn->gssapi_delegation = data->set.gssapi_delegation; in allocate_conn()
1395 return conn; in allocate_conn()
1398 free(conn->localdev); in allocate_conn()
1399 free(conn); in allocate_conn()
1624 struct connectdata *conn, in findprotocol() argument
1640 conn->handler = conn->given = p; in findprotocol()
1678 struct connectdata *conn) argument
1691 conn->scope_id = (unsigned int)scope;
1714 conn->scope_id = scopeidx;
1729 struct connectdata *conn) argument
1804 conn->bits.ipv6_ip = TRUE;
1810 zonefrom_url(uh, data, conn);
1814 conn->host.rawalloc = strdup(hostname ? hostname : "");
1815 if(!conn->host.rawalloc)
1817 conn->host.name = conn->host.rawalloc;
1822 result = Curl_idnconvert_hostname(&conn->host);
1830 if(Curl_hsts(data->hsts, conn->host.name, TRUE)) {
1855 result = findprotocol(data, conn, data->state.up.scheme);
1868 conn->handler->flags&PROTOPT_USERPWDCTRL ?
1872 conn->passwd = decoded;
1890 conn->handler->flags&PROTOPT_USERPWDCTRL ?
1894 conn->user = decoded;
1907 conn->options = strdup(data->state.up.options);
1908 if(!conn->options)
1927 conn->primary.remote_port = conn->remote_port =
1937 conn->scope_id = data->set.scope_id;
1986 struct connectdata *conn) argument
1994 p = conn->handler;
1997 result = (*p->setup_connection)(data, conn);
2002 p = conn->handler; /* May have changed. */
2005 if(conn->primary.remote_port < 0)
2008 conn->primary.remote_port = p->defport;
2012 if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
2013 hostname = conn->http_proxy.host.name;
2014 port = conn->primary.remote_port;
2019 port = conn->remote_port;
2020 if(conn->bits.conn_to_host)
2021 hostname = conn->conn_to_host.name;
2023 hostname = conn->host.name;
2027 conn->destination = aprintf("%u/%d/%s", conn->scope_id, port, hostname);
2029 conn->destination = aprintf("%d/%s", port, hostname);
2031 if(!conn->destination)
2034 conn->destination_len = strlen(conn->destination) + 1;
2035 Curl_strntolower(conn->destination, conn->destination,
2036 conn->destination_len - 1);
2051 struct connectdata *conn) argument
2078 msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", conn->handler->scheme);
2137 struct connectdata *conn, char *proxy, argument
2221 proxyinfo = sockstype ? &conn->socks_proxy : &conn->http_proxy;
2252 conn->bits.proxy_user_passwd = TRUE; /* enable it */
2275 if(conn->primary.remote_port < 0 || sockstype ||
2276 !conn->socks_proxy.host.rawalloc)
2277 conn->primary.remote_port = port;
2318 zonefrom_url(uhp, data, conn);
2342 struct connectdata *conn) argument
2350 conn->http_proxy.user = strdup(proxyuser);
2351 if(conn->http_proxy.user) {
2352 conn->http_proxy.passwd = strdup(proxypasswd);
2353 if(conn->http_proxy.passwd)
2356 Curl_safefree(conn->http_proxy.user);
2364 struct connectdata *conn) argument
2374 if(conn->bits.proxy_user_passwd) {
2375 result = parse_proxy_auth(data, conn);
2415 if(Curl_check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY] ?
2423 proxy = detect_proxy(data, conn);
2429 if(proxy && conn->unix_domain_socket) {
2435 if(proxy && (!*proxy || (conn->handler->flags & PROTOPT_NONETWORK))) {
2441 (conn->handler->flags & PROTOPT_NONETWORK))) {
2453 curl_proxytype ptype = (curl_proxytype)conn->http_proxy.proxytype;
2455 result = parse_proxy(data, conn, proxy, ptype);
2462 result = parse_proxy(data, conn, socksproxy, ptype);
2469 if(conn->http_proxy.host.rawalloc) {
2476 if(!(conn->handler->protocol & PROTO_FAMILY_HTTP)) {
2477 if((conn->handler->flags & PROTOPT_PROXY_AS_HTTP) &&
2478 !conn->bits.tunnel_proxy)
2479 conn->handler = &Curl_handler_http;
2482 conn->bits.tunnel_proxy = TRUE;
2484 conn->bits.httpproxy = TRUE;
2488 conn->bits.httpproxy = FALSE; /* not an HTTP proxy */
2489 conn->bits.tunnel_proxy = FALSE; /* no tunneling if not HTTP */
2492 if(conn->socks_proxy.host.rawalloc) {
2493 if(!conn->http_proxy.host.rawalloc) {
2495 if(!conn->socks_proxy.user) {
2496 conn->socks_proxy.user = conn->http_proxy.user;
2497 conn->http_proxy.user = NULL;
2498 Curl_safefree(conn->socks_proxy.passwd);
2499 conn->socks_proxy.passwd = conn->http_proxy.passwd;
2500 conn->http_proxy.passwd = NULL;
2503 conn->bits.socksproxy = TRUE;
2506 conn->bits.socksproxy = FALSE; /* not a socks proxy */
2509 conn->bits.socksproxy = FALSE;
2510 conn->bits.httpproxy = FALSE;
2512 conn->bits.proxy = conn->bits.httpproxy || conn->bits.socksproxy;
2514 if(!conn->bits.proxy) {
2516 conn->bits.proxy = FALSE;
2517 conn->bits.httpproxy = FALSE;
2518 conn->bits.socksproxy = FALSE;
2519 conn->bits.proxy_user_passwd = FALSE;
2520 conn->bits.tunnel_proxy = FALSE;
2523 conn->http_proxy.proxytype = CURLPROXY_HTTP;
2637 struct connectdata *conn) argument
2644 conn->remote_port = data->set.use_port;
2645 msnprintf(portbuf, sizeof(portbuf), "%d", conn->remote_port);
2670 struct connectdata *conn) argument
2673 char **userp = &conn->user;
2674 char **passwdp = &conn->passwd;
2675 char **optionsp = &conn->options;
2689 conn->bits.netrc = FALSE;
2703 ret = Curl_parsenetrc(&data->state.netrc, conn->host.name,
2708 conn->host.name,
2717 if(!(conn->handler->flags&PROTOPT_USERPWDCTRL)) {
2728 conn->bits.netrc = TRUE;
2732 Curl_safefree(conn->user);
2733 conn->user = strdup(*userp);
2734 if(!conn->user)
2793 struct connectdata *conn) argument
2800 if((conn->handler->flags & PROTOPT_NEEDSPWD) && !data->state.aptr.user)
2807 if(!conn->user) {
2808 conn->user = strdup(setuser);
2809 if(!conn->user)
2814 if(!conn->passwd) {
2815 conn->passwd = strdup(setpasswd);
2816 if(!conn->passwd)
2931 struct connectdata *conn, argument
2953 conn->bits.ipv6_ip ? "[" : "",
2954 conn->host.name,
2955 conn->bits.ipv6_ip ? "]" : "");
2980 if((endp == ptr_next) && (port_to_match == conn->remote_port)) {
3001 struct connectdata *conn, argument
3009 result = parse_connect_to_string(data, conn, conn_to_host->data,
3015 conn->conn_to_host.rawalloc = host;
3016 conn->conn_to_host.name = host;
3017 conn->bits.conn_to_host = TRUE;
3023 conn->bits.conn_to_host = FALSE;
3028 conn->conn_to_port = port;
3029 conn->bits.conn_to_port = TRUE;
3034 conn->bits.conn_to_port = FALSE;
3043 ((conn->handler->protocol == CURLPROTO_HTTPS) ||
3102 host = conn->host.rawalloc;
3109 srcalpnid, host, conn->remote_port, /* from */
3117 srcalpnid, host, conn->remote_port, /* from */
3127 conn->conn_to_host.rawalloc = hostd;
3128 conn->conn_to_host.name = hostd;
3129 conn->bits.conn_to_host = TRUE;
3130 conn->conn_to_port = as->dst.port;
3131 conn->bits.conn_to_port = TRUE;
3132 conn->bits.altused = TRUE;
3134 Curl_alpnid2str(srcalpnid), host, conn->remote_port,
3140 conn->httpversion = 11;
3143 conn->httpversion = 20;
3146 conn->transport = TRNSPRT_QUIC;
3147 conn->httpversion = 30;
3162 struct connectdata *conn, argument
3169 DEBUGASSERT(conn->dns_entry == NULL);
3179 conn->bits.abstract_unix_socket);
3189 conn->dns_entry = hostaddr;
3198 struct connectdata *conn, argument
3206 char *unix_path = conn->unix_domain_socket;
3209 if(!unix_path && CONN_IS_PROXIED(conn) && conn->socks_proxy.host.name &&
3211 conn->socks_proxy.host.name, sizeof(UNIX_SOCKET_PREFIX)))
3212 unix_path = conn->socks_proxy.host.name + sizeof(UNIX_SOCKET_PREFIX) - 1;
3217 conn->transport = TRNSPRT_UNIX;
3218 return resolve_unix(data, conn, unix_path);
3222 DEBUGASSERT(conn->dns_entry == NULL);
3225 if(CONN_IS_PROXIED(conn)) {
3226 ehost = conn->bits.socksproxy ? &conn->socks_proxy.host :
3227 &conn->http_proxy.host;
3233 ehost = conn->bits.conn_to_host ? &conn->conn_to_host : &conn->host;
3236 conn->primary.remote_port = conn->bits.conn_to_port ? conn->conn_to_port :
3237 conn->remote_port;
3241 conn->hostname_resolve = strdup(ehost->name);
3242 if(!conn->hostname_resolve)
3245 rc = Curl_resolv_timeout(data, conn->hostname_resolve,
3246 conn->primary.remote_port,
3247 &conn->dns_entry, timeout_ms);
3256 else if(!conn->dns_entry) {
3360 struct connectdata *conn; local
3382 conn = allocate_conn(data);
3384 if(!conn) {
3392 *in_connect = conn;
3394 result = parseurlandfillconn(data, conn);
3399 conn->sasl_authzid = strdup(data->set.str[STRING_SASL_AUTHZID]);
3400 if(!conn->sasl_authzid) {
3407 conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]);
3408 if(!conn->oauth_bearer) {
3416 conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
3417 if(!conn->unix_domain_socket) {
3421 conn->bits.abstract_unix_socket = data->set.abstract_unix_socket;
3428 result = create_conn_helper_init_proxy(data, conn);
3436 if((conn->given->flags&PROTOPT_SSL) && conn->bits.httpproxy)
3437 conn->bits.tunnel_proxy = TRUE;
3443 result = parse_remote_port(data, conn);
3449 result = override_login(data, conn);
3453 result = set_login(data, conn); /* default credentials */
3461 result = parse_connect_to_slist(data, conn, data->set.connect_to);
3469 if(conn->bits.httpproxy) {
3470 result = Curl_idnconvert_hostname(&conn->http_proxy.host);
3474 if(conn->bits.socksproxy) {
3475 result = Curl_idnconvert_hostname(&conn->socks_proxy.host);
3480 if(conn->bits.conn_to_host) {
3481 result = Curl_idnconvert_hostname(&conn->conn_to_host);
3490 if(conn->bits.conn_to_host &&
3491 strcasecompare(conn->conn_to_host.name, conn->host.name)) {
3492 conn->bits.conn_to_host = FALSE;
3499 if(conn->bits.conn_to_port && conn->conn_to_port == conn->remote_port) {
3500 conn->bits.conn_to_port = FALSE;
3508 if((conn->bits.conn_to_host || conn->bits.conn_to_port) &&
3509 conn->bits.httpproxy)
3510 conn->bits.tunnel_proxy = TRUE;
3517 result = setup_connection_internals(data, conn);
3525 if(conn->handler->flags & PROTOPT_NONETWORK) {
3529 DEBUGASSERT(conn->handler->connect_it);
3530 data->info.conn_scheme = conn->handler->scheme;
3532 data->info.conn_protocol = (conn->handler->protocol) & CURLPROTO_MASK;
3533 result = conn->handler->connect_it(data, &done);
3537 Curl_attach_connection(data, conn);
3538 result = Curl_cpool_add_conn(data, conn);
3547 DEBUGASSERT(conn->handler->done);
3549 (void)conn->handler->done(data, result, FALSE);
3556 Curl_init_do(data, conn);
3563 conn->recv[FIRSTSOCKET] = Curl_cf_recv;
3564 conn->send[FIRSTSOCKET] = Curl_cf_send;
3565 conn->recv[SECONDARYSOCKET] = Curl_cf_recv;
3566 conn->send[SECONDARYSOCKET] = Curl_cf_send;
3567 conn->bits.tcp_fastopen = data->set.tcp_fastopen;
3583 DEBUGASSERT(conn->user);
3584 DEBUGASSERT(conn->passwd);
3594 reuse = ConnectionExists(data, conn, &existing, &force_reuse, &waitpipe);
3602 reuse_conn(data, conn, existing);
3603 conn = existing;
3604 *in_connect = conn;
3608 conn->bits.proxy ? "proxy" : "host",
3609 conn->socks_proxy.host.name ? conn->socks_proxy.host.dispname :
3610 conn->http_proxy.host.name ? conn->http_proxy.host.dispname :
3611 conn->host.dispname);
3614 conn->host.dispname);
3622 if(conn->handler->flags & PROTOPT_ALPN) {
3626 conn->bits.tls_enable_alpn = TRUE;
3634 switch(Curl_cpool_check_limits(data, conn)) {
3658 Curl_conn_free(data, conn);
3669 result = Curl_ssl_conn_config_init(data, conn);
3675 Curl_attach_connection(data, conn);
3676 result = Curl_cpool_add_conn(data, conn);
3702 Curl_init_do(data, conn);
3713 if(conn->bits.reuse) {
3723 result = resolve_server(data, conn, async);
3729 data->info.conn_scheme = conn->handler->scheme;
3731 data->info.conn_protocol = (conn->handler->protocol) & CURLPROTO_MASK;
3736 conn->bits.proxy
3757 struct connectdata *conn = data->conn; local
3761 if(conn->handler->flags & PROTOPT_NONETWORK) {
3769 conn->now = Curl_now();
3770 if(!conn->bits.reuse)
3771 result = Curl_conn_setup(data, conn, FIRSTSOCKET, conn->dns_entry,
3786 struct connectdata *conn; local
3794 result = create_conn(data, &conn, asyncp);
3797 if(CONN_INUSE(conn) > 1)
3811 else if(result && conn) {
3815 Curl_cpool_disconnect(data, conn, TRUE);
3831 CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn) argument
3836 if(conn) {
3837 conn->bits.do_more = FALSE; /* by default there is no curl_do_more() to
3841 !(conn->handler->flags & PROTOPT_WILDCARD))