From d3337f36f06762dc7968ebc4ec39440aae8c526c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 30 Apr 2005 17:12:29 +0000
Subject: [PATCH] =?UTF-8?q?Fix:=20Correction=20de=20bugs=20dans=20magpiers?=
 =?UTF-8?q?s=20qui=20ne=20renvoie=20pas=20d'erreurs=20si=20echec=20cr=E9at?=
 =?UTF-8?q?ion=20socket.=20Je=20fix=20et=20marque=20dans=20source=20magpie?=
 =?UTF-8?q?rss=20par=20"LDR=20FIX=20BUG".?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/includes/magpierss/rss_fetch.inc | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/htdocs/includes/magpierss/rss_fetch.inc b/htdocs/includes/magpierss/rss_fetch.inc
index 87f0c497a25..972ac555175 100644
--- a/htdocs/includes/magpierss/rss_fetch.inc
+++ b/htdocs/includes/magpierss/rss_fetch.inc
@@ -94,7 +94,7 @@ function fetch_rss ($url) {
 		error("fetch_rss called without a url");
 		return false;
 	}
-	
+
 	// if cache is disabled
 	if ( !MAGPIE_CACHE_ON ) {
 		// fetch file, and parse it
@@ -158,7 +158,7 @@ function fetch_rss ($url) {
 		}
 		
 		$resp = _fetch_remote_file( $url, $request_headers );
-		
+
 		if (isset($resp) and $resp) {
 			if ($resp->status == '304' ) {
 				// we have the most current copy
@@ -185,12 +185,18 @@ function fetch_rss ($url) {
 				if ( $resp->error ) {
 					# compensate for Snoopy's annoying habbit to tacking
 					# on '\n'
-					$http_error = substr($resp->error, 0, -2); 
+					
+					// LDR FIX BUG
+					$http_error = eregi_replace("\n","",$resp->error); 
+
 					$errormsg .= "(HTTP Error: $http_error)";
 				}
 				else {
 					$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 {
@@ -206,7 +212,7 @@ function fetch_rss ($url) {
 			}
 			return $rss;
 		}
-		
+
 		// else we totally failed
 		error( $errormsg );	
 		
@@ -268,7 +274,7 @@ function _fetch_remote_file ($url, $headers = "" ) {
 	if (is_array($headers) ) {
 		$client->rawheaders = $headers;
 	}
-	
+
 	@$client->fetch($url);
 	return $client;
 
-- 
GitLab