<s> """<STR_LIT>""" <EOL> def fix_location_header ( request , response ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in response and request . get_host ( ) : <EOL> response [ '<STR_LIT>' ] = request . build_absolute_uri ( response [ '<STR_LIT>' ] ) <EOL> return response <EOL> def conditional_content_removal ( request , response ) : <EOL> """<STR_LIT>""" <EOL> if <NUM_LIT:100> <= response . status_code < <NUM_LIT:200> or response . status_code in ( <NUM_LIT> , <NUM_LIT> ) : <EOL> response . content = '<STR_LIT>' <EOL> response [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> if request . method == '<STR_LIT>' : <EOL> response . content = '<STR_LIT>' <EOL> return response <EOL> def fix_IE_for_attach ( request , response ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' not in request . META . get ( '<STR_LIT>' , '<STR_LIT>' ) . upper ( ) : <EOL> return response <EOL> offending_headers = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if response . has_header ( '<STR_LIT>' ) : <EOL> try : <EOL> del response [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> pass <EOL> if response . has_header ( '<STR_LIT>' ) : <EOL> cache_control_values = [ value . strip ( ) for value in <EOL> response [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) <EOL> if value . strip ( ) . lower ( ) not in offending_headers ] <EOL> if not len ( cache_control_values ) : <EOL> del response [ '<STR_LIT>' ] <EOL> else : <EOL> response [ '<STR_LIT>' ] = '<STR_LIT:U+002CU+0020>' . join ( cache_control_values ) <EOL> return response <EOL> def fix_IE_for_vary ( request , response ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' not in request . META . get ( '<STR_LIT>' , '<STR_LIT>' ) . upper ( ) : <EOL> return response <EOL> safe_mime_types = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if response [ '<STR_LIT:Content-Type>' ] . split ( '<STR_LIT:;>' ) [ <NUM_LIT:0> ] not in safe_mime_types : <EOL> try : <EOL> del response [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> pass <EOL> return response </s>
