|laziness, impatience, and hubris|
Header problem with IIS, C::A and CGI::Simpleby meraxes (Friar)
|on Aug 19, 2005 at 03:05 UTC||Need Help??|
meraxes has asked for the
wisdom of the Perl Monks concerning the following question:
Hello esteemed monks,
I'm writing my first CGI::Application web app and I'm having some growing pains for which I was hoping someone could help. It works great on my Apache test setup on my own work box. It blows chunks when I try to use it on the IIS5 box on which my boss wants me to put it.
The problem is similar to this: How can I remove HTTP Header . I have headers in a single line printing out along the top of my page... however, unlike the aforementioned node, this isn't happening all the time. From what I can see, it's only happening when I POST a form or attempt to redirect.
This webapp was developed on my WinXP box using Apache 2.0 as my test webserver and Perl 5.8.6. It uses CGI::Application (C::A) but I've overridden it to use CGI::Simple instead of CGI as per this tip in the C::A Wiki like so:
Unfortunately, I've gotta move this bad-boy to a Win2k box running IIS5 (also Perl 5.8.6). It's not using the ISAPI plugin for Perl. (Is that a factor?)
I'm aware of the nph header setting and I'm setting the CGI::Simple query object to nph like so in the setup() method (even though the docs say that I need not do so because CGI::Simple auto-detects IIS):
I'm doing redirects in my run_modes just like the C::A documentation tells me like this:
The redirects in Firefox and IE are both causing a download of the redirect headers as a text file instead of actually redirecting me. The form submission is also causing a download in FireFox but in IE I get a printout of the headers at the top of the page in one line like so:
Sorry if this seemed a little long winded but I'm trying to provide as much as possible. So, I understand the concept of NPH... what I don't get is how this beahviour seems to be busting me up only some times and not all the time. (Can't ANYTHING be black and white anymore? Hmmm... I must be growing up if everything is in shades of gray.)
Has anyone else had this selective behaviour? Do I need to explicitly set some more headers somewhere? Is this something to do with CGI::Simple's NPH support? All help is welcome and if anyone want's more detail, I'll give it. None of the other nodes I've come across here seem to cover this. All I'm looking for now is a direction to investigate in because I'm plain stumped. My apologies if this is isn't "perlish" enough but I'm not sure where else to turn.
Update: Okay, I've got redirects working. It seems that when I was using the header_props() to set the type to redirect I think I was wiping out the -nph setting. I've corrected this. However, I still have a problem when I process a POST request. The result page is still spitting out the headers. The output page is using no special headers at all. Any help appreciated.
Update the second: I'm an idiot. hakkr got me looking in the right direction. I'm not printing out headers ahead of CGI::Application... but I was printing some diagnositic info to STDERR. Apache throws that into it's erorr log, IIS just spews EVERYTHING out. Many thanks for the help.