Fixed #18781 -- Reduced max session cookie size.
This commit is contained in:
parent
6add6170c0
commit
4e1fd38bd6
|
@ -46,10 +46,10 @@ class CookieStorage(BaseStorage):
|
||||||
Stores messages in a cookie.
|
Stores messages in a cookie.
|
||||||
"""
|
"""
|
||||||
cookie_name = 'messages'
|
cookie_name = 'messages'
|
||||||
# We should be able to store 4K in a cookie, but Internet Explorer
|
# uwsgi's default configuration enforces a maximum size of 4kb for all the
|
||||||
# imposes 4K as the *total* limit for a domain. To allow other
|
# HTTP headers. In order to leave some room for other cookies and headers,
|
||||||
# cookies, we go for 3/4 of 4K.
|
# restrict the session cookie to 1/2 of 4kb. See #18781.
|
||||||
max_cookie_size = 3072
|
max_cookie_size = 2048
|
||||||
not_finished = '__messagesnotfinished__'
|
not_finished = '__messagesnotfinished__'
|
||||||
|
|
||||||
def _get(self, *args, **kwargs):
|
def _get(self, *args, **kwargs):
|
||||||
|
|
|
@ -152,7 +152,7 @@ class BaseTest(TestCase):
|
||||||
cycle.
|
cycle.
|
||||||
"""
|
"""
|
||||||
data = {
|
data = {
|
||||||
'messages': ['Test message %d' % x for x in range(10)],
|
'messages': ['Test message %d' % x for x in range(5)],
|
||||||
}
|
}
|
||||||
show_url = reverse('django.contrib.messages.tests.urls.show')
|
show_url = reverse('django.contrib.messages.tests.urls.show')
|
||||||
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
||||||
|
@ -170,7 +170,7 @@ class BaseTest(TestCase):
|
||||||
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
|
@override_settings(MESSAGE_LEVEL=constants.DEBUG)
|
||||||
def test_with_template_response(self):
|
def test_with_template_response(self):
|
||||||
data = {
|
data = {
|
||||||
'messages': ['Test message %d' % x for x in range(10)],
|
'messages': ['Test message %d' % x for x in range(5)],
|
||||||
}
|
}
|
||||||
show_url = reverse('django.contrib.messages.tests.urls.show_template_response')
|
show_url = reverse('django.contrib.messages.tests.urls.show_template_response')
|
||||||
for level in self.levels.keys():
|
for level in self.levels.keys():
|
||||||
|
@ -194,7 +194,7 @@ class BaseTest(TestCase):
|
||||||
before a GET.
|
before a GET.
|
||||||
"""
|
"""
|
||||||
data = {
|
data = {
|
||||||
'messages': ['Test message %d' % x for x in range(10)],
|
'messages': ['Test message %d' % x for x in range(5)],
|
||||||
}
|
}
|
||||||
show_url = reverse('django.contrib.messages.tests.urls.show')
|
show_url = reverse('django.contrib.messages.tests.urls.show')
|
||||||
messages = []
|
messages = []
|
||||||
|
@ -226,7 +226,7 @@ class BaseTest(TestCase):
|
||||||
when one attempts to store a message.
|
when one attempts to store a message.
|
||||||
"""
|
"""
|
||||||
data = {
|
data = {
|
||||||
'messages': ['Test message %d' % x for x in range(10)],
|
'messages': ['Test message %d' % x for x in range(5)],
|
||||||
}
|
}
|
||||||
show_url = reverse('django.contrib.messages.tests.urls.show')
|
show_url = reverse('django.contrib.messages.tests.urls.show')
|
||||||
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
for level in ('debug', 'info', 'success', 'warning', 'error'):
|
||||||
|
@ -251,7 +251,7 @@ class BaseTest(TestCase):
|
||||||
raised if 'fail_silently' = True
|
raised if 'fail_silently' = True
|
||||||
"""
|
"""
|
||||||
data = {
|
data = {
|
||||||
'messages': ['Test message %d' % x for x in range(10)],
|
'messages': ['Test message %d' % x for x in range(5)],
|
||||||
'fail_silently': True,
|
'fail_silently': True,
|
||||||
}
|
}
|
||||||
show_url = reverse('django.contrib.messages.tests.urls.show')
|
show_url = reverse('django.contrib.messages.tests.urls.show')
|
||||||
|
|
Loading…
Reference in New Issue