Posted by Eric on 12/20/05 08:24
Rob McAninch wrote:
> Eric>:
>> I'm playing around with cookies mostly as a learning experience.
>
>> <body>
>> <!--#exec-cgi="/cgi-bin/setcookie.cgi" -->
>> </body>
>>
>> The cgi just writes
>> "Set-Cookie: hello=its_me" to stdout
>> My question is:
>> is this correct?
>
> Not as an SSI. At the point the cgi is executed the content-type
> header has already been sent to the browser, too late for the
> set-cookie header. You could still use JavaScript at this point
> though (of course JS is now required to be enabled on the client
> browser).
>
> If you're entire page is created in CGI then just send out the
> cookie header before the content-type.
>
>
How is that done? I mean i can see how a cgi can send out the entire page
but how do you create the originating page in such a way that the cgi
executes before sending out headers? (Seems like a chicken and egg thing)
Eric
[Back to original message]
|