Skip to content
Snippets Groups Projects
Commit d3337f36 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Correction de bugs dans magpierss qui ne renvoie pas d'erreurs si echec...

Fix: Correction de bugs dans magpierss qui ne renvoie pas d'erreurs si echec création socket. Je fix et marque dans source magpierss par "LDR FIX BUG".
parent 3bc5a9ff
Branches
Tags
No related merge requests found
...@@ -94,7 +94,7 @@ function fetch_rss ($url) { ...@@ -94,7 +94,7 @@ function fetch_rss ($url) {
error("fetch_rss called without a url"); error("fetch_rss called without a url");
return false; return false;
} }
// if cache is disabled // if cache is disabled
if ( !MAGPIE_CACHE_ON ) { if ( !MAGPIE_CACHE_ON ) {
// fetch file, and parse it // fetch file, and parse it
...@@ -158,7 +158,7 @@ function fetch_rss ($url) { ...@@ -158,7 +158,7 @@ function fetch_rss ($url) {
} }
$resp = _fetch_remote_file( $url, $request_headers ); $resp = _fetch_remote_file( $url, $request_headers );
if (isset($resp) and $resp) { if (isset($resp) and $resp) {
if ($resp->status == '304' ) { if ($resp->status == '304' ) {
// we have the most current copy // we have the most current copy
...@@ -185,12 +185,18 @@ function fetch_rss ($url) { ...@@ -185,12 +185,18 @@ function fetch_rss ($url) {
if ( $resp->error ) { if ( $resp->error ) {
# compensate for Snoopy's annoying habbit to tacking # compensate for Snoopy's annoying habbit to tacking
# on '\n' # on '\n'
$http_error = substr($resp->error, 0, -2);
// LDR FIX BUG
$http_error = eregi_replace("\n","",$resp->error);
$errormsg .= "(HTTP Error: $http_error)"; $errormsg .= "(HTTP Error: $http_error)";
} }
else { else {
$errormsg .= "(HTTP Response: " . $resp->response_code .')'; $errormsg .= "(HTTP Response: " . $resp->response_code .')';
} }
// LDR FIX BUG Si echec recup http mais cache bien lu, on stock erreur dans object rss
if ($rss) $rss->ERROR=$errormsg;
} }
} }
else { else {
...@@ -206,7 +212,7 @@ function fetch_rss ($url) { ...@@ -206,7 +212,7 @@ function fetch_rss ($url) {
} }
return $rss; return $rss;
} }
// else we totally failed // else we totally failed
error( $errormsg ); error( $errormsg );
...@@ -268,7 +274,7 @@ function _fetch_remote_file ($url, $headers = "" ) { ...@@ -268,7 +274,7 @@ function _fetch_remote_file ($url, $headers = "" ) {
if (is_array($headers) ) { if (is_array($headers) ) {
$client->rawheaders = $headers; $client->rawheaders = $headers;
} }
@$client->fetch($url); @$client->fetch($url);
return $client; return $client;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment