Ticket #15852: 15852_repeated_bad_cookie_name.diff
File 15852_repeated_bad_cookie_name.diff, 1.7 KB (added by , 14 years ago) |
---|
-
tests/regressiontests/httpwrappers/tests.py
281 281 Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007. 282 282 """ 283 283 self.assertTrue('good_cookie' in parse_cookie('good_cookie=yes;bad:cookie=yes').keys()) 284 285 def test_repeated_nonstandard_keys(self): 286 """ 287 Test that a repeated non-standard name doesn't affect all cookies. Ticket #15852 288 """ 289 self.assertTrue('good_cookie' in parse_cookie('a,=b; a,=c; good_cookie=yes').keys()) -
django/http/__init__.py
92 92 if not _cookie_allows_colon_in_names: 93 93 def load(self, rawdata, ignore_parse_errors=False): 94 94 if ignore_parse_errors: 95 self.bad_cookies = []95 self.bad_cookies = set() 96 96 self._BaseCookie__set = self._loose_set 97 97 super(SimpleCookie, self).load(rawdata) 98 98 if ignore_parse_errors: … … 106 106 try: 107 107 self._strict_set(key, real_value, coded_value) 108 108 except Cookie.CookieError: 109 self.bad_cookies.a ppend(key)110 dict.__setitem__(self, key, None)109 self.bad_cookies.add(key) 110 dict.__setitem__(self, key, Cookie.Morsel()) 111 111 112 112 113 113 class CompatCookie(SimpleCookie):