Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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:

sub cgiapp_get_query { my $self = shift; require CGI::Simple; my $q = CGI::Simple->new(); return $q; }

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):

$self->query()->nph(1);

I'm doing redirects in my run_modes just like the C::A documentation tells me like this:

$self->header_type('redirect'); $self->header_props( -url => $newurl ); return;

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:

HTTP/1.0 200 OK Server: Microsoft-IIS/5.0 Date: Fri, 19 Aug 2005 02:42 +:29 GMT Content-Type: text/html; charset=ISO-8859-1

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.

Many Thanks,
Meraxes

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.


In reply to Header problem with IIS, C::A and CGI::Simple by meraxes

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-23 01:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found