diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-15 14:56:07 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-15 14:56:07 +0000 |
| commit | 2b623dde04e87e612f642fec177e10b90b7e2d04 (patch) | |
| tree | 3d5ec9d8a84e49c1ca68d86395c55d8a4967cfc8 | |
| parent | 1e2f4dd50611635e51f8cea8c431ecf0a65db6f6 (diff) | |
Make images and files more cacheable: issue 304 errors more often
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@331 7be80a69-a1ef-0310-a953-fb0f7c49ff36
| -rw-r--r-- | wp-inst/wp-content/blogs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wp-inst/wp-content/blogs b/wp-inst/wp-content/blogs index c1ed2ca..86def62 100644 --- a/wp-inst/wp-content/blogs +++ b/wp-inst/wp-content/blogs @@ -11,12 +11,15 @@ if( is_file( $file ) ) { $headers = apache_request_headers(); // get mime type $ext = substr( $_SERVER[ 'REQUEST_URI' ], strrpos( $_SERVER[ 'REQUEST_URI' ], '.' ) + 1 ); - if( $ext == 'jpg' ) - $ext = 'jpeg'; - $mimetype = "image/$ext"; + $ext_list = array( "jpg" => "image/jpeg", "mp3" => "audio/mpeg", "mov" => "video/quicktime" ); + if( $ext_list[ $ext ] ) { + $mimetype = $ext_list[ $ext ]; + } else { + $mimetype = "image/$ext"; + } // from http://blog.rd2inc.com/archives/2005/03/24/making-dynamic-php-pages-cacheable/ - if( $lastModified == $headers['If-Modified-Since']) { + if( $headers[ 'If-Range' ] == '"' . $etag . '"' || $lastModified == $headers['If-Modified-Since']) { // They already have an up to date copy so tell them header('HTTP/1.1 304 Not Modified'); header('Cache-Control: private'); |
