为了节省时间,我想定义什么ip从什么主机解析,所以curl不必浪费时间自己这样做(IP将是静态的)
我只是希望那些经验丰富的人确认我正在这样做的方式实际上会阻止curl尝试解析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);
感谢。