@@ -36,42 +36,6 @@ def safe_httprequest_repr(self):
36
36
HttpRequest .__repr__ = safe_httprequest_repr
37
37
38
38
39
- def patch_parse_cookie ():
40
- try :
41
- from django .utils import six
42
- from django .utils .encoding import force_str
43
- from django .utils .six .moves import http_cookies
44
- from django import http
45
- except ImportError :
46
- # This module is potentially imported before Django is installed
47
- # during a setup.py run
48
- return
49
-
50
- # Backported from 1.8.15: https://github.com/django/django/blob/1.8.15/django/http/cookie.py#L91
51
- # See https://www.djangoproject.com/weblog/2016/sep/26/security-releases/ for more context.
52
- def safe_parse_cookie (cookie ):
53
- """
54
- Return a dictionary parsed from a `Cookie:` header string.
55
- """
56
- cookiedict = {}
57
- if six .PY2 :
58
- cookie = force_str (cookie )
59
- for chunk in cookie .split (";" ):
60
- if "=" in chunk :
61
- key , val = chunk .split ("=" , 1 )
62
- else :
63
- # Assume an empty name per
64
- # https://bugzilla.mozilla.org/show_bug.cgi?id=169091
65
- key , val = "" , chunk
66
- key , val = key .strip (), val .strip ()
67
- if key or val :
68
- # unquote using Python's algorithm.
69
- cookiedict [key ] = http_cookies ._unquote (val )
70
- return cookiedict
71
-
72
- http .parse_cookie = safe_parse_cookie
73
-
74
-
75
39
def patch_django_views_debug ():
76
40
# Prevent exposing any Django SETTINGS on our debug error page
77
41
# This information is not useful for Sentry development
@@ -98,7 +62,6 @@ def patch_celery_imgcat():
98
62
99
63
100
64
for patch in (
101
- patch_parse_cookie ,
102
65
patch_httprequest_repr ,
103
66
patch_django_views_debug ,
104
67
patch_celery_imgcat ,
0 commit comments