cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2010735 ] setting a CURLOPT_NOBODY option forces GET request

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 04 Jul 2008 18:01:38 +0000

Bugs item #2010735, was opened at 2008-07-04 08:34
Message generated for change (Comment added) made by dfandrich
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2010735&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: http
Group: wrong behaviour
Status: Open
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Grigori Kochanov (kgrigori)
Assigned to: Daniel Stenberg (bagder)
Summary: setting a CURLOPT_NOBODY option forces GET request

Initial Comment:
Hi,
when my Fedora Core auto-upgraded curl to 7.18.2 a problem appeared.

In my PHP scripts I use CURL for POST requests.

This code sends a basic POST request:
<?php
$url= "http://example.com/test.php";
$ch = curl_init($url);

curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch,CURLOPT_POSTFIELDS, 'test=test&submint=submit');
//curl_setopt($ch,CURLOPT_NOBODY,0);

//echo $Curl->exec();
echo curl_exec($ch);
?>

If I uncomment CURLOPT_NOBODY option with any value, it will send GET request instead of POST.

Thanks, Grigori

----------------------------------------------------------------------

>Comment By: Dan Fandrich (dfandrich)
Date: 2008-07-04 11:01

Message:
Logged In: YES
user_id=236775
Originator: NO

This is by design, to wit (from the changelog):

  Setting CURLOPT_NOBODY to FALSE will now switch the HTTP request method
to
  GET simply because previously when you set CURLOPT_NOBODY to TRUE first
and
  then FALSE you'd end up in a broken state where a HTTP request would do
a
  HEAD by still act a lot like for a GET and hang waiting for the content
etc.

And (from the man page):

  If you issue a POST request and then want to make a
  HEAD or GET using the same re-used handle, you must
  explicitly set the new request type using CUR
  LOPT_NOBODY or CURLOPT_HTTPGET or similar.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2010735&group_id=976
Received on 2008-07-04

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET