cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Object Moved/Location cut-off ?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 25 Jun 2002 00:44:44 +0200 (MET DST)

On Mon, 24 Jun 2002, Morph wrote:

> > > They also send back an "Object Moved" header with the "Location:" of
> > > where I need to send curl next.
> >
> > ... unless you tell curl to do it, then you won't have to do it yourself.

> How do I tell curl to follow the "Location:" redirect?

Set CURLOPT_FOLLOWLOCATION to TRUE.

> > > Location: http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll?
> >
> > This seems veeeery strange. Have you tried using a network analyzer or
> > anything to see if this really is curl not reading the full header or if
> > the header arrives broken?

> I tried using the command line version of curl, which seems to work fine.

Well, that would at least indicate that it is your usage of libcurl that is
wrong, not the library itself.

> // If there is POST data, use it, in GET mode.
> if(plug_args->post_data[0]!='\0') {

> curl_easy_setopt(plug_args->curl_handle,
> CURLOPT_POSTFIELDS, plug_args->post_data);
> curl_easy_setopt(plug_args->curl_handle, CURLOPT_HTTPGET,
> TRUE);

You should not use POSTFIELDS if you wanna GET data. POSTFIELDS is for POST
requests. You would need to append that data to the URL string.

The curl command line tool offers the -G options that "converts" post
arguments into a GET, but that is completely client-side and not a library
feature.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-25