Bug #51198 [NEW]: POSTing performs a GET with option CURLOPT_NOBODY=0

From: Date: Wed, 03 Mar 2010 16:14:17 +0000
Subject: Bug #51198 [NEW]: POSTing performs a GET with option CURLOPT_NOBODY=0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148220@lists.php.net to get a copy of this message
From: Operating system: Linux (ubuntu 9.10 FRA) PHP version: 5.2.13 Package: cURL related Bug Type: Bug Bug description:POSTing performs a GET with option CURLOPT_NOBODY=0 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 bug report at http://bugs.php.net/bug.php?id=51198&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51198&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51198&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51198&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51198&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51198&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51198&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51198&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51198&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51198&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51198&r=support Expected behavior: http://bugs.php.net/fix.php?id=51198&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51198&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51198&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51198&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51198&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51198&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51198&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51198&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51198&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51198&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51198&r=mysqlcfg

« previous php.bugs (#148220) next »