From: Glenn Linderman <[EMAIL PROTECTED]>
To: Jerry Kassebaum <[EMAIL PROTECTED]>
CC: [email protected]
Subject: Re: Cookie Trouble
Date: Tue, 20 Feb 2007 09:37:19 -0800

On approximately 2/20/2007 6:45 AM, came the following characters from the keyboard of Jerry Kassebaum:
Friends,

I may have to include more code, but maybe this will be enough for you experts to say, "Oh, yeah, there's your problem!"

When a player goes to my website, biblescramble.com, and attempts to play the first level of my game, the output is "Location: http://biblescramble.com/biblescramble7.html"; on the first attempt. At that point the lines

print <<EOD;
Set-Cookie: guest=$lastCookie; expires=Wed, 29-Dec-2022 00:00:00 GMT;


EOD

set a cookie. Then if the player goes back and tries again, or hits the refresh button, the game works. This is not optimal.

How can I get it to skip that "Location: http://biblescramble.com/biblescramble7.html"; step???

If you need more details, let me know. If you go to biblescramble.com an play the first game you'll see what I mean. Try twice and the game will work. Delete my cookie from your machine and it will goof up again.

Thanks!

Jerry Kassebaum

P.S.

The last few lines of the cgi program follow:


print "Location: http://biblescramble.com/biblescramble7.html\n\n";;

# BOTH returns on the end are vital! One won't do ya!



exit 0;

Why would the process of setting a cookie cause that line to literally print to the screen, when not setting a cookie lets it do what it says???


So it sounds to me like you are probably trying to print HTTP headers from your cgi, but the headers have already been printed... The "BOTH returns" comment makes it sound like the Location: header being printed by the line you show is intended to be the last header in the group of HTTP headers produced, the signal of where HTTP headers end in a stream from the web server is a blank line (the 2nd return generates one).

So if your Location: print happens after some other piece of code already ended the HTTP headers, then it is too late. You need to figure out where the headers are being generated, and include the Location: header before that, or as part of that.


But how and why would the setting a cookie way earlier in the code cause the line

print "Location: http://biblescramble.com/biblescramble7.html\n\n";;

to be included in the header in one case, but not in the other? If the cookie is set that process causes the new page to only show the name of the file. If the cookie has previously been set the new page is the output of the html file. Why???

By the way, I did experiment with this for an hour or so, so I'm not just being lazy.

_________________________________________________________________
Play Flexicon: the crossword game that feeds your brain. PLAY now for FREE.  http://zone.msn.com/en/flexicon/default.htm?icid=flexicon_hmtagline

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to