Disable Recieving Buffer in Firefox (or other browsers)
I got trouble with web br开发者_JAVA技巧owsers buffering (not chaching).
I call this php script :
sleep(5);
echo '1st step';
echo (str_repeat(' ',256));
sleep(5);
echo '<br />';
echo '2nd step';
output buffer is disabled on php (we will confirm that later)
when calling this script with both Chromium 12 and Firefox 5 I got this result :
the 'waiting' animated circle (the grey one) runs during ~5sec then the 'transferring' animated circle (the orange one) runs during ~5sec and finally i have the whole result displayed.
My initial goal was, as you expect, to wait 5sec, then see "1st step" displayed, wait 5sec again and then see "2nd step" displayed.
clues
php or apache doesn't buffer anything as the animated circle switch from 'waiting' to 'recieving' after 5sec (so the browser did recieve something from the "1st step" echo !)
I tried to set Firefox Cache size to 0 so the cache mechanism would be bypassed.. but still no working.
I read that some browser may wait until they recieve 256 bytes before they start display the content. That's why i added "echo (str_repeat(' ',256))".. but it doesn't solve anything.
I also tried to set network.buffer.cache.count and network.buffer.cache.size options at 0 in firefox about:config, i don't know if those option was rellated to my problem but it is still not working..
Any idea ?
Thanks,
Oh, I guess I need to make the answer an answer, not a comment, so you can accept it.
The HTML5 charset sniffing buffer size is 512 bytes. So the response needs to either have 512 bytes of padding or set a charset (via <meta>
tag or HTTP header).
精彩评论