I don't know if this is related, but since I came across it today I thought I'd mention it.
Testing some stuff today, I came across a situation where the following happened:
1) Attempt to fetch with the "points" URL returned at 301 - Moved Permanently. As expected.
2) Attempt to fetch the redirected URL (the one with "gridpoints" in it) returned a 404.
The code didn't handle this well since it wasn't checking for >= 400 after the second fetchUrlWithoutHanging() call.
So... I copied the check from a few lines above and now the code that was:
$usingFile = "(retry forecast)";
$html = fetchUrlWithoutHanging($newurl, $cacheName);
$fSize = strlen($html);
$Status.= "<!-- loaded $usingFile $newurl - $fSize bytes -->\n";
... looks like this:
$usingFile = "(retry forecast)";
$html = fetchUrlWithoutHanging($newurl,$cacheName);
preg_match('/HTTP\/1.1 (\d+)/',$html,$m);
if(isset($m[1]) and $m[1] >= '400') {
$Force =2;
$Status .= "<!-- Oops.. point forecast unavailable RC=".$m[1]. " - using Zone instead -->\n";
}
else
{
$fSize = strlen($html);
$Status .= "<!-- loaded $usingFile $newurl - $fSize bytes -->\n";
}
... and it seems to cover this case, failing over to the Zone forecast.