Browse Source

Add response headers.

... Still need to react to requests.
pull/393/head
Adam Vessey 11 years ago
parent
commit
d59099aab4
  1. 13
      includes/datastream.inc

13
includes/datastream.inc

@ -46,9 +46,20 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F
}
}
header_remove('Cache-Control');
header_remove('Expires');
header('Content-type: ' . $datastream->mimetype);
$cache_control = array();
if ($datastream->parent->repository->api->connection->username == 'anonymous') {
$cache_control[] = 'public';
}
else {
$cache_control[] = 'private';
}
$cache_control[] = 'must-revalidate';
header('Cache-Control: ' . implode(', ', $cache_control));
header('Last-Modified: '. $datastream->createdDate->format('D, d M Y H:i:s \G\M\T'));
header('Etag: "' . $datastream->createdDate->format('Uu') . '"');
if ($datastream->controlGroup == 'M' || $datastream->controlGroup == 'X') {
header('Content-length: ' . $datastream->size);
}

Loading…
Cancel
Save