def test(HandlerClass = BaseHTTPRequestHandler,
         ServerClass = HTTPServer, protocol="HTTP/1.0"):
    """Test the HTTP request handler class.

    This runs an HTTP server on port 8000 (or the first command line
    argument).

    """

    if sys.argv[1:]:
        port = int(sys.argv[1])
    else:
        port = 8000
    server_address = ('', port)

    HandlerClass.protocol_version = protocol
    httpd = ServerClass(server_address, HandlerClass)

    sa = httpd.socket.getsockname()
    print ("Serving HTTP on", sa[0], "port", sa[1], "...")
    httpd.serve_forever()
def test ( HandlerClass = BaseHTTPRequestHandler , ServerClass = HTTPServer , protocol = "HTTP/1.0" ) : if sys . argv [ 1 : ] : port = int ( sys . argv [ 1 ] ) else : port = 8000 server_address = ( '' , port ) HandlerClass . protocol_version = protocol httpd = ServerClass ( server_address , HandlerClass ) sa = httpd . socket . getsockname ( ) print ( "Serving HTTP on" , sa [ 0 ] , "port" , sa [ 1 ] , "..." ) httpd . serve_forever ( )
Test the HTTP request handler class.

    This runs an HTTP server on port 8000 (or the first command line
    argument).