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  


 [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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!