[curl] curl_slist_append

curl_slist_append

CURL *curl;
char host_header[256];
char vhost[256];
struct curl_slist *slist;

slist=0;
memset(host_header, 0, 256);
memset(vhost, 0, 256);

strncpy(vhost, "127.0.0.1", 9);
strncpy(host_header, "Host: ", 6);
strncat(host_header, vhost, 256-1-strlen(host_header));

slist = curl_slist_append(slist, host_header);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);

 

posted @ 2015-02-12 20:44  dzxs  阅读(3640)  评论(0编辑  收藏  举报