Rev 1050 | Rev 1096 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1050 | Rev 1068 | ||
---|---|---|---|
Line 136... | Line 136... | ||
136 | function httpOutWithETag($out, $contentType, $filename='') { |
136 | function httpOutWithETag($out, $contentType, $filename='') { |
137 | $etag = md5($out); |
137 | $etag = md5($out); |
138 | header("Etag: $etag"); |
138 | header("Etag: $etag"); |
139 | header("Content-MD5: $etag"); // RFC 2616 clause 14.15 |
139 | header("Content-MD5: $etag"); // RFC 2616 clause 14.15 |
140 | if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { |
140 | if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { |
141 | http_response_code(304); // 304 Not Modified |
141 | if (PHP_SAPI != 'cli') @http_response_code(304); // 304 Not Modified |
142 | } else { |
142 | } else { |
143 | header("Content-Type: $contentType"); |
143 | header("Content-Type: $contentType"); |
144 | if (!empty($filename)) { |
144 | if (!empty($filename)) { |
145 | header('Content-Disposition:inline; filename="'.$filename.'"'); |
145 | header('Content-Disposition:inline; filename="'.$filename.'"'); |
146 | } |
146 | } |