如何在python webserver中禁用反向dns查找?

2024-05-16 02:39:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个简单的python cgi服务器:

import BaseHTTPServer
import CGIHTTPServer
import cgitb; cgitb.enable()  ## This line enables CGI error reporting

server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("", 8000)
httpd = server(server_address, handler)
httpd.serve_forever()

服务器对每个请求执行反向dns查找,以便将其记录到屏幕上。没有可用的dns服务器,因为我正在本地网络设置中运行服务器。所以每次反向dns查找都会导致查找超时,从而延迟服务器的响应。如何禁用dns查找?我在python文档中没有找到答案。在


Tags: import服务器serveraddressdnsenablelinethis