Reputation: 605
To save time I want to define what ip resolves from what host so curl doesn't have to waste time doing this itself (the IP will be static)
I just want confirmation from people more experienced with curl that the way I'm doing it will actually prevent curl from attempting to resolve the IP:
curl_easy_setopt(curl, CURLOPT_URL, "https://xxx.xxx.xxx.xxx");
struct curl_slist* chunk = NULL;
chunk = curl_slist_append(chunk,"Host: website.com"); //(the website doesn't respond correctly if the host is not set)
std::string curl_hosts = "website.com:443:xxx.xxx.xxx.xxx";
std::string curl_hosts80 = "website.com:80:xxx.xxx.xxx.xxx";
host = curl_slist_append(host,curl_hosts.c_str());
host = curl_slist_append(host,curl_hosts80.c_str());
curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
Thanks.
Upvotes: 0
Views: 309