#NEWLINE# def __init__( self , headers , body = '' ) : #NEWLINE# #INDENT# self . raw_headers = utf8 ( headers . strip ( ) ) #NEWLINE# self . body = utf8 ( body ) #NEWLINE# self . rfile = StringIO ( b'\r\n\r\n' . join ( [ self . raw_headers , self . body ] ) ) #NEWLINE# self . wfile = StringIO ( ) #NEWLINE# self . raw_requestline = self . rfile . readline ( ) #NEWLINE# self . error_code = None #NEWLINE# self . error_message = None #NEWLINE# if ( not self . parse_request ( ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . method = self . command #NEWLINE# try : #NEWLINE# #INDENT# self . path = self . path . encode ( 'iso-8859-1' ) #NEWLINE# #UNINDENT# except UnicodeDecodeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . path = decode_utf8 ( self . path ) #NEWLINE# qstring = self . path . split ( '?' , 1 ) [ ( - 1 ) ] #NEWLINE# self . querystring = self . parse_querystring ( body ) #NEWLINE# self . parsed_body = self . parse_request_body ( self . body )