Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Reduced CookieStorage.max_cookie_size to 75% of 4K to be nice to Inte…

…rnet Explorer

Internet Explorer, up to at least version 7, allows only 4K cookie data *per
domain*, rather than per cookie, so we ensure that stored messages leave
some room for other cookies.




git-svn-id: http://code.djangoproject.com/svn/django/trunk@12287 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e6c5599494e5408c81b046d2b7410e9e4a98a7b5 1 parent 63d0725
Luke Plant authored January 24, 2010
8  django/contrib/messages/storage/cookie.py
... ...
@@ -1,10 +1,11 @@
@@ -46,7 +47,10 @@ class CookieStorage(BaseStorage):
12  django/contrib/messages/tests/cookie.py
@@ -69,19 +69,25 @@ def test_max_cookie_length(self):
4  django/contrib/messages/tests/fallback.py
@@ -147,8 +147,10 @@ def test_session_fallback(self):
147 147
         storage = self.get_storage()
148 148
         response = self.get_response()
149 149
 
  150
+        # see comment in CookieText.test_cookie_max_length
  151
+        msg_size = int((CookieStorage.max_cookie_size - 54) / 4.5 - 37)
150 152
         for i in range(5):
151  
-            storage.add(constants.INFO, str(i) * 900)
  153
+            storage.add(constants.INFO, str(i) * msg_size)
152 154
         storage.update(response)
153 155
 
154 156
         cookie_storing = self.stored_cookie_messages_count(storage, response)

0 notes on commit e6c5599

Please sign in to comment.
Something went wrong with that request. Please try again.