safari is NOT sending back any request headers & i go nuts. i'm ashamed it took me all that time to realize it (sending back 304 since a while, never realized that safari issue until now)
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) or isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) echo $_SERVER['HTTP_IF_NONE_MATCH']."<br/>";
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) echo $_SERVER['HTTP_IF_MODIFIED_SINCE']."<br/>";
}
else {
header("Content-Type: text/html");
header("Last-Modified:Fri, 13 Dec 2001 20:45:54 GMT");
header("Etag".md5_file(__FILE__));
header("Expires:Fri, 13 Dec 2001 20:45:54 GMT") ;
header("Pragma: private");
header("Cache-Control:must-revalidate");
echo 'refresh to view last modified/etag headers sent back by browser<br/>;
}
Firefox speaks, chrome speaks, explorer speaks.
Safari is dumb.
reading this http://use.perl.org/~bart/journal/36598 would indicate that the problem comes from the format of the date sent to Safari in the last modified header. If that's so what's wrong with the format used above ?
have spent 3hours on tests and useless search. Now browsing the developper.apple website before giving up offering cache support for safari... maybe an internal setting, a mistake in copy pasting http formatted dates, a missing header...
thanks for your help
EDIT: that's the http headers sent by safari when refreshing the test script above, copied from the safari developper tools (resources)
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5