#NEWLINE# def _parse_req( self , req ) : #NEWLINE# #INDENT# reqlines = req . split ( ( b'\r\n' if ( b'\r\n' in req ) else b'\n' ) ) #NEWLINE# reqwords = reqlines [ 0 ] . split ( b' ' ) #NEWLINE# urlparts = reqwords [ 1 ] . split ( b'?' ) #NEWLINE# headers = map ( ( lambda v : ( ( v if ( v [ 0 ] in [ b'CONTENT_TYPE' , b'CONTENT_LENGTH' ] ) else ( b'HTTP_' + v [ 0 ] ) ) , v [ 1 ] ) ) , map ( ( lambda w : ( w [ 0 ] . strip ( ) . replace ( b'-' , b'_' ) . upper ( ) , w [ 2 ] . strip ( ) ) ) , map ( ( lambda l : l . partition ( b':' ) ) , reqlines [ 1 : ] ) ) ) #NEWLINE# return dict ( ( [ ( 'SERVER_NAME' , ( self . _serveraddr [ 0 ] or 'localhost' ) ) , ( 'SERVER_PORT' , self . _serveraddr [ 1 ] ) , ( 'REQUEST_METHOD' , reqwords [ 0 ] ) , ( 'SERVER_PROTOCOL' , reqwords [ 2 ] ) , ( 'PATH_INFO' , urlparts [ 0 ] ) , ( 'QUERY_STRING' , urlparts [ 1 ] ) , ( 'wsgi.version' , ( 1 , 0 ) ) , ( 'wsgi.url_scheme' , 'http' ) , ( 'wsgi.input' , '' ) , ( 'wsgi.errors' , [ ] ) , ( 'wsgi.multithread' , False ) , ( 'wsgi.multiprocess' , True ) , ( 'wsgi.run_once' , False ) ] + list ( headers ) ) )