From: Brian Candler Date: 2003-04-04T03:08:07+09:00 Subject: Re: cgi serving xml from Apache problem On Fri, Apr 04, 2003 at 02:45:16AM +0900, Chris Morris wrote: > Seems this change fixed it: > > def output_feed > print "Content-type: text/xml\n\n" > $stdout.flush > print rss_xml > $stdout.flush > end > > Without the flush, I guess Apache was aware that the output may not be done > and automatically went into 'chunked' mode. > > With the flush, 'Transfer-encoded: chunked' is not used and the XML comes > across clean. It shouldn't cause a problem though. RFC2616 again: All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding If the client was making a HTTP/1.0 request then possibly Apache should not be using this transfer-coding, so you might want to dig around there a bit more. Flushing stdout a few times is a rather dubious way to solve this if it is indeed a problem; you may find it reappears again when your dataset gets a bit larger! Chunked encoding saves the server having to buffer your entire CGI output just so that it can create a correct Content-Length: header. Regards, Brian.