cURL / Mailing Lists / curl-library / Single Mail

curl-library

Wuery regarding "CURLOPT_FOLLOWLOCATION" option of libCurl

From: Arif Ali Saiyed <arif.ali.syed_at_gmail.com>
Date: Thu, 21 Aug 2014 19:13:42 +0530

Hello,

First of all thanks you so much for making life easier for so many
developers in the world by giving them libCurl and Curl.
Secondly I have a query regarding "CURLOPT_FOLLOWLOCATION" option of curl

I am using WebKit/WebView in the combination with libCurl.
I trap in all the HTTP request and serve them through curl.

when I launch say http://google.com it sends back redirct status code and
location.
and my Webkit/WebView would just a very tirny page where user has manually
click to
go to the redirected page.

While the desired behaviour would be that it would behave just like a
browser and
follow redirects.

I foudn out that there is some option like "CURLOPT_FOLLOWLOCATION" but
when I use it.
curl only gets the responseHeader alone from redirected location and not
the responsebody.

Is there any option that I could use to get the response Body as well of
redirected location?
or do I have to handle the redirection myself?

I think I am missing something here, there must be some option to get the
response body also while follwing
the redirection using "CURLOPT_FOLLOWLOCATION" but, otherwise
what would one use "CURLOPT_FOLLOWLOCATION" option for?

I read following post of yours
http://comments.gmane.org/gmane.comp.web.curl.library/9064

here author mentions following:

"When you set CURLOPT_FOLLOWLOCATION, you ask libcurl to follow locations
and
then it provides the body of the final page and not from any of those that
contain the Location: headers. That's a design decision I made many eons
ago."

I am not great at english but to me it looks like he meant that it will
return the response body of redirected location,
thats actually what i want( but its not working for me)\

In the same thread author also mentions
"If you want the full bodies, don't ask libcurl to follow the redirects but
handle that yourself."

Here it looks contradictory to my previous understanding of "when you set
CURLOPT_FOLLOWLOCATION"

What is this option "CURLOPT_REDIRBODIES" thats being talked about in some
places. I htink I have the latest version of libCurl.
But this option is not there.

-Arif

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-21