magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2001 > 05 > Programming with Perl  

Cookie Monsters

By Randal L. Schwartz

Ahh, cookies. One of my pet peeves is the amount of bad cookie code I see out there—like the code responsible for the reaction I get from a Web site when I choose not to permit cookies (usually because I'm feeling rebellious). Cookies are one of many ways to turn stateless HTTP into a series of session-based transactions with states like "logged in" and "logged out." Other ways to achieve a similar transformation of HTTP include using authentication, mangling the URLs, and hiding data.

Cookies are the object of my ire because so many Internet programmers assume that "one user equals one Web browser." After all, that's the basic model of the cookie itself. But that assumption is also demonstrably untrue. For example, right now I have three browsers open. And, I've been known to enter an Internet café from time to time and use the browsers it supplies. The problem is that when I move from browser to browser, my cookies don't follow me.

Bad Batches

What are the wrong ways to use cookies? Let me count them: One is to use cookies with a login form that, upon successful login, sends out a cookie that lasts for several years. That cookie works only for the particular browser I used when I filled out the login form. Because of this, I can't log in using a different browser unless I fill out the login form again. Worse yet, if I'm using an Internet café's browser and I forget to log out, the next user who stumbles across that Web site is already logged in as me.

Then there are Web sites that send out a bunch of data inside a cookie, such as the entire contents of my shopping cart.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2