Greetings,
I'm trying to understand why I'm getting malformed headers
from my cgi-bin program written under perl, but not the
equivalent under csh. If I system() to a command that writes
to stdout, apache returns a "malformed header from script"
error. If I do the same thing command that doesn't, everything
works fine.
So:
printf("Content-type: text/html\n\n");
system("touch /usr/tmp/bogus");
works, but:
printf("Content-type: text/html\n\n");
system("echo hello");
doesnt. If I do the same thing under csh or c, it works fine.
In fact, just using csh, the server acts as if I have
non-parsed-headers and prints the output of my external program
(which takes about 1sec to run, and gets called
20 or so times) sequentially each time it is
called, which gives my users a nice status update.
I've also tried turning autoflush on stdout for the script:
$old_fh = select(OUTPUT_HANDLE);
$| = 1;
select($old_fh);
but that doesn't seem to do it either.
Thanks for any insights!
--david
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.