in reply to Question regarding CGI and cookies
I'll take a guess though. You don't get in what order the getting and setting of cookies has to happen.
A page or script can get cookies from the browser as soon as the browser requests it.
BROWSER: Can I have the page "c11ex6.cgi" please?
SCRIPT: Certainly, just wait one second.
SCRIPT (privately) gets the previous cookie, reads the contents of $basket, adds it to @purchases, and constructs a new cookie with the changes incorporated
SCRIPT: OK browser, here you go. Here's an HTTP header containing an updated cookie, and here's the HTML of the page.
BROWSER: Thank you. (stores the new cookie)
Does that make sense in terms of what has to happen in what order? The old cookie has to be read first, the new cookie has to be sent out with the header, before anything else is sent, and next time the browser comes to this script, the script will read the cookie sent the last time.
I can remember finding this very confusing myself...
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question regarding CGI and cookies
by JOT007 (Novice) on Nov 09, 2004 at 01:17 UTC |