and the script prints headers like this:
print "Content-type: text/plain\n"; print "Content-Disposition: attachment; filename=results.xml\n\n";
The resulting file reports a server error 500, premature end of script headers and the content-disposition line is displayed, so it looks like it is not being treated as a header.
Try to add:
local $| = 0;
before sending headers, or send the header at once:
print q[Content-type: text/plain\n] . q[Content-Disposition: attachment;filename=results.xml\n\n].
Thanks! The local $| = 0 trick works. Would you mind explaining what is happening? FYI, putting the headers on one print doesn't seem to fix it.
As soon as you send some content to the client, Apache sends the headers immediately (since there is no send_http_header() in Apache 2.0). So when you do:
print q[Content-type: text/plain\n];
Apache sends httpd headers right away, before it sees extra headers.
By making the output buffered $! (which is the case by default) you delay sending the data out, till the 8K buffer is filled (or the request is completed). But it's probably a better practice to send the header at once as I've suggested, rather than relying on the buffering feature.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html