aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-04-24 11:13:17 +0200
committerMax Kostikov <max@kostikov.co>2019-04-24 11:13:17 +0200
commit9104933b181a22799a799afed2c1db9467b8f586 (patch)
tree673aaf5f1773c1bf5f220444eba7c07a8e9aa936
parent54f95389a828c50fb861f5ba2efa5ef569a17647 (diff)
downloadvolse-hubzilla-9104933b181a22799a799afed2c1db9467b8f586.tar.gz
volse-hubzilla-9104933b181a22799a799afed2c1db9467b8f586.tar.bz2
volse-hubzilla-9104933b181a22799a799afed2c1db9467b8f586.zip
Add modified date in Etag hash calculation
-rw-r--r--Zotlabs/Module/Photo.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php
index 7e25e08b2..74b2ef45d 100644
--- a/Zotlabs/Module/Photo.php
+++ b/Zotlabs/Module/Photo.php
@@ -95,7 +95,7 @@ class Photo extends \Zotlabs\Web\Controller {
$default = $d['default'];
$data = $d['data'];
$mimetype = $d['mimetype'];
- $modified = time();
+ $modified = 0;
}
if(! $data) {
@@ -220,10 +220,15 @@ class Photo extends \Zotlabs\Web\Controller {
if(! $data)
killme();
+
+ $etag = md5($data . $modified);
+
+ if($modified == 0)
+ $modified = time();
header_remove('Pragma');
- if($_SERVER['HTTP_IF_NONE_MATCH'] === md5($data) || $_SERVER['HTTP_IF_MODIFIED_SINCE'] === gmdate("D, d M Y H:i:s", $modified) . " GMT") {
+ if($_SERVER['HTTP_IF_NONE_MATCH'] === $etag || $_SERVER['HTTP_IF_MODIFIED_SINCE'] === gmdate("D, d M Y H:i:s", $modified) . " GMT") {
header_remove('Expires');
header_remove('Cache-Control');
header_remove('Set-Cookie');
@@ -272,7 +277,7 @@ class Photo extends \Zotlabs\Web\Controller {
header("Content-type: " . $mimetype);
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modified) . " GMT");
- header("ETag: " . md5($data));
+ header("ETag: " . $etag);
header("Content-Length: " . (isset($filesize) ? $filesize : strlen($data)));
// If it's a file resource, stream it.