mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Dropped fix_IE_for_vary/attach.
This is a security fix. Disclosure following shortly.
This commit is contained in:
parent
a06808d370
commit
3800f63721
4 changed files with 2 additions and 106 deletions
|
@ -2,8 +2,6 @@ from datetime import datetime
|
|||
import sys
|
||||
import unittest
|
||||
|
||||
from django.http import HttpResponse, utils
|
||||
from django.test import RequestFactory
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
from django.utils import http
|
||||
from django.utils import six
|
||||
|
@ -67,50 +65,6 @@ class TestUtilsHttp(unittest.TestCase):
|
|||
]
|
||||
self.assertTrue(result in acceptable_results)
|
||||
|
||||
def test_fix_IE_for_vary(self):
|
||||
"""
|
||||
Regression for #16632.
|
||||
|
||||
`fix_IE_for_vary` shouldn't crash when there's no Content-Type header.
|
||||
"""
|
||||
|
||||
# functions to generate responses
|
||||
def response_with_unsafe_content_type():
|
||||
r = HttpResponse(content_type="text/unsafe")
|
||||
r['Vary'] = 'Cookie'
|
||||
return r
|
||||
|
||||
def no_content_response_with_unsafe_content_type():
|
||||
# 'Content-Type' always defaulted, so delete it
|
||||
r = response_with_unsafe_content_type()
|
||||
del r['Content-Type']
|
||||
return r
|
||||
|
||||
# request with & without IE user agent
|
||||
rf = RequestFactory()
|
||||
request = rf.get('/')
|
||||
ie_request = rf.get('/', HTTP_USER_AGENT='MSIE')
|
||||
|
||||
# not IE, unsafe_content_type
|
||||
response = response_with_unsafe_content_type()
|
||||
utils.fix_IE_for_vary(request, response)
|
||||
self.assertTrue('Vary' in response)
|
||||
|
||||
# IE, unsafe_content_type
|
||||
response = response_with_unsafe_content_type()
|
||||
utils.fix_IE_for_vary(ie_request, response)
|
||||
self.assertFalse('Vary' in response)
|
||||
|
||||
# not IE, no_content
|
||||
response = no_content_response_with_unsafe_content_type()
|
||||
utils.fix_IE_for_vary(request, response)
|
||||
self.assertTrue('Vary' in response)
|
||||
|
||||
# IE, no_content
|
||||
response = no_content_response_with_unsafe_content_type()
|
||||
utils.fix_IE_for_vary(ie_request, response)
|
||||
self.assertFalse('Vary' in response)
|
||||
|
||||
def test_base36(self):
|
||||
# reciprocity works
|
||||
for n in [0, 1, 1000, 1000000]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue