html - wordpress 3.4.1 muti-sites image has not appear in time on safari sometimes -
i'm running muti-sites wordpress nginx, , test on safari (chrome fine).
a important thing is, image upload administrator.
i found sometime image has not appear immediately, thing network trouble before, found rule today.
the rule is:
- enter page, image shown.
- refresh page(command + r), image disappeared.
- refresh again, image shown.
- again again, disappeared.
- loops....
notice: disappeared means that's not apear immediately: loaded page 2 second later, image loaded.
when refresh page, safari send image request server http header http_if_none_match , http_if_modified_since.
because of mutiple site, nginx rewrite request ms-files.php process it. ms-files.php found image has not been modified, it's response 304 no content.
the bug is, ms-files.php has set content-length header before decided response 304, response header going 304 no content , content-length > 0. after that, safari down.
fixed bug add header( 'content-length: 0' ); 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 ); 81 exit; 82 }
Comments
Post a Comment