
The Cookie Technology
cookie concept
Server to Client
This is accomplished by using an additional entry in the HTTP
response header: Set-cookie. This entry is simplay an extra
piece of text inserted
into the rest of the response header. There may be multiple
Set-cookie entries in each response header. A cookie entry coming
from a server might look something like this:
Set-cookie: username =WSB; path=/cgi-bin; domain=.gnulix.org
This would
result in the creation of a cookie called username. This cookie will
be given the string
WSB as its
value. The cookie will be sent back to the server only when the client
visits a URL that
starts with
/cgi/bin, and it would be sent out to all web servers that reside under
the .gnulix.org domain
Client to Server
When a client returns a cookie to the server,
another header entry is used. This entry is aptly enough named Cookie.
Such an entry can look something like this:
Cookie: username=WSB; favoriteOS=Gnulix
In the previous example, two cookies were
sent from the client to the server. The first cookie, named username,
has a value of WSB. Of course, the second cookie is called favoriteOS
and has a value of Gnulix. For each request
that a client sends to a server, all the cookies relevant for the requested
URL are included.