Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.5

Request #2562 Net_Curl isn't able to determine status code
Submitted: 2004-10-18 16:26 UTC
From: robin dot ericsson at profecta dot se Assigned:
Status: Closed Package: Net_Curl
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 28 + 25 = ?

 
 [2004-10-18 16:26 UTC] robin dot ericsson at profecta dot se
Description: ------------ Net_Curl isn't able to determine whether the current url resultet in 200 OK or error of some kind. Using the attached patch Net_Curl throws and PEAR_Error if status-code is something else that 2XX. (Maybe this could be changed to something else, but atleast the general idea is here. Reproduce code: --------------- --- Curl.php.old 2004-09-09 16:08:19.304143936 +0200 +++ Curl.php 2004-09-09 16:15:25.000428264 +0200 @@ -421,12 +421,18 @@ $ret = curl_exec($ch); + $info = curl_getinfo($ch); + $http_code = (string) $info['http_code']; if (!$ret) { $errObj = new PEAR_Error(curl_error($ch), curl_errno($ch)); $this->error =& $errObj; return($errObj); + } else if ($http_code != '' && $http_code{0} != '2') { + $errObj = new PEAR_Error('Unexpected HTTP-code found: '.$info['http_code']); + $this->error =& $errObj; + return($errObj); } - + return($ret); } Expected result: ---------------- To get some sort of error when page return other than 200 OK

Comments

 [2005-07-13 21:56 UTC] joe at joestump dot net
 [2005-07-28 02:32 UTC] jstump
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Net_Curl