curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

CURLE_COULDNT_RESOLVE_HOST from CURLU API on https://www.google.com

From: Samuel Marks via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 20 Aug 2021 15:39:25 +1000

I'm writing a tiny libcurl wrapper. I use curl_slist for headers, and
your CURLU (URL API) for urls.
https://github.com/SamuelMarks/curl-simple-https

In https://github.com/SamuelMarks/curl-simple-https/blob/90e16a9/libcurl_simple_https/curl_simple_https.c
the relevant lines that my `https_get` function get to are:

curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, urlp);
curl_easy_perform(curl);

Elsewhere, the urlp is set, e.g.,
https://github.com/SamuelMarks/curl-simple-https/blob/90e16a9/libcurl_simple_https/curl_simple_https/main.c

url = curl_url();
rc = curl_url_set(url, CURLUPART_URL, "https://google.com" /*args.url*/, 0);
struct ServerResponse response = https_get(url, NULL);
puts(response.body);
curl_url_cleanup(url);

Error-handling &etc. omitted in this mailing-list email for brevity.

AFAIK everything I'm doing is correct, as per the documentation.
However when I run the code on macOS (AppleClang, brew curl) or
Windows (MSVC, vcpkg curl) I get something like:
* IDN support not present, can't parse Unicode domains
* Could not resolve host: �
* Closing connection 0
curl operation failed: Couldn't resolve host name
����

I've tried `curl_url_get(urlp, CURLUPART_HOST, &host, 0)`, and
printing out `host` just before `curl_easy_perform` is called, but it
all looks fine at that juncture.

What am I doing wrong?

Thanks,

Samuel

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-08-20