Mailing List Archive

Support open source code!


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

Re: tlug: A question about Cookies



On Thu, 10 Feb 2000, Frank Bennett (フランクべネット ) wrote:
> Then I realized that the Netscape browsers at the student Coop
> don't render the output of the CGI at all; they just dump the
> raw HTML onto the screen.  This is going to be a little
> embarrassing if I don't fix the problem soon, and a Netscape
> user at the publishers connects to the site to see what I'm
> making all these optimistic noises about.

Your CGI needs to output a Content-Type: text/html to be valid CGI 1.1 
(CGI 1.1 says you _must_ output either a Content-Type or a Location
header-- I'm surprised the HTTP server is allowing it). IE is taking it's
best guess (assuming when in doubt that it's HTML) with the broken content
(and succeeding)-- versus Netscape/Lynx, which are guessing that the
no-content-type text is plain text.

> I am certain now that the problem is in the way cookies, used
> to identify that a login session for a specific user is in
> progress, are sent back to the browser.  The opening lines
> of the CGI output are:

Probably not... but that semi-colon in the second Set-Cookie is not
needed. Also, because they're the same cookie, the second cookie will
override the first (with the expiration date), so the "clientid" cookie
will expire not on Dec 31, but as soon as the user closes his browser (is
this what you want)?

Since the date is in the past, I assume you're trying to delete an old
cookie. But this isn't needed, because the second cookie will overwrite
any existing cookie (including it's expiration date) anyway.

> Set-Cookie: clientid=209498983905; expires=Friday, 31-Dec-99 23:59:59 GMT;
> Set-Cookie: clientid=209498983905;
[ Content-Type: text/html; charset=x-set-here-if-not-iso-8859-1 ]
[ NL ]
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.o
> <html>
> <head>
> [snip]

> IE parses this and renders the text.  It seems to store the cookie
> between invocations of the CGI okay.  The cookie seems to die when
> IE is terminated.

This is proper behavior.

--------------------------------------------------------------------
Next Nomikai Meeting: February 18 (Fri) 19:00 Tengu TokyoEkiMae
Next Technical Meeting:  March 11 (Sat) 13:00 Temple University Japan
* Topic: TBD
--------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links