<s> from __future__ import absolute_import <EOL> class SetRemoteAddrFromForwardedFor ( object ) : <EOL> def process_request ( self , request ) : <EOL> try : <EOL> real_ip = request . META [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> pass <EOL> else : <EOL> real_ip = real_ip . split ( "<STR_LIT:U+002C>" ) [ <NUM_LIT:0> ] <EOL> request . META [ '<STR_LIT>' ] = real_ip <EOL> class ContentLengthHeaderMiddleware ( object ) : <EOL> """<STR_LIT>""" <EOL> def process_response ( self , request , response ) : <EOL> if '<STR_LIT>' in response or '<STR_LIT>' in response : <EOL> return response <EOL> if not response . streaming : <EOL> response [ '<STR_LIT>' ] = str ( len ( response . content ) ) <EOL> return response </s>
