Bug #51198 [Opn->Bgs]: POSTing performs a GET with option CURLOPT_NOBODY=0

From: Date: Thu, 04 Mar 2010 12:48:25 +0000
Subject: Bug #51198 [Opn->Bgs]: POSTing performs a GET with option CURLOPT_NOBODY=0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148233@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51198&edit=1

 ID:               51198
 Updated by:       iliaa@php.net
 Reported by:      philippe dot gablain at gmail dot com
 Summary:          POSTing performs a GET with option CURLOPT_NOBODY=0
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          cURL related
 Operating System: Linux (ubuntu 9.10 FRA)
 PHP Version:      5.2.13

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

You cannot do a POST without a body.


Previous Comments:
------------------------------------------------------------------------
[2010-03-04 13:48:25] iliaa@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

You cannot do a POST without a body.

------------------------------------------------------------------------
[2010-03-03 17:14:14] philippe dot gablain at gmail dot com

Description:
------------
POSTing performs a GET. Seems to be related to option CURLOPT_NOBODY=0
as used in twitter's PHP clients like PHP_Twitter.

Removing this option corrects the issue. I'm not sure this is a bug, but
I think this still is an issue that needs (at least) to be documented.

Test script:
---------------
$headers=array('Expect:', 'X-Twitter-Client:
','X-Twitter-Client-Version: ','X-Twitter-Client-URL: ');

$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,"http://twitter.com/statuses/update.json");
curl_setopt ($ch, CURLOPT_POST, true);
//curl_setopt ($ch, CURLOPT_HTTPGET, false); - Does not affect
behaviour
curl_setopt ($ch, CURLOPT_POSTFIELDS, array('status'=>'hello world');
        
curl_setopt($ch, CURLOPT_USERPWD, 'twitter_user:twitter_pass');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLINFO_HEADER_OUT,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
        
$t=curl_getinfo($ch);
curl_close($ch);

echo $t;

Expected result:
----------------
HTTP/1.1 200 OK Date: Wed, 03 Mar 2010 16:10:15 GMT Server: hi Status:
200 OK X-Transaction: ... ETag: "..." Last-Modified: Wed, 03 Mar 2010
16:10:15 GMT X-Runtime: 0.08590 Content-Type: application/json;
charset=utf-8 Content-Length: 1113 Pragma: no-cache X-Revision: DEV
Expires: Tue, 31 Mar 1981 05:00:00 GMT Cache-Control: no-cache,
no-store, must-revalidate, pre-check=0, post-check=0 Set-Cookie:
guest_id= ... ; path=/ Set-Cookie: lang=fr; path=/ Set-Cookie:
_twitter_sess= ... ; domain=.twitter.com; path=/ Vary: Accept-Encoding
Connection: close 

.... (HTTP response Body) ...

Actual result:
--------------
HTTP/1.1 400 Bad Request Date: Wed, 03 Mar 2010 15:57:37 GMT Server: hi
Status: 400 Bad Request X-Transaction: ... X-RateLimit-Limit: 150
Last-Modified: Wed, 03 Mar 2010 15:57:37 GMT X-RateLimit-Remaining: 149
X-Runtime: 0.10008 Content-Type: application/json; charset=utf-8
Content-Length: 82 Pragma: no-cache X-RateLimit-Class: api X-Revision:
DEV Expires: Tue, 31 Mar 1981 05:00:00 GMT Cache-Control: no-cache,
no-store, must-revalidate, pre-check=0, post-check=0 X-RateLimit-Reset:
1267635457 Set-Cookie: guest_id= ... ; path=/ Set-Cookie: lang=fr;
path=/ Set-Cookie: _twitter_sess= ... ; domain=.twitter.com; path=/
Vary: Accept-Encoding Connection: close
{"request":"/statuses/update.json","error":"Cette m\u00e9thode
requiert
un POST."}


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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51198&edit=1


Thread (5 messages)

« previous php.bugs (#148233) next »