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

Bug #6610 "Connection refused" dies hard
Submitted: 2006-01-27 18:06 UTC
From: serendipity at garv dot in Assigned:
Status: Bogus Package: HTTP_Request
PHP Version: 4.4.1 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 : 25 - 2 = ?

 
 [2006-01-27 18:06 UTC] serendipity at garv dot in
Description: ------------ Doing a HTTP_Request to a Host that replies with "Connection refused" makes PEAR die quite hard. The code below is a snippet from Serendipity, where this bug leads to a full stop of Serendipity. It dies with these messages: Connection refused Notice: Connection refused in /home/garvin/cvs/serendipity/trunk/bundled-libs/PEAR.php on line 848 Connection refused It would be nice, if this would not stop the whole process. :-) I hope that HTTP_Request is the right place to support this. I am not sure if it is a central PEAR.php or Net_Socket/URL problem. Test script: --------------- <?php require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; $options = array(); serendipity_plugin_api::hook_event('backend_http_request', $options, 'spartacus'); $req = &new HTTP_Request($url, $options); if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { printf(PLUGIN_EVENT_SPARTACUS_FETCHERROR, $url); echo '<br />'; if (file_exists($target) && filesize($target) > 0) { $data = file_get_contents($target); printf(PLUGIN_EVENT_SPARTACUS_FETCHED_BYTES_CACHE, strlen($data), $target); echo '<br />'; } } else { // Fetch file $data = $req->getResponseBody(); } ?> Expected result: ---------------- I would expect the script to emit the notice, but still continue the logic flow. Actual result: -------------- Connection refused Notice: Connection refused in /home/garvin/cvs/serendipity/trunk/bundled-libs/PEAR.php on line 848 Connection refused

Comments

 [2006-02-26 17:45 UTC] avb
I cannot reproduce this behaviour with "stock" versions of PEAR/Net_Socket/HTTP_Request: if connection cannot be established then a PEAR_Error object is returned, as expected. Judging by the error message, Serendipity uses some heavily modified version of PEAR libraries (there is no possibility of any refused connections in stock PEAR.php, error will be within Net/Socket.php). If you can provide a test script to reproduce this behaviour using stock versions of PEAR libraries, please do so.