Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.werkzeug.contrib.fixers.InternetExplorerFix Class Reference

List of all members.

Public Member Functions

def __init__
def fix_headers
def run_fixed
def __call__

Public Attributes

 app
 fix_vary
 fix_attach

Detailed Description

This middleware fixes a couple of bugs with Microsoft Internet
Explorer.  Currently the following fixes are applied:

-   removing of `Vary` headers for unsupported mimetypes which
    causes troubles with caching.  Can be disabled by passing
    ``fix_vary=False`` to the constructor.
    see: http://support.microsoft.com/kb/824847/en-us

-   removes offending headers to work around caching bugs in
    Internet Explorer if `Content-Disposition` is set.  Can be
    disabled by passing ``fix_attach=False`` to the constructor.

If it does not detect affected Internet Explorer versions it won't touch
the request / response.

Definition at line 141 of file fixers.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.contrib.fixers.InternetExplorerFix.__init__ (   self,
  app,
  fix_vary = True,
  fix_attach = True 
)

Definition at line 163 of file fixers.py.

00163 
00164     def __init__(self, app, fix_vary=True, fix_attach=True):
00165         self.app = app
00166         self.fix_vary = fix_vary
00167         self.fix_attach = fix_attach


Member Function Documentation

def MoinMoin.support.werkzeug.contrib.fixers.InternetExplorerFix.__call__ (   self,
  environ,
  start_response 
)

Definition at line 201 of file fixers.py.

00201 
00202     def __call__(self, environ, start_response):
00203         ua = UserAgent(environ)
00204         if ua.browser != 'msie':
00205             return self.app(environ, start_response)
00206         return self.run_fixed(environ, start_response)

Here is the call graph for this function:

def MoinMoin.support.werkzeug.contrib.fixers.InternetExplorerFix.fix_headers (   self,
  environ,
  headers,
  status = None 
)

Definition at line 168 of file fixers.py.

00168 
00169     def fix_headers(self, environ, headers, status=None):
00170         if self.fix_vary:
00171             header = headers.get('content-type', '')
00172             mimetype, options = parse_options_header(header)
00173             if mimetype not in ('text/html', 'text/plain', 'text/sgml'):
00174                 headers.pop('vary', None)
00175 
00176         if self.fix_attach and 'content-disposition' in headers:
00177             pragma = parse_set_header(headers.get('pragma', ''))
00178             pragma.discard('no-cache')
00179             header = pragma.to_header()
00180             if not header:
00181                 headers.pop('pragma', '')
00182             else:
00183                 headers['Pragma'] = header
00184             header = headers.get('cache-control', '')
00185             if header:
00186                 cc = parse_cache_control_header(header,
00187                                                 cls=ResponseCacheControl)
00188                 cc.no_cache = None
00189                 cc.no_store = False
00190                 header = cc.to_header()
00191                 if not header:
00192                     headers.pop('cache-control', '')
00193                 else:
00194                     headers['Cache-Control'] = header

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.contrib.fixers.InternetExplorerFix.run_fixed (   self,
  environ,
  start_response 
)

Definition at line 195 of file fixers.py.

00195 
00196     def run_fixed(self, environ, start_response):
00197         def fixing_start_response(status, headers, exc_info=None):
00198             self.fix_headers(environ, Headers.linked(headers), status)
00199             return start_response(status, headers, exc_info)
00200         return self.app(environ, fixing_start_response)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 164 of file fixers.py.

Definition at line 166 of file fixers.py.

Definition at line 165 of file fixers.py.


The documentation for this class was generated from the following file: