mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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.
This commit is contained in:
parent
ac317674b3
commit
379b561cdb
@ -188,18 +188,19 @@ class RSSFeed extends ViewableData {
|
|||||||
public function outputToBrowser() {
|
public function outputToBrowser() {
|
||||||
$prevState = SSViewer::get_source_file_comments();
|
$prevState = SSViewer::get_source_file_comments();
|
||||||
SSViewer::set_source_file_comments(false);
|
SSViewer::set_source_file_comments(false);
|
||||||
|
$response = Controller::curr()->getResponse();
|
||||||
|
|
||||||
if(is_int($this->lastModified)) {
|
if(is_int($this->lastModified)) {
|
||||||
HTTP::register_modification_timestamp($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)) {
|
if(!empty($this->etag)) {
|
||||||
HTTP::register_etag($this->etag);
|
HTTP::register_etag($this->etag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!headers_sent()) {
|
if(!headers_sent()) {
|
||||||
HTTP::add_cache_headers();
|
HTTP::add_cache_headers($response);
|
||||||
header("Content-type: text/xml");
|
$response->addHeader('Content-Type', 'text/xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
SSViewer::set_source_file_comments($prevState);
|
SSViewer::set_source_file_comments($prevState);
|
||||||
|
Loading…
Reference in New Issue
Block a user