From c0c553147d34a16b1f92071e35c8c08599d9e59a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Apr 2018 13:09:04 +0200 Subject: duphandle: make sure CURLOPT_RESOLVE is duplicated fine too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verified in test 1502 now Fixes #2485 Reported-by: Ernst Sjöstrand --- lib/easy.c | 3 +++ tests/libtest/lib1502.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/easy.c b/lib/easy.c index c99758617..6b914353d 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -892,6 +892,9 @@ static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src) /* Duplicate mime data. */ result = Curl_mime_duppart(&dst->set.mimepost, &src->set.mimepost); + if(src->set.resolve) + dst->change.resolve = dst->set.resolve; + return result; } diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c index 6f253c7ec..5b75e2f2a 100644 --- a/tests/libtest/lib1502.c +++ b/tests/libtest/lib1502.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,6 +40,7 @@ int test(char *URL) { CURL *easy = NULL; + CURL *dup; CURLM *multi = NULL; int still_running; int res = 0; @@ -72,6 +73,15 @@ int test(char *URL) easy_setopt(easy, CURLOPT_HEADER, 1L); easy_setopt(easy, CURLOPT_RESOLVE, dns_cache_list); + dup = curl_easy_duphandle(easy); + if(dup) { + curl_easy_cleanup(easy); + easy = dup; + } + else { + return CURLE_OUT_OF_MEMORY; + } + multi_init(multi); multi_add_handle(multi, easy); -- cgit v1.2.1