Differences From Artifact [12c6ca5e8d]:

To Artifact [83140b5668]:


871
872
873
874
875
876
877
878



879
880
881
882
883
884
885
886
887
888
889
890
891
892
    static public function HTTPCache(?string $hash, int $last_change): bool
    {
        $etag = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? trim($_SERVER['HTTP_IF_NONE_MATCH'], '"\' ') : null;
        $last_modified = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : null;

        $etag = $etag ? str_replace('-gzip', '', $etag) : null;

        header(sprintf('Last-Modified: %s GMT', gmdate('D, d M Y H:i:s', $last_change)));




        if ($hash) {
            header(sprintf('Etag: "%s"', $hash));
        }

        header('Cache-Control: private');

        if ($etag === $hash && $last_modified >= $last_change) {
            header('HTTP/1.1 304 Not Modified', true, 304);
            exit;
        }

        return false;
    }







|
>
>
>


|


<
<







871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886


887
888
889
890
891
892
893
    static public function HTTPCache(?string $hash, int $last_change): bool
    {
        $etag = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? trim($_SERVER['HTTP_IF_NONE_MATCH'], '"\' ') : null;
        $last_modified = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : null;

        $etag = $etag ? str_replace('-gzip', '', $etag) : null;

        header(sprintf('Last-Modified: %s GMT', gmdate('D, d M Y H:i:s', $last_change)), true);
        header(sprintf('Expires: %s GMT', gmdate('D, d M Y H:i:s', $last_change)), true);
        header('Cache-Control: private', true);
        header_remove('Pragma');

        if ($hash) {
            header(sprintf('Etag: "%s"', $hash), true);
        }



        if ($etag === $hash && $last_modified >= $last_change) {
            header('HTTP/1.1 304 Not Modified', true, 304);
            exit;
        }

        return false;
    }