cURL / Mailing Lists / curl-library / Single Mail

curl-library

Query about HTTP Redirection

From: Shweta Devale <shweta.devale_at_gmail.com>
Date: Wed, 26 Sep 2012 15:28:17 +0530

Hi,

I got one patch at following link.
http://curl.haxx.se/mail/lib-2012-01/0184.html

I have used this patch and updated libcurl. Now I have written a
program where I am using curl_seay_setopt(curl,
CURLOPT_REDIRECTDATA,clientptr ).
Here clientptr is declared as void *clientptr.

My query is how can I set this clientptr i.e to what value should I
set for this pointer?

My Program :

CURLcode on_redirection(void *clientp,char *redirurl)
{
    printf("nn Request Redirected....nn");
    return CURLE_OK;
}

int main()
{
        CURL *curl;
        CURLcode rc;
        char *url="http://www.stackoverflow.com";
        void *clientptr;

     curl = curl_easy_init();
     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
     curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
     curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 2);
     curl_easy_setopt(curl, CURLOPT_URL, url);
     curl_easy_setopt(curl,CURLOPT_REDIRECTFUNCTION, on_redirection);
     curl_easy_setopt(curl, CURLOPT_REDIRECTDATA,clientptr );
     curl_easy_setopt(curl, CURLOPT_HTTPHEADER, 0);
     curl_easy_setopt(curl, CURLOPT_HTTPPOST, 0);

     rc = curl_easy_perform(curl);

     curl_easy_cleanup(curl);
     return 0;
}

-- 
With Regards,
Shweta.
-- 
With Regards,
Shweta.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-09-26