[issue2193] Cookie Colon Name Bug

R. David Murray report at bugs.python.org
Fri Dec 17 04:33:51 CET 2010


R. David Murray <rdmurray at bitdance.com> added the comment:

Seems like this really needs a strict and a lax mode.  Perhaps a BrowserCookie class that implements the relaxed rules?

That would make this a feature request, though, and so nothing would happen until 3.3, which would be unfortunate.

It is certainly possible to create a more relaxed version for your own use.  It seems to me that (untested):

class BrowserCookie(BaseCookie):

    def set(self, key, val, coded_val, LegalChars=_LegalChars+':'):
        super().set(key, val, coded_val, LegalChars)

would do most of what And Clover wants (not adding or stripping quotes or doing backslash quoting or encoding, accepting : in key names (and more characters could be added; the regex in the parsing step is fairly liberal)).

Making further relaxations is difficult without poking in to module internals, though.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2193>
_______________________________________


More information about the Python-bugs-list mailing list