In the event that anyone stumbles across this looking for help, I figured I would provide a follow-up. This link is a Microsoft bug report that covers 3 (yup, three!) versions of IIS. It (incorrectly) states that IIS ignores the Set-Cookie header if used with a Location: header. In reality, it passes the Set-Cookie: header but tosses an extra newline in the headers prior to the status line.

merlyn's comment that he thought IIS might always require nph- headers, while not quite accurate, is pretty close to the mark. I discovered that merely trying to generate a Status: header had the same effect of breaking up the headers.

print $cgi->header( -cookie => \@cookie, -status => $status );
The above snippet generated the following:
HTTP/0.9 200 OK Client-Date: Tue, 26 Dec 2000 20:04:30 GMT Client-Peer: 192.168.1.65:80 Status: 403 Forbidden Set-Cookie: orderTotal=n%2Fa; path=/ Set-Cookie: message=No%20such%20dealer.; path=/ Date: Tue, 26 Dec 2000 21:01:26 GMT Content-Type: text/html; charset=ISO-8859-1
It appears that IIS wants to insert its own status code regardless of the status that I provide. Using nph with IIS appears to be desirable due to many bugs.

Incidentally, using the same script with Apache resulted in a 403 Forbidden response, as desired, but failed to send cookies. Is this appropriate? I didn't see anything in the cookie specification that prevents them from being set with a 403 error.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid - IIS is pitiful) Re: IIS and Apache by Ovid
in thread IIS and Apache by Ovid

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.