From af03867f008fee71112e49ef92e3209eefd2a8ae Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sun, 13 Feb 2011 02:37:52 +0000 Subject: [1.2.X] Fixed #13007 -- Made cookie parsing resilent to the presence of cookies with invalid characters in their names. Thanks Warlax for the report, Ubercore for his work on a fix and Jannis and Luke for review and guidance. Backport of [15523] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15524 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/httpwrappers/tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py index 4e946a2f10..336d9a2817 100644 --- a/tests/regressiontests/httpwrappers/tests.py +++ b/tests/regressiontests/httpwrappers/tests.py @@ -2,7 +2,8 @@ import copy import pickle import unittest -from django.http import QueryDict, HttpResponse, CompatCookie, BadHeaderError +from django.http import (QueryDict, HttpResponse, CompatCookie, BadHeaderError, + parse_cookie) class QueryDictTests(unittest.TestCase): @@ -264,3 +265,9 @@ class CookieTests(unittest.TestCase): c2 = CompatCookie() c2.load(c.output()) self.assertEqual(c['test'].value, c2['test'].value) + + def test_nonstandard_keys(self): + """ + Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007. + """ + self.assertTrue('good_cookie' in parse_cookie('good_cookie=yes;bad:cookie=yes').keys()) -- cgit v1.3