Skip to content

Commit

Permalink
fix: use accept header when fetching feed (RSS-Bridge#2737)
Browse files Browse the repository at this point in the history
* fix: use accept header when fetching feed

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

* add a catch all accept header
  • Loading branch information
dvikan authored May 17, 2022
1 parent 4007afd commit 1d0a0b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/FeedExpander.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ public function collectExpandableDatas($url, $maxItems = -1){
/* 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));

Expand Down

0 comments on commit 1d0a0b9

Please sign in to comment.