W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 1997

Multiple cookies?

From: <bpm@w3.org>
Date: Thu, 6 Feb 1997 12:45:03 -0600
To: www-jigsaw@w3.org
Message-ID: <19970206184503.AAA28993@vlad.terraweb.com>
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.

Thanks.
	Brian Millett

#!/opt/gnu/bin/perl

if ($ENV{'REQUEST_METHOD'} eq "POST") {
	print "Content-type: text/html\n\n";
	print "<html><head><title>Cookie test part 2</title></head><body>\n";
	
	$_ = $ENV{"HTTP_COOKIE"};
	s/;\s*[^a-zA-Z0-9]/;/;   ## Netscape 2.0b1 kludge
	%cookie = split(/[=;]\s*/);
	
	print "<H1>Cookies are: </H1><UL>";
	foreach (keys(%cookie)) {
		print "<LI>", $_, '=``', $cookie{$_}, "''<br>\n";
	}
	print "</UL></body></html>\n";
} else {
	print <<EOM;
Set-Cookie: test1=1234; path=/CGI/test-
Set-Cookie: test2=4321; path=/CGI/test-
Content-type: text/html

<HTML><HEAD><TITLE>Cookie test part 1</TITLE></HEAD><BODY>
<FORM METHOD="POST" ACTION="/CGI/test-cookie.cgi"><INPUT TYPE="submit"></FORM>
</BODY></HTML>
EOM

}
__END__

-- 
Brian Millett                    
Technology Applications Inc.     "Heaven can not exist,
(314) 530-1981                          If the family is not eternal"
bpm@techapp.com                   F. Ballard Washburn
Received on Thursday, 6 February 1997 13:41:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT