Skip to Main Content
Practical Internet Groupware
book

Practical Internet Groupware

by Jon Udell
October 1999
Beginner content levelBeginner
521 pages
15h 28m
English
O'Reilly Media, Inc.
Content preview from Practical Internet Groupware

Setting a Cookie

Here’s a generic Perl fragment that sets a cookie:

print "Content-type: text/html\n";
print "Set-Cookie:
            ProductAnalysisSubscriber=Aladdin%00926515678%00192.168.1;
            path=/cgi-bin; expires=Wed, 11-May-2000 00:00:00 GMT\n\n";

Or to continue with ASP-based PerlScript as in Example 12.4:

$Response->AddHeader("Set-Cookie", 
      ProductAnalysisSubscriber=Aladdin%00926515678%00192.168.1;
      path=/cgi-bin; expires=Wed, 11-May-2000 00:00:00 GMT\n\n";

On a Windows machine, when user Jon is logged in and the web server is localhost, Internet Explorer records that information in the file c:\WINNT\Profiles\Jon\Cookies\jon@localhost.txt.

On the same Windows machine, Communicator adds the following line to c:\program files\Netscape\users\jon\cookies.txt:

localhost   FALSE   /   cgi-bin   FALSE   958035600   ProductAnalysisSubscriber
     Aladdin%00926515678%00192.168.1

Table 12.1 lists the elements of this cookie.

Table 12-1. Anatomy of a Cookie

Element

Description

localhost

Which domain or specific server created and can read back the cookie? Use DOMAIN=.DomainName.com if multiple servers in a domain need to read the cookie.

FALSE

Can all machines in the server’s domain read the cookie? Defaults to FALSE. Only a single server can read it. Note that regardless of this setting, no server outside the cookie’s domain of origin can read it.

/cgi-bin

For which set of URLs will the browser send the cookie? In this case, only for scripts run from /cgi-bin. Defaults to /.

FALSE

Will your browser send its ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Web Operations

Web Operations

John Allspaw, Jesse Robbins

Publisher Resources

ISBN: 1565925378Catalog PageErrata