- From: Anselm Baird_Smith <abaird@www43.inria.fr>
- Date: Thu, 6 Feb 1997 23:01:03 +0100 (MET)
- To: bpm@techapp.com
- Cc: www-jigsaw@w3.org
> Anselm, here is a simple cgi script that tries to set multiple
> cookies. Only the last one is set (test2=4321). Is this a bug? The
> NCSA & Apache servers work fine with this script. I tried to dig
> through the code, but got lost. I can't tell if the request is not
> getting all of the cookies, or is not parsing the header correctly.
>
Go it, the CGI resource doesn't accumulate header values, instead it
override any previous header value with the new one. They are two ways
for you to fix that:
a) Modify w3c.jigsaw.forms.CgiResource in the following way:
public void notifyHeader(String name, byte buf[], int off, int len)
throws MimeParserException
{
if ( name.equalsIgnoreCase("status") ) {
status = new String(buf, 0, off, len);
} else if ( name.equalsIgnoreCase("location") ) {
location = new String(buf, 0, off, len);
} else {
String extraval = new String(buf, 0, off, len);
if ( headers == null ) {
headers = new Hashtable(11);
} else {
String val = (String) headers.get(name.toLowerCase());
if ( val != null )
extraval = val + "," + extraval;
}
headers.put(name.toLowerCase(), extraval);
}
}
Which is the real fix (included in next public release)
b) Modify your script to make it emit both cookies under the same
Set-Cookie header
Anselm.
Received on Thursday, 6 February 1997 17:01:43 UTC