Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 6 months ago

#23123 closed defect (bug) (duplicate)

ms-files.php: 304 Not Modified includes Content-Length with filesize

Reported by: v-media's profile v-media Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Multisite Keywords:
Focuses: Cc:


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:

You can test it yourself using this link:

Change History (1)

#1 @SergeyBiryukov
12 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #18043.

Note: See TracTickets for help on using tickets.