# _*_ coding: utf-8 _*_ import socket import SocketServer import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler class ForkingHTTPServer(SocketServer.ForkingTCPServer): allow_reuse_address = 1 def server_bind(self): SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname()[:2] self.server_name = socket.getfqdn(host) self.server_port = port def test(HanderClass=SimpleHTTPRequestHandler, ServerClass=ForkingHTTPServer): BaseHTTPServer.test(HanderClass, ServerClass) if __name__ == '__main__': test()
SimpleHTTPServer的多并发版
最新推荐文章于 2024-08-25 08:31:48 发布