Skip to content

duphandle doesn't preserve CURLOPT_RESOLVE #2485

@ernstp

Description

@ernstp

I did this

struct curl_slist *host = curl_slist_append(NULL, "foo.net:80:127.0.0.1");

CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_RESOLVE, host);

CURL *c2 = curl_easy_duphandle(curl);
curl_easy_setopt(c2, CURLOPT_URL, "http://foo.net/");
curl_easy_perform(c2);

I expected the following

I expected my CURLOPT_RESOLVE to still have effect on c2. However it does not.
It's interesting that the message
"Added foo.net:80:127.0.0.1 to DNS cache"
never appears so it looks like it's neither done for the first curl handle nor c2.

Moving the setopt for RESOLVE to c2 works.

I can't really find anything in the documentation that would hint to this behaviour.

curl/libcurl version

curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0 (+libidn2/2.0.2) librtmp/2.3
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL

operating system

Linux/Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions