<s> """<STR_LIT>""" <EOL> def clean_headers_client ( header ) : <EOL> """<STR_LIT>""" <EOL> valid = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for name , value in header . items ( ) : <EOL> if name . lower ( ) not in valid : <EOL> del header [ name ] <EOL> else : <EOL> del header [ name ] <EOL> header [ name . lower ( ) ] = value <EOL> if name . lower ( ) == '<STR_LIT>' : <EOL> allowed_extensions = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> header [ name . lower ( ) ] = '<STR_LIT:U+0020>' . join ( [ <EOL> x for x in header [ name . lower ( ) ] . split ( '<STR_LIT:U+0020>' ) if <EOL> x in allowed_extensions ] ) <EOL> return header <EOL> def clean_headers_server ( header ) : <EOL> """<STR_LIT>""" <EOL> valid = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> for name , value in header . items ( ) : <EOL> if name . lower ( ) not in valid : <EOL> del header [ name ] <EOL> else : <EOL> del header [ name ] <EOL> header [ name . lower ( ) ] = value <EOL> return header <EOL> def get_headers ( environ ) : <EOL> """<STR_LIT>""" <EOL> headers = { } <EOL> for name in environ : <EOL> if name [ <NUM_LIT:0> : <NUM_LIT:5> ] == "<STR_LIT>" : <EOL> headers [ name [ <NUM_LIT:5> : ] ] = environ [ name ] <EOL> return headers </s>
