[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] SSI & HTTP headers



Peter R. Wiley wrote:

>
>I'd like to have a CGI called from an SSI set a cookie.  I've tried to make
>this work (on an Apache server) and I just can't.
>
>I thought that all one would need to do is:
>
>	print "Set-Cookie: cookie=whatever\n\n";
>
>but this does nothing at all, although it works just find in non SSI CGIs.

Hi Peter,

The problem you've got here is that apache parses the SSI, and includes the output of the SSI into the document before it sends it to the browser (the SSI only gets to write some text to stick in the middle of the html, and doesn't get to set any headers).

No real easy answer to this, a couple of workarounds might be:
	use another SSI at the top of the page to set a cookie in a META tag
	have the SSI include a link to a cgi-script which sets the cookie (maybe an image?)
	generate the whole page as an SSI, and use non-parsed-headers (see the apache doco)

I think if you _need_ to set the cookie on this page, you'll have to generate the whole page as a cgi instead.

HTH

Iain

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org