From 19f45eaa799a77d5c67cbefe3342f27774e2e6f8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 21 Sep 2010 16:41:14 +0200 Subject: [PATCH] duphandle: use ares_dup() curl_easy_duphandle() was not properly duping the ares channel. The ares_dup() function was introduced in c-ares 1.6.0 so by starting to use this function we also raise the bar and require c-ares >= 1.6.0 (released Dec 9, 2008) for such builds. Reported by: Ning Dong Bug: http://curl.haxx.se/mail/lib-2010-08/0318.html --- docs/INTERNALS | 2 +- lib/easy.c | 5 +++-- m4/curl-confopts.m4 | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/INTERNALS b/docs/INTERNALS index 54119cf..9d0bdba 100644 --- a/docs/INTERNALS +++ b/docs/INTERNALS @@ -37,7 +37,7 @@ Portability GnuTLS 1.2 zlib 1.1.4 libssh2 0.16 - c-ares 1.5.0 + c-ares 1.6.0 libidn 0.4.1 *yassl 1.4.0 (http://curl.haxx.se/mail/lib-2008-02/0093.html) openldap 2.0 diff --git a/lib/easy.c b/lib/easy.c index bebeeb1..1f839fe 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -700,8 +700,9 @@ CURL *curl_easy_duphandle(CURL *incurl) } #ifdef USE_ARES - /* If we use ares, we setup a new ares channel for the new handle */ - if(ARES_SUCCESS != ares_init(&outcurl->state.areschannel)) + /* If we use ares, we clone the ares channel for the new handle */ + if(ARES_SUCCESS != ares_dup(&outcurl->state.areschannel, + data->state.areschannel)) break; #endif diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4 index 11fdd53..bb25bb9 100644 --- a/m4/curl-confopts.m4 +++ b/m4/curl-confopts.m4 @@ -472,6 +472,7 @@ AC_DEFUN([CURL_CHECK_LIB_ARES], [ ares_channel channel; ares_cancel(channel); /* added in 1.2.0 */ ares_process_fd(channel, 0, 0); /* added in 1.4.0 */ + ares_dup(&channel, channel); /* added in 1.6.0 */ ]]) ],[ AC_MSG_RESULT([yes]) -- 2.7.4