From 275fcd0bb81d6b229dce84088627df9e567408a3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 13 Mar 2012 21:29:32 -0700 Subject: [PATCH] Do not return content from cacheByHTTP if the request errors, otherwise callers can process bad content, like SC assets expecting RSS feeds and getting 404 error pages. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Cache.pm | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 03f9ad4ec..6eb16b31c 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,7 @@ - RFE: 9730 (actually missing documentation) - fixed: Crud updateFromFormPost - fixed: encryptLogin and sslEnabled both need to be true + - fixed: Cache's setByHTTP method returns content, even when it gets an error in the request. This gives the SC asset fits. 7.10.24 - fixed #12318: asset error causes asset manager to fail diff --git a/lib/WebGUI/Cache.pm b/lib/WebGUI/Cache.pm index e21984e03..1a7b826b8 100644 --- a/lib/WebGUI/Cache.pm +++ b/lib/WebGUI/Cache.pm @@ -242,11 +242,11 @@ sub setByHTTP { my $response = $userAgent->request($request); if ($response->is_error) { $self->session->errorHandler->error($url." could not be retrieved."); + return undef; } - else { - $self->set($response->decoded_content,$ttl); - } - return $response->decoded_content; + my $value = $response->decoded_content; + $self->set($value ,$ttl); + return $value; } #-------------------------------------------------------------------