@@ -39,58 +39,3 @@ def conditional_content_removal(request, response):
3939 else :
4040 response .content = ''
4141 return response
42-
43-
44- def fix_IE_for_attach (request , response ):
45- """
46- This function will prevent Django from serving a Content-Disposition header
47- while expecting the browser to cache it (only when the browser is IE). This
48- leads to IE not allowing the client to download.
49- """
50- useragent = request .META .get ('HTTP_USER_AGENT' , '' ).upper ()
51- if 'MSIE' not in useragent and 'CHROMEFRAME' not in useragent :
52- return response
53-
54- offending_headers = ('no-cache' , 'no-store' )
55- if response .has_header ('Content-Disposition' ):
56- try :
57- del response ['Pragma' ]
58- except KeyError :
59- pass
60- if response .has_header ('Cache-Control' ):
61- cache_control_values = [value .strip () for value in
62- response ['Cache-Control' ].split (',' )
63- if value .strip ().lower () not in offending_headers ]
64-
65- if not len (cache_control_values ):
66- del response ['Cache-Control' ]
67- else :
68- response ['Cache-Control' ] = ', ' .join (cache_control_values )
69-
70- return response
71-
72-
73- def fix_IE_for_vary (request , response ):
74- """
75- This function will fix the bug reported at
76- http://support.microsoft.com/kb/824847/en-us?spid=8722&sid=global
77- by clearing the Vary header whenever the mime-type is not safe
78- enough for Internet Explorer to handle. Poor thing.
79- """
80- useragent = request .META .get ('HTTP_USER_AGENT' , '' ).upper ()
81- if 'MSIE' not in useragent and 'CHROMEFRAME' not in useragent :
82- return response
83-
84- # These mime-types that are decreed "Vary-safe" for IE:
85- safe_mime_types = ('text/html' , 'text/plain' , 'text/sgml' )
86-
87- # The first part of the Content-Type field will be the MIME type,
88- # everything after ';', such as character-set, can be ignored.
89- mime_type = response .get ('Content-Type' , '' ).partition (';' )[0 ]
90- if mime_type not in safe_mime_types :
91- try :
92- del response ['Vary' ]
93- except KeyError :
94- pass
95-
96- return response
0 commit comments