Add a config key to ignore reverse DNS (fixes #779)
This commit is contained in:
parent
7bfc17a51d
commit
344f87d8fb
2
config
2
config
@ -25,6 +25,8 @@ ssl = False
|
|||||||
certificate = /etc/apache2/ssl/server.crt
|
certificate = /etc/apache2/ssl/server.crt
|
||||||
# SSL private key
|
# SSL private key
|
||||||
key = /etc/apache2/ssl/server.key
|
key = /etc/apache2/ssl/server.key
|
||||||
|
# Reverse DNS to resolve client address in logs
|
||||||
|
dns_lookup = True
|
||||||
|
|
||||||
|
|
||||||
[encoding]
|
[encoding]
|
||||||
|
@ -105,6 +105,14 @@ class RequestHandler(wsgiref.simple_server.WSGIRequestHandler):
|
|||||||
def log_message(self, *args, **kwargs):
|
def log_message(self, *args, **kwargs):
|
||||||
"""Disable inner logging management."""
|
"""Disable inner logging management."""
|
||||||
|
|
||||||
|
def address_string(self):
|
||||||
|
"""Client address, formatted for logging."""
|
||||||
|
if config.getboolean("server", "dns_lookup"):
|
||||||
|
return \
|
||||||
|
wsgiref.simple_server.WSGIRequestHandler.address_string(self)
|
||||||
|
else:
|
||||||
|
return self.client_address[0]
|
||||||
|
|
||||||
|
|
||||||
class Application(object):
|
class Application(object):
|
||||||
"""WSGI application managing collections."""
|
"""WSGI application managing collections."""
|
||||||
|
@ -44,7 +44,8 @@ INITIAL_CONFIG = {
|
|||||||
"pid": "",
|
"pid": "",
|
||||||
"ssl": "False",
|
"ssl": "False",
|
||||||
"certificate": "/etc/apache2/ssl/server.crt",
|
"certificate": "/etc/apache2/ssl/server.crt",
|
||||||
"key": "/etc/apache2/ssl/server.key"},
|
"key": "/etc/apache2/ssl/server.key",
|
||||||
|
"dns_lookup": "True"},
|
||||||
"encoding": {
|
"encoding": {
|
||||||
"request": "utf-8",
|
"request": "utf-8",
|
||||||
"stock": "utf-8"},
|
"stock": "utf-8"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user