Minor optimizations on static file serve
This commit is contained in:
parent
95805d2e7c
commit
c96a1632f5
6
boot.php
6
boot.php
@ -919,8 +919,7 @@ class App {
|
|||||||
$staticfilecwd = getcwd();
|
$staticfilecwd = getcwd();
|
||||||
$staticfilerealpath = realpath(self::$cmd);
|
$staticfilerealpath = realpath(self::$cmd);
|
||||||
if(strpos($staticfilerealpath,$staticfilecwd) !== 0) {
|
if(strpos($staticfilerealpath,$staticfilecwd) !== 0) {
|
||||||
header("HTTP/1.1 404 Not Found", true, 404);
|
http_status_exit(404,'not found');
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$staticfileetag = '"'.md5($staticfilerealpath.filemtime(self::$cmd)).'"';
|
$staticfileetag = '"'.md5($staticfilerealpath.filemtime(self::$cmd)).'"';
|
||||||
@ -930,8 +929,7 @@ class App {
|
|||||||
// If HTTP_IF_NONE_MATCH is same as the generated ETag => content is the same as browser cache
|
// If HTTP_IF_NONE_MATCH is same as the generated ETag => content is the same as browser cache
|
||||||
// So send a 304 Not Modified response header and exit
|
// So send a 304 Not Modified response header and exit
|
||||||
if($_SERVER['HTTP_IF_NONE_MATCH'] == $staticfileetag) {
|
if($_SERVER['HTTP_IF_NONE_MATCH'] == $staticfileetag) {
|
||||||
header('HTTP/1.1 304 Not Modified', true, 304);
|
http_status_exit(304,'not modified');
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header("Content-type: ".$serve_rawfiles[$filext]);
|
header("Content-type: ".$serve_rawfiles[$filext]);
|
||||||
|
Reference in New Issue
Block a user