fix: use accept header when fetching feed (#2737)

* fix: use accept header when fetching feed

* fix: include atom too, and reuse constants from format classes

* add a catch all accept header
This commit is contained in:
Dag 2022-05-18 00:18:33 +02:00 committed by GitHub
parent 4007afdcf5
commit 1d0a0b927b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -91,7 +91,14 @@ abstract class FeedExpander extends BridgeAbstract {
/* Notice we do not use cache here on purpose:
* we want a fresh view of the RSS stream each time
*/
$content = getContents($url)
$mimeTypes = [
MrssFormat::MIME_TYPE,
AtomFormat::MIME_TYPE,
'*/*',
];
$httpHeaders = ['Accept: ' . implode(', ', $mimeTypes)];
$content = getContents($url, $httpHeaders)
or returnServerError('Could not request ' . $url);
$rssContent = simplexml_load_string(trim($content));