what happens when cookies get too big?

Alex Martelli aleaxit at yahoo.com
Thu Jan 18 11:48:46 EST 2001


"Skip Montanaro" <skip at mojam.com> wrote in message
news:mailman.979830522.31537.python-list at python.org...
>
> This isn't really a Python question, but since I'm using Python to
implement
> things, I figured perhaps I could sneak this in.
>
> What happens when cookies get too big?  Do browsers tend to barf, toss out
> the cookie, truncate it, or something else I've not anticipated?  RFC 2109
> says oversize cookies (double-stuff?) must be discarded, but I wonder if
all
> browsers adhere to that requirement.

Discarding is, I think, pretty standard behavior (but other cookies may
get discarded too if one is -- not sure if that complies with 2109, but
it makes sense as the other cookies from a given domain may be no use
unless all are present).

> I'm storing a cookie that represents a
> list of names.  It's zlib compressed and base64 encoded, so I can store
> quite a few names.

But if it gets above reasonable thresholds, you may want to keep it
server-side and use the cookie just as a (small!) key to retrieve it.
I don't think you should encode all THAT much data into cookies: they're
a session-state management mechanism, after all, not a 'data store':).


Alex






More information about the Python-list mailing list