Disable Recieving Buffer in Firefox (or other browsers)

放肆的年华 提交于 2019-11-28 11:00:53

问题


I got trouble with web browsers 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,


回答1:


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).



来源:https://stackoverflow.com/questions/6914648/disable-recieving-buffer-in-firefox-or-other-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!