Loading lib/connect.c +2 −2 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ static CURLcode bindlocal(struct connectdata *conn, * We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer */ rc = Curl_resolv(conn, myhost, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) (void)Curl_wait_for_resolv(conn, &h); if(h) Loading @@ -276,7 +276,7 @@ static CURLcode bindlocal(struct connectdata *conn, * or IP number */ rc = Curl_resolv(conn, data->set.device, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) (void)Curl_wait_for_resolv(conn, &h); if(h) Loading lib/ftp.c +4 −4 Original line number Diff line number Diff line Loading @@ -1367,14 +1367,14 @@ CURLcode ftp_use_port(struct connectdata *conn) if((in == CURL_INADDR_NONE) && Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) { rc = Curl_resolv(conn, myhost, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &h); } else { size_t len = strlen(data->set.ftpport); if(len>1) { rc = Curl_resolv(conn, data->set.ftpport, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &h); } if(h) Loading Loading @@ -1642,7 +1642,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, * now, instead we remake the lookup here and now! */ rc = Curl_resolv(conn, conn->proxyhost, conn->port, &addr); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &addr); connectport = Loading @@ -1652,7 +1652,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, else { /* normal, direct, ftp connection */ rc = Curl_resolv(conn, newhostp, newport, &addr); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &addr); if(!addr) { Loading lib/hostip.c +13 −12 Original line number Diff line number Diff line Loading @@ -366,10 +366,11 @@ Curl_cache_addr(struct SessionHandle *data, * * Return codes: * * -1 = error, no pointer * 0 = OK, pointer provided * 1 = waiting for response, no pointer * CURLRESOLV_ERROR (-1) = error, no pointer * CURLRESOLV_RESOLVED (0) = OK, pointer provided * CURLRESOLV_PENDING (1) = waiting for response, no pointer */ int Curl_resolv(struct connectdata *conn, char *hostname, int port, Loading @@ -383,7 +384,7 @@ int Curl_resolv(struct connectdata *conn, CURLcode result; /* default to failure */ int rc = -1; int rc = CURLRESOLV_ERROR; *entry = NULL; #ifdef HAVE_SIGSETJMP Loading @@ -392,7 +393,7 @@ int Curl_resolv(struct connectdata *conn, if(!data->set.no_signal && sigsetjmp(curl_jmpenv, 1)) { /* this is coming from a siglongjmp() */ failf(data, "name lookup timed out"); return -1; return CURLRESOLV_ERROR; } #endif Loading @@ -400,7 +401,7 @@ int Curl_resolv(struct connectdata *conn, entry_id = create_hostcache_id(hostname, port, &entry_len); /* If we can't create the entry id, fail */ if (!entry_id) return -1; return CURLRESOLV_ERROR; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); Loading @@ -422,7 +423,7 @@ int Curl_resolv(struct connectdata *conn, /* Check what IP specifics the app has requested and if we can provide it. * If not, bail out. */ if(!Curl_ipvalid(data)) return -1; return CURLRESOLV_ERROR; /* If Curl_getaddrinfo() returns NULL, 'wait' might be set to a non-zero value indicating that we need to wait for the response to the resolve Loading @@ -436,11 +437,11 @@ int Curl_resolv(struct connectdata *conn, /* First, check that we haven't received the info by now */ result = Curl_is_resolved(conn, &dns); if(result) /* error detected */ return -1; return CURLRESOLV_ERROR; if(dns) rc = 0; /* pointer provided */ rc = CURLRESOLV_RESOLVED; /* pointer provided */ else rc = 1; /* no info yet */ rc = CURLRESOLV_PENDING; /* no info yet */ } } else { Loading @@ -457,12 +458,12 @@ int Curl_resolv(struct connectdata *conn, /* returned failure, bail out nicely */ Curl_freeaddrinfo(addr); else rc = 0; rc = CURLRESOLV_RESOLVED; } } else { dns->inuse++; /* we use it! */ rc = 0; rc = CURLRESOLV_RESOLVED; } *entry = dns; Loading lib/hostip.h +10 −4 Original line number Diff line number Diff line Loading @@ -51,10 +51,12 @@ struct Curl_dns_entry { * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after * use, or we'll leak memory! */ int Curl_resolv(struct connectdata *conn, char *hostname, int port, struct Curl_dns_entry **dnsentry); /* return codes */ #define CURLRESOLV_ERROR -1 #define CURLRESOLV_RESOLVED 0 #define CURLRESOLV_PENDING 1 int Curl_resolv(struct connectdata *conn, char *hostname, int port, struct Curl_dns_entry **dnsentry); /* * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've Loading Loading @@ -201,6 +203,10 @@ Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr, #define CURLRES_SYNCH #endif #ifndef USE_LIBIDN #define CURLRES_IDN #endif /* Allocate enough memory to hold the full name information structs and * everything. OSF1 is known to require at least 8872 bytes. The buffer * required for storing all possible aliases and IP numbers is according to Loading lib/url.c +4 −4 Original line number Diff line number Diff line Loading @@ -1765,10 +1765,10 @@ static int handleSock5Proxy(const char *proxy_name, Curl_addrinfo *hp=NULL; int rc = Curl_resolv(conn, TRUE_HOSTNAME(conn), conn->remote_port, &dns); if(rc == -1) if(rc == CURLRESOLV_ERROR) return 1; if(rc == 1) if(rc == CURLRESOLV_PENDING) /* this requires that we're in "wait for resolve" state */ rc = Curl_wait_for_resolv(conn, &dns); Loading Loading @@ -3062,7 +3062,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* Resolve target host right on */ rc = Curl_resolv(conn, TRUE_HOSTNAME(conn), conn->port, &hostaddr); if(rc == 1) if(rc == CURLRESOLV_PENDING) *async = TRUE; else if(!hostaddr) { Loading @@ -3077,7 +3077,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* resolve proxy */ rc = Curl_resolv(conn, conn->proxyhost, conn->port, &hostaddr); if(rc == 1) if(rc == CURLRESOLV_PENDING) *async = TRUE; else if(!hostaddr) { Loading Loading
lib/connect.c +2 −2 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ static CURLcode bindlocal(struct connectdata *conn, * We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer */ rc = Curl_resolv(conn, myhost, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) (void)Curl_wait_for_resolv(conn, &h); if(h) Loading @@ -276,7 +276,7 @@ static CURLcode bindlocal(struct connectdata *conn, * or IP number */ rc = Curl_resolv(conn, data->set.device, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) (void)Curl_wait_for_resolv(conn, &h); if(h) Loading
lib/ftp.c +4 −4 Original line number Diff line number Diff line Loading @@ -1367,14 +1367,14 @@ CURLcode ftp_use_port(struct connectdata *conn) if((in == CURL_INADDR_NONE) && Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) { rc = Curl_resolv(conn, myhost, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &h); } else { size_t len = strlen(data->set.ftpport); if(len>1) { rc = Curl_resolv(conn, data->set.ftpport, 0, &h); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &h); } if(h) Loading Loading @@ -1642,7 +1642,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, * now, instead we remake the lookup here and now! */ rc = Curl_resolv(conn, conn->proxyhost, conn->port, &addr); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &addr); connectport = Loading @@ -1652,7 +1652,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, else { /* normal, direct, ftp connection */ rc = Curl_resolv(conn, newhostp, newport, &addr); if(rc == 1) if(rc == CURLRESOLV_PENDING) rc = Curl_wait_for_resolv(conn, &addr); if(!addr) { Loading
lib/hostip.c +13 −12 Original line number Diff line number Diff line Loading @@ -366,10 +366,11 @@ Curl_cache_addr(struct SessionHandle *data, * * Return codes: * * -1 = error, no pointer * 0 = OK, pointer provided * 1 = waiting for response, no pointer * CURLRESOLV_ERROR (-1) = error, no pointer * CURLRESOLV_RESOLVED (0) = OK, pointer provided * CURLRESOLV_PENDING (1) = waiting for response, no pointer */ int Curl_resolv(struct connectdata *conn, char *hostname, int port, Loading @@ -383,7 +384,7 @@ int Curl_resolv(struct connectdata *conn, CURLcode result; /* default to failure */ int rc = -1; int rc = CURLRESOLV_ERROR; *entry = NULL; #ifdef HAVE_SIGSETJMP Loading @@ -392,7 +393,7 @@ int Curl_resolv(struct connectdata *conn, if(!data->set.no_signal && sigsetjmp(curl_jmpenv, 1)) { /* this is coming from a siglongjmp() */ failf(data, "name lookup timed out"); return -1; return CURLRESOLV_ERROR; } #endif Loading @@ -400,7 +401,7 @@ int Curl_resolv(struct connectdata *conn, entry_id = create_hostcache_id(hostname, port, &entry_len); /* If we can't create the entry id, fail */ if (!entry_id) return -1; return CURLRESOLV_ERROR; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); Loading @@ -422,7 +423,7 @@ int Curl_resolv(struct connectdata *conn, /* Check what IP specifics the app has requested and if we can provide it. * If not, bail out. */ if(!Curl_ipvalid(data)) return -1; return CURLRESOLV_ERROR; /* If Curl_getaddrinfo() returns NULL, 'wait' might be set to a non-zero value indicating that we need to wait for the response to the resolve Loading @@ -436,11 +437,11 @@ int Curl_resolv(struct connectdata *conn, /* First, check that we haven't received the info by now */ result = Curl_is_resolved(conn, &dns); if(result) /* error detected */ return -1; return CURLRESOLV_ERROR; if(dns) rc = 0; /* pointer provided */ rc = CURLRESOLV_RESOLVED; /* pointer provided */ else rc = 1; /* no info yet */ rc = CURLRESOLV_PENDING; /* no info yet */ } } else { Loading @@ -457,12 +458,12 @@ int Curl_resolv(struct connectdata *conn, /* returned failure, bail out nicely */ Curl_freeaddrinfo(addr); else rc = 0; rc = CURLRESOLV_RESOLVED; } } else { dns->inuse++; /* we use it! */ rc = 0; rc = CURLRESOLV_RESOLVED; } *entry = dns; Loading
lib/hostip.h +10 −4 Original line number Diff line number Diff line Loading @@ -51,10 +51,12 @@ struct Curl_dns_entry { * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after * use, or we'll leak memory! */ int Curl_resolv(struct connectdata *conn, char *hostname, int port, struct Curl_dns_entry **dnsentry); /* return codes */ #define CURLRESOLV_ERROR -1 #define CURLRESOLV_RESOLVED 0 #define CURLRESOLV_PENDING 1 int Curl_resolv(struct connectdata *conn, char *hostname, int port, struct Curl_dns_entry **dnsentry); /* * Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've Loading Loading @@ -201,6 +203,10 @@ Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr, #define CURLRES_SYNCH #endif #ifndef USE_LIBIDN #define CURLRES_IDN #endif /* Allocate enough memory to hold the full name information structs and * everything. OSF1 is known to require at least 8872 bytes. The buffer * required for storing all possible aliases and IP numbers is according to Loading
lib/url.c +4 −4 Original line number Diff line number Diff line Loading @@ -1765,10 +1765,10 @@ static int handleSock5Proxy(const char *proxy_name, Curl_addrinfo *hp=NULL; int rc = Curl_resolv(conn, TRUE_HOSTNAME(conn), conn->remote_port, &dns); if(rc == -1) if(rc == CURLRESOLV_ERROR) return 1; if(rc == 1) if(rc == CURLRESOLV_PENDING) /* this requires that we're in "wait for resolve" state */ rc = Curl_wait_for_resolv(conn, &dns); Loading Loading @@ -3062,7 +3062,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* Resolve target host right on */ rc = Curl_resolv(conn, TRUE_HOSTNAME(conn), conn->port, &hostaddr); if(rc == 1) if(rc == CURLRESOLV_PENDING) *async = TRUE; else if(!hostaddr) { Loading @@ -3077,7 +3077,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* resolve proxy */ rc = Curl_resolv(conn, conn->proxyhost, conn->port, &hostaddr); if(rc == 1) if(rc == CURLRESOLV_PENDING) *async = TRUE; else if(!hostaddr) { Loading