diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-11-03 16:24:56 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-11-03 16:24:56 +0000 |
commit | d0b8b5a1990a31f37fcab925cb8b59bee958d41d (patch) | |
tree | 01f76987f143f68e2a4633f7cae8dcdc4b22a556 /lib/url.c | |
parent | efe2ce3647b751d137c105c3b08b8290fb1f801c (diff) |
- Bug #2218480 (http://curl.haxx.se/bug/view.cgi?id=2218480) pointed out a
problem with my CURLINFO_PRIMARY_IP fix from October 7th that caused a NULL
pointer read. I also took the opportunity to clean up this logic (storing of
the connection's IP address) somewhat as we had it stored in two different
places and ways previously and they are now unified.
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 60 |
1 files changed, 28 insertions, 32 deletions
@@ -2174,7 +2174,6 @@ static void conn_free(struct connectdata *conn) Curl_safefree(conn->allocptr.ref); Curl_safefree(conn->allocptr.host); Curl_safefree(conn->allocptr.cookiehost); - Curl_safefree(conn->ip_addr_str); Curl_safefree(conn->trailer); Curl_safefree(conn->host.rawalloc); /* host name buffer */ Curl_safefree(conn->proxy.rawalloc); /* proxy name buffer */ @@ -2479,9 +2478,9 @@ ConnectionExists(struct SessionHandle *data, } #ifdef CURLRES_ASYNCH - /* ip_addr_str is NULL only if the resolving of the name hasn't completed - yet and until then we don't re-use this connection */ - if(!check->ip_addr_str) { + /* ip_addr_str[0] is NUL only if the resolving of the name hasn't + completed yet and until then we don't re-use this connection */ + if(!check->ip_addr_str[0]) { infof(data, "Connection #%ld hasn't finished name resolve, can't reuse\n", check->connectindex); @@ -2727,36 +2726,33 @@ static CURLcode ConnectPlease(struct SessionHandle *data, conn->dns_entry = hostaddr; conn->ip_addr = addr; - result = Curl_store_ip_addr(conn); - - if(CURLE_OK == result) { - switch(data->set.proxytype) { + switch(data->set.proxytype) { #ifndef CURL_DISABLE_PROXY - case CURLPROXY_SOCKS5: - case CURLPROXY_SOCKS5_HOSTNAME: - result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, - conn->host.name, conn->remote_port, - FIRSTSOCKET, conn); - break; - case CURLPROXY_SOCKS4: - result = Curl_SOCKS4(conn->proxyuser, conn->host.name, - conn->remote_port, FIRSTSOCKET, conn, FALSE); - break; - case CURLPROXY_SOCKS4A: - result = Curl_SOCKS4(conn->proxyuser, conn->host.name, - conn->remote_port, FIRSTSOCKET, conn, TRUE); - break; + case CURLPROXY_SOCKS5: + case CURLPROXY_SOCKS5_HOSTNAME: + result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, + conn->host.name, conn->remote_port, + FIRSTSOCKET, conn); + break; + case CURLPROXY_SOCKS4: + result = Curl_SOCKS4(conn->proxyuser, conn->host.name, + conn->remote_port, FIRSTSOCKET, conn, FALSE); + break; + case CURLPROXY_SOCKS4A: + result = Curl_SOCKS4(conn->proxyuser, conn->host.name, + conn->remote_port, FIRSTSOCKET, conn, TRUE); + break; #endif /* CURL_DISABLE_PROXY */ - case CURLPROXY_HTTP: - /* do nothing here. handled later. */ - break; - default: - failf(data, "unknown proxytype option given"); - result = CURLE_COULDNT_CONNECT; - break; - } - } - } + case CURLPROXY_HTTP: + /* do nothing here. handled later. */ + break; + default: + failf(data, "unknown proxytype option given"); + result = CURLE_COULDNT_CONNECT; + break; + } /* switch proxytype */ + } /* if result is ok */ + if(result) *connected = FALSE; /* mark it as not connected */ |