cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Request Custom Headers

From: Manuel Arguelles <manuel.arguelles_at_wirelesszt.com>
Date: Thu, 12 Jan 2006 06:37:20 -0500

Sorry found my error... please discard this message...

Thanks

On Thu 12 Jan 2006 06:21, Manuel Arguelles wrote:
> Hello list,
>
> I'm trying to implement a simple proxy using libcurl, one of the
> requirements of this proxy is to set a custom http header to all the
> request that will pass through it, I have followed the documentation and
> everything but it's not working, this is how I'm doing it:
>
>
> struct curl_slist *headers=NULL;
> curl_easy_setopt(curl, CURLOPT_URL, url);
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
> curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
>
> headers = curl_slist_append(headers, "X-PROXY-ID: abcdefg");
> headers = curl_slist_append(headers, "X-PROXY-STATUS: valid");
> headers = curl_slist_append(headers, "Accept: Agent-007");
>
>
> curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
> curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
>
>
> curl_easy_setopt(curl, CURLOPT_AUTOREFERER, 1);
> curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
>
>
> curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
> res = curl_easy_perform(curl);
>
> I point it to a simple php script (localhost/index.php) that prints all the
> headers and I can't see the custom headers that I add, also the Accept
> header don't get modified either... what am I doing wrong??
>
> btw, do anyone knows where to find a simple proxy code that uses libcurl?
>
> Thanks
Received on 2006-01-12