Issue with redefined SimpleCookie with invalid cookie name
|Reported by:||Stefano Crosta <stefano@…>||Owned by:||e0ne|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by ramiro)
To provoke the error:
from django.http import HttpResponse response= HttpResponse() response.set_cookie("a:.b/",1) > AttributeError: 'SimpleCookie' object has no attribute 'bad_cookies'
with a python version that does not accept colons (":") in the cookie name.
Django http/init.py redefines the SimpleCookie, and initializes bad_cookies in a method load(self, rawdata) that does not seem to be called in this case.
Beside the obvious fact that the cookie name is totally invalid, it looks like bad_cookies is not correctly initialized (I wouldn't mind an error, but a real one!)
Or am I using set_cookie uncorrectly here?
Change History (8)
comment:1 Changed 2 years ago by ramiro
- Description modified (diff)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 10 months ago by e0ne
- Owner changed from nobody to e0ne
- Status changed from new to assigned
comment:6 Changed 10 months ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from assigned to closed