We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 128a00c4 authored by mattl's avatar mattl

Include feeds in Link HTTP headers, for easier discovery

parent 1d0a448e
......@@ -62,6 +62,11 @@ class Feed
$this->title = $title;
}
function getUrl()
{
return $this->url;
}
function mimeType()
{
switch ($this->type) {
......
......@@ -34,6 +34,18 @@ abstract class NoticestreamAction extends ProfileAction
// pass by default
}
public function extraHeaders()
{
parent::extraHeaders();
foreach ($this->getFeeds() as $feed) {
header('Link: <'.htmlspecialchars($feed->getUrl()).'>;' .
' rel="'.htmlspecialchars($feed->rel()).'";' .
' type="'.htmlspecialchars($feed->mimeType()).'"',
false // don't overwrite previous headers of this sort
);
}
}
// this fetches the NoticeStream
abstract public function getStream();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment