[RCU] How to configure timeout on external http calls

Krishna PMV krishna.pmv at gmail.com
Mon Jul 9 12:30:59 CEST 2012


hey Alec,

On Mon, Jul 9, 2012 at 1:33 PM, A.L.E.C <alec at alec.pl> wrote:

> On 07/09/2012 07:17 AM, Krishna PMV wrote:
> > Ok, it turns out to be a bug in roundcube here:
> >
> https://svn.roundcube.net/trunk/roundcubemail/program/steps/utils/modcss.inc
> >
> > Its neatly explained here:
> > http://in2.php.net/manual/en/function.stream-set-timeout.php#71274
>
> I think there was a similiar issue in IMAP connections handling.


I see in the version we are using ( 0.6-81336) , its handled well.



> Please, try with this patch.
>

We've applied the following patch for this already. Hopefully it should
work. Thanks a ton for your patch anyways.

--- modcss.inc.      2012-07-09 03:56:02.000000000 -0400
+++ modcss.inc  2012-07-09 04:00:05.000000000 -0400
@@ -49,6 +49,8 @@

 // set timeout for socket
 stream_set_timeout($fp, 30);
+stream_set_blocking($fp, TRUE);
+$info = stream_get_meta_data($fp);

 // send request
 $out  = "GET $path HTTP/1.0\r\n";
@@ -59,7 +61,8 @@
 // read response
 $header = true;
 $headers = array();
-while (!feof($fp)) {
+while ((!feof($fp)) && (!$info['timed_out'])) {
     $line = trim(fgets($fp, 4048));

     if ($header) {
@@ -78,6 +81,7 @@
     else {
         $source .= "$line\n";
     }
+   $info = stream_get_meta_data($fp);
 }
 fclose($fp);


-Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.roundcube.net/pipermail/users/attachments/20120709/1be54e1d/attachment.html>


More information about the users mailing list