Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for Safari's 304 caching 'bug'

Closes #109
commit 3fe746e2522eb08e98976c1ca946fd2d3e496baa 1 parent 8af32c0
@kolber authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 app/stacey.inc.php
View
5 app/stacey.inc.php
@@ -68,6 +68,9 @@ function set_content_type($template_file) {
function etag_expired($cache) {
header('Etag: "'.$cache->hash.'"');
+ # Safari incorrectly caches 304s as empty pages, so don't serve it 304s
+ if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false) return true;
+ # Check for a local cache
if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) == '"'.$cache->hash.'"') {
# local cache is still fresh, so return 304
header("HTTP/1.0 304 Not Modified");
@@ -158,4 +161,4 @@ function __construct($get) {
}
-?>
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.