From 379b561cdbd599134196cd7801087f725d8fa993 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Wed, 12 Dec 2012 10:38:56 +1300 Subject: [PATCH] BUG RSSFeed now sets the Content-Type on the current HTTPResponse RSSFeed::outputToBrowser() used to use header() directly to set the content-type. This stopped ContentNegotiator from correctly detecting that it didn't need to convert the response, invalidating the XML. --- api/RSSFeed.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/RSSFeed.php b/api/RSSFeed.php index c565310ec..61d7269f9 100644 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -188,18 +188,19 @@ class RSSFeed extends ViewableData { public function outputToBrowser() { $prevState = SSViewer::get_source_file_comments(); SSViewer::set_source_file_comments(false); + $response = Controller::curr()->getResponse(); if(is_int($this->lastModified)) { HTTP::register_modification_timestamp($this->lastModified); - header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT'); + $response->addHeader('Last-Modified', gmdate("D, d M Y H:i:s", $this->lastModified) . ' GMT'); } if(!empty($this->etag)) { HTTP::register_etag($this->etag); } if(!headers_sent()) { - HTTP::add_cache_headers(); - header("Content-type: text/xml"); + HTTP::add_cache_headers($response); + $response->addHeader('Content-Type', 'text/xml'); } SSViewer::set_source_file_comments($prevState);