Remove reverse DNS lookup

It wasn't working for years because the functionality was removed from http.server.
Nobody complained.
This commit is contained in:
Unrud 2020-02-19 09:48:34 +01:00
parent db7587c593
commit 4a43b17840
3 changed files with 2 additions and 14 deletions

3
config
View File

@ -45,9 +45,6 @@
# Available ciphers. See python's ssl module for available ciphers # Available ciphers. See python's ssl module for available ciphers
#ciphers = #ciphers =
# Reverse DNS to resolve client address in logs
#dns_lookup = True
[encoding] [encoding]

View File

@ -135,11 +135,7 @@ DEFAULT_CONFIG_SCHEMA = OrderedDict([
("ciphers", { ("ciphers", {
"value": "", "value": "",
"help": "available ciphers", "help": "available ciphers",
"type": str}), "type": str})])),
("dns_lookup", {
"value": "True",
"help": "use reverse DNS to resolve client address in logs",
"type": bool})])),
("encoding", OrderedDict([ ("encoding", OrderedDict([
("request", { ("request", {
"value": "utf-8", "value": "utf-8",

View File

@ -281,11 +281,6 @@ def serve(configuration, shutdown_socket=None):
raise RuntimeError("Failed to read SSL %s %r: %s" % raise RuntimeError("Failed to read SSL %s %r: %s" %
(name, filename, e)) from e (name, filename, e)) from e
class RequestHandlerCopy(RequestHandler):
"""Copy, avoids overriding the original class attributes."""
if not configuration.get("server", "dns_lookup"):
RequestHandlerCopy.address_string = lambda self: self.client_address[0]
if systemd: if systemd:
listen_fds = systemd.daemon.listen_fds() listen_fds = systemd.daemon.listen_fds()
else: else:
@ -305,7 +300,7 @@ def serve(configuration, shutdown_socket=None):
application = Application(configuration) application = Application(configuration)
for server_address in server_addresses: for server_address in server_addresses:
try: try:
server = ServerCopy(server_address, RequestHandlerCopy) server = ServerCopy(server_address, RequestHandler)
server.set_app(application) server.set_app(application)
except OSError as e: except OSError as e:
raise RuntimeError( raise RuntimeError(