Re: Buffering cannot be turned off once it is already turned on. by Andrew
Andrew
Sun Apr 11 14:41:13 CDT 2004
Lord Merlin wrote:
> WTF????
> I mean, really now....... Why can't it be turned off, since it's on?
> But this now raises a good, when do you turn it on, when do you turn
> it off?
With the buffer enabled IIS5 [1] writes a content-length header (makes
sense if you think about it) and with buffering off it writes a
"Transfer-Encoding: chunked" header. So, you *can* turn buffering on or
off as long as your page has not completed writing headers to the
client. If you toggle the buffer status once the headers are written,
you'll see the old "The HTTP headers are already written to the client
browser" error, which is what I assume you mean by "cannot be turned
off".
> Why would a website have some scripts have it turned on, and
> other scripts have it turned off?
Output-intensive pages may choose to buffer to increase processing
performance. Pages that will take a long time to process may choose to
buffer content but flush the buffer at certain intervals so that the
client gets something to display rather than sending the output at the
end of processing. Pages with little output may not benefit from
buffering being enabled.
[1] Applies to the configuration of my IIS server, not necessarily
anyone elses!
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx
- Contact: www.andrewu.co.uk/contact/
- Employ me: Front/middle tier ASP developer with WAI & web standards