From f72c13ffdad47ff684d102b6d9fb6122db899891 Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Tue, 14 Feb 2012 00:03:03 +0000 Subject: [PATCH] Accept unusual keys in cookies. The Oreos module throws CookieErrors when it catches keys that have characters that shouldn't be in them, like colons and braces. Other services are happy to send out such keys, however. This commit makes requests non-standards compliant, just like everyone else is. --- AUTHORS.rst | 1 + requests/packages/oreos/monkeys.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 3e72f34d..8cf76e9d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -80,3 +80,4 @@ Patches and Suggestions - David Kemp - Brendon Crawford - Denis (Telofy) +- Cory Benfield (Lukasa) diff --git a/requests/packages/oreos/monkeys.py b/requests/packages/oreos/monkeys.py index 2269e30b..54975c8f 100644 --- a/requests/packages/oreos/monkeys.py +++ b/requests/packages/oreos/monkeys.py @@ -252,7 +252,8 @@ class CookieError(Exception): # _LegalChars is the list of chars which don't require "'s # _Translator hash-table for fast quoting # -_LegalChars = string.ascii_letters + string.digits + "!#$%&'*+-.^_`|~[]_" +_LegalChars = ( string.ascii_letters + string.digits + + "!#$%&'*+-.^_`|~[]_:{}" ) _Translator = { '\000' : '\\000', '\001' : '\\001', '\002' : '\\002', '\003' : '\\003', '\004' : '\\004', '\005' : '\\005',