Curl_easy_perform: Failed to resolve hostname

I have a slightly strange problem with libcurl- it refuses to resolve a specific URL, returning the error message "Could not resolve hostname". He has no problem resolving other hosts. I suspect the reason is that a URL that does not work returns a 302 redirect, but I set the appropriate parameters for it.

Specified URL: http://servermods.cursecdn.com/files/922/48/worldedit-bukkit-6.1.3.jar

Relevant Code:

CURL* curl;
FILE* data;
std::string url;

// ...

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_FILE, data);
curl_easy_setopt(curl, CURLOPT_URL, url);

curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);

CURLcode res = curl_easy_perform(curl);
+4
source share
1 answer

libcurl char* CURLOPT_URL. string. .

+8

Source: https://habr.com/ru/post/1655719/


All Articles