cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Disables POST, goes with GET

From: Robert Iakobashvili <coroberti_at_gmail.com>
Date: Fri, 26 Jan 2007 09:49:59 +0200

Hi Shmulik,

On 1/24/07, Shmulik Regev <shmulbox_at_gmail.com> wrote:
> Hi,
>
> I'm using libcurl to simulate logins to a site that answers a login with a
> 302 (as many do). Instructing libcurl to follow redirects causes libcurl to
> respond to this 302 with a GET, i.e. I get the "Disables POST, goes with
> GET" debug message.
>
> However, the original Content-Length and Content-Type headers are still
> there, and in particular the existence of a non-zero Content-Length causes
> the server to not respond to the request (or so I guess) and the entire
> thing times out. Note that I used the HTTPHEADER option to manually set
> these two fields, hence the custom headers mechanism overrides libcurl's
> default behavior. Currently, I catch the debug info ('Disables POST, goes
> with GET') and call curl_easy_setopt(CURLOPT_HTTPHEADER)
> with empty Content-Length and Content-Type headers to remove them from the
> GET request. This does the trick but seems somewhat kludgey.
>
>
> My question is however, should libcurl automatically strip out these two
> headers (and possibly others) when following redirects and switching from
> POST to GET? If so, where would be the best place to do it?

Y may look as an example at curl-loader, that
follows redirected GETs and makes POSTs, when configured doing so.
See the link at the end of the e-mail.
libcurl itself may manage content-length size and etc and may be your
own header disturbs the magic.

Take care,

-- 
Sincerely,
Robert Iakobashvili,
coroberti %x40 gmail %x2e com
...................................................................
Navigare necesse est, vivere non est necesse
...................................................................
http://sourceforge.net/projects/curl-loader
A powerful open-source HTTP/S, FTP/S traffic
generating, loading and testing tool.
Received on 2007-01-26