[dev] portal login stalling...

Eric Rostetter eric.rostetter at physics.utexas.edu
Tue Feb 25 11:52:05 PST 2003


Quoting Chuck Hagenbuch <chuck at horde.org>:

> I can confirm that this seems to be what's happening. Anyone have any
> ideas/patches for making the weather code a bit more fool/outage-proof?

Change the fopen() call to a fsockopen() call, and it takes care of itself.
Something like this really nasty patch that would really need to be cleaned
up and doesn't match HEAD since it was based on old HEAD code... :(

-            $fp = @fopen($weather->getUrl($location), 'rb');
+            preg_match("/^http:\/\/([^\/])+/(.*)/", $weather->getUrl($location));
+            $ejr_host = $matches[0]; $ejr_url = $matches[1];
+            $fp = @fsockopen($ejr_host, 80, $errno, $errstr, 60);
             if (!is_resource($fp)) {
                 $html .= '<span style="color:red">' . _("Error: could not
update weather.") . '</span><br>';
                 return;
             } else {
+                fputs($fp, "GET $ejr_url HTTP/1.0\r\n\r\n");
                 $xmlFile = Horde::bufferOutput('fpassthru', $fp);
             }

Another way to make it less of a problem would be to "touch" the cached
file when the update fails.  If your timeout was 1/2 hour, then only
one update attempt per half hour would hang, rather than each update attempt.
Not a real solution, but I thought I'd mention it.
 
> -chuck

-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

Why get even? Get odd!


More information about the dev mailing list