diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-08-19 06:44:19 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-08-19 06:44:19 +0000 |
commit | c8c47768c76aac020adc2a7ebf5e45e3ea95abd9 (patch) | |
tree | d0dcb47635b17bff31b45a060cb619ad87b297e4 | |
parent | 62ff567c472838207c2a2409cf41e90dc3e6d6d6 (diff) |
Ling Thio pointed out that getaddrinfo() reverse-lookups ip-only names, and
this is an attempt to prevent it from doing that. affects ipv6-enabled only.
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | RELEASE-NOTES | 6 | ||||
-rw-r--r-- | lib/hostip6.c | 25 |
3 files changed, 28 insertions, 9 deletions
@@ -6,6 +6,12 @@ Changelog +Daniel (18 August 2004) +- Ling Thio pointed out that when libcurl is built ipv6-enabled, it still did + reverse DNS lookups when fed with a numerical IP-address (like + http://127.0.0.1/), although it doesn't when built ipv6-disabled. libcurl + should never do reverse lookups. + Daniel (17 August 2004) - Kjetil Jacobsen noticed that when transferring a file:// URL pointing to an empty file, libcurl would return with the file still open. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 527af2075..68eb42ad3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -14,6 +14,9 @@ This release includes the following changes: This release includes the following bugfixes: + o no more reverse DNS lookups when getting ip-only address with ipv6-enabled + libcurl + o libcurl works better multi-threaded on AIX (when built with xlc) o cookies over proxy didn't match the path properly o MSVC makefile fixes to build better o FTP response 530 on 'PASS' now sends back a better error message @@ -25,6 +28,7 @@ Other curl-related news since the previous public release: This release would not have looked like this without help, code, reports and advice from friends like these: - Casey O'Donnell, Roland Krikava, Alex + Casey O'Donnell, Roland Krikava, Alex, Alexander Krasnostavsky, Kjetil + Jacobsen, Ling Thio Thanks! (and sorry if I forgot to mention someone) diff --git a/lib/hostip6.c b/lib/hostip6.c index 7b0091d4c..596a5733d 100644 --- a/lib/hostip6.c +++ b/lib/hostip6.c @@ -1,8 +1,8 @@ /*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. @@ -10,7 +10,7 @@ * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. - * + * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. @@ -208,9 +208,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, struct addrinfo hints, *res; int error; char sbuf[NI_MAXSERV]; + char addrbuf[128]; curl_socket_t s; int pf; struct SessionHandle *data = conn->data; + int ai_flags; *waitp=0; /* don't wait, we have the response now */ @@ -244,15 +246,22 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, break; } } - + + if(1 == inet_pton(pf, addrbuf, sizeof(addrbuf))) { + /* the given address is numerical only, prevent a reverse lookup */ + ai_flags = AI_NUMERICHOST; + } + else + ai_flags = AI_CANONNAME; + memset(&hints, 0, sizeof(hints)); hints.ai_family = pf; hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_CANONNAME; + hints.ai_flags = ai_flags; snprintf(sbuf, sizeof(sbuf), "%d", port); error = getaddrinfo(hostname, sbuf, &hints, &res); if (error) { - infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port); + infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port); return NULL; } |