[wp-trac] [WordPress Trac] #24312: wordpress 3.4.1 muti-sites image has not appear in time on safari sometimes

WordPress Trac noreply at wordpress.org
Sat May 11 01:11:37 UTC 2013


#24312: wordpress 3.4.1 muti-sites image has not appear in time on safari sometimes
--------------------------+-----------------------------
 Reporter:  ericdum       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Multisite     |    Version:  3.4.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 I'm running muti-sites wordpress with nginx, and test on safari (chrome is
 fine).

 A very important thing is, the image is upload by administrator.

 I found sometime some image has not appear immediately, I was just thing a
 about network trouble before, but I found the rule today.

 the rule is:

 enter the page, image shown.
 refresh the page(Command + R), image disappeared.
 refresh again, image shown.
 again again, it disappeared.
 loops....
 NOTICE: disappeared is means that's not apear immediately: loaded the page
 about 2 second later, the image could be loaded.

 ---- solution ----

 When you refresh the page, safari send a image request to server with HTTP
 header `HTTP_IF_NONE_MATCH` and `HTTP_IF_MODIFIED_SINCE`.

 Because of this is a mutiple site, nginx rewrite the request to ms-
 files.php to process it. ms-files.php found the image has not been
 modified, so it's response 304 with no content.

 The bug is, the ms-files.php has already set `Content-Length` header
 before decided to response 304, so the response header going to be 304
 with no content and `Content-Length > 0`. After that, safari was down.

 Fixed the bug by add `header( 'Content-Length: 0' );` to wp-includes/ms-
 files.php line 79.

 {{{
      75 if ( ( $client_last_modified && $client_etag )
      76     ? ( ( $client_modified_timestamp >= $modified_timestamp) && (
 $client_etag == $etag ) )
      77     : ( ( $client_modified_timestamp >= $modified_timestamp) || (
 $client_etag == $etag ) )
      78     ) {
      79     header( 'Content-Length: 0' );
      80     status_header( 304 ); // new line
      81     exit;
      82 }
 }}}

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


More information about the wp-trac mailing list