[wp-trac] [WordPress Trac] #23123: ms-files.php: 304 Not Modified includes Content-Length with filesize

WordPress Trac noreply at wordpress.org
Fri Jan 4 23:24:41 UTC 2013


#23123: ms-files.php: 304 Not Modified includes Content-Length with filesize
-----------------------------+--------------------------
 Reporter:  v-media          |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Multisite
  Version:  3.5              |   Severity:  normal
 Keywords:  needs-patch      |
-----------------------------+--------------------------
 Here are the HTTP headers that are got from the server when you request an
 attached file from WP Network Installation site:

 {{{
 HTTP/1.1 304 Not Modified
 Server: nginx/1.0.15
 Date: Sat, 05 Jan 2013 00:53:20 GMT
 Connection: keep-alive
 X-Powered-By: PHP/5.4.10
 Content-Length: 10107
 Last-Modified: Mon, 31 Dec 2012 00:17:16 GMT
 ETag: "8aec64ba4498790802016f5316f1f2d9"
 Expires: Mon, 07 Mar 2016 10:40:00 GMT
 }}}

 Content-Length line is incorrect and causes Firefox/Chrome (at least these
 browsers) to wait forever. The problem exists in ms-files.php in the
 following lines:

 {{{

 if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
         header( 'Content-Length: ' . filesize( $file ) );
 }}}


 This header is always added disregarding the http-status.

 The solution can be sending zero instead of filesize or just not sending
 this field.

 Some more information on wrong Content-Length can be found in this
 Chromium discussion:
 http://code.google.com/p/chromium/issues/detail?id=79556

 You can test it yourself using this link:
 http://demo.themewolf.com/egreen/files/2012/11/logo-egreen.png

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23123>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list