def parse_request_uri(uri):
 if (uri == '*'):
  return (None, None, uri)
 i = uri.find('://')
 if ((i > 0) and ('?' not in uri[:i])):
  (scheme, remainder) = (uri[:i].lower(), uri[(i + 3):])
  (authority, path) = remainder.partition('/')[::2]
  path = ('/' + path)
  return (scheme, authority, path)
 if uri.startswith('/'):
  return (None, None, uri)
 else:
  return (None, uri, None)

def parse_request_uri ( uri ) : if ( uri == '*' ) : return ( None , None , uri ) i = uri . find ( '://' ) if ( ( i > 0 ) and ( '?' not in uri [ : i ] ) ) : ( scheme , remainder ) = ( uri [ : i ] . lower ( ) , uri [ ( i + 3 ) : ] ) ( authority , path ) = remainder . partition ( '/' ) [ : : 2 ] path = ( '/' + path ) return ( scheme , authority , path ) if uri . startswith ( '/' ) : return ( None , None , uri ) else : return ( None , uri , None )
parse a request-uri into .