BUG: Set-Cookie Is Ignored in CGI When Combined With Location (176113)
The information in this article applies to:
- Microsoft Internet Information Server 3.0
- Microsoft Internet Information Server 4.0
- Microsoft Internet Information Server 5.0
This article was previously published under Q176113 We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site: SYMPTOMS
When a CGI application sends a Set-Cookie header with "302 Object Moved"
response and Location header, Internet Information Server (IIS) ignores the
cookie header.
RESOLUTION
This behavior is in violation of the CGI specification, which states, "Any
headers that are not server directives are sent directly back to the
client. Currently, this specification defines three server directives..."
As a workaround, make sure the file name of the EXE begins with "nph-" and
manually create all HTTP headers in your program. "nph-" indicates to the
server that the CGI program is to be run in non-parsed headers mode. CGI
has two modes. In normal mode (parsed headers), you must send one of the
CGI directives to standard output (Content-type, Location, or Status). CGI
formats a valid HTTP response line based on the directive you sent. It
formats other standard HTTP headers for you, and it should include any
other headers that you have specified.
The other mode is non-parsed header mode. In this mode CGI does not set any
headers itself. The CGI program must format a full HTTP response including
the response line and all headers. The server will not add or modify any
headers for you in this mode.
The convention is that a CGI program whose name begins with "nph-" is run
in non-parsed header mode; otherwise, CGI programs are run in parsed header
mode.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
REFERENCES
(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Leon
Braginski, Microsoft Corporation
Modification Type: | Minor | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbBug kbnofix KB176113 |
---|
|