This borders on being more a question about Apache 2.0 than it does Perl, I'm just hoping that there is a Perl solution to my problem.

I have a CGI script that bounces back a binary file that is many megabytes in size. The script outputs the HTTP headers (complete with mimetype and Content-Disposition: filename=) and then sends the data.

Under Apache 1.3.x, I could put a simple $|=1 at the top of my code and all would work as expected. Under Apache 2.0x, this doesn't work. The entire file must come down the pipe first before you get prompted as to how to handle the it.

Apache 2.0 is buffering my output somehow (or forcing my Perl script back to $|=0).

Is anyone aware of an Apache::* module (or other) that I could potentionally use to bypass this? I presume that the CGI handler for Apache 2.0 is automatically buffering the results, regardless of what the actual script itself is doing. I'm hoping there exists something that bypasses the CGI handler is some way.

Hm. mod_perl perhaps. Except I didn't have luck getting it to work with Apache 2.0 (which, ugh, I must use) last time I tried.

Suggestions? Comments? Thanks!


In reply to Output buffering under Apache by mr.nick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.