Merge pull request #559 from Unrud/remotehostlogging
Cleanup remote host logging
This commit is contained in:
commit
33b27a2e71
@ -310,20 +310,19 @@ class Application:
|
|||||||
return [answer] if answer else []
|
return [answer] if answer else []
|
||||||
|
|
||||||
remote_host = "UNKNOWN"
|
remote_host = "UNKNOWN"
|
||||||
if "REMOTE_HOST" in environ:
|
if environ.get("REMOTE_HOST"):
|
||||||
if environ["REMOTE_HOST"]:
|
remote_host = environ["REMOTE_HOST"]
|
||||||
remote_host = environ["REMOTE_HOST"]
|
elif environ.get("REMOTE_ADDR"):
|
||||||
if "HTTP_X_FORWARDED_FOR" in environ:
|
remote_host = environ["REMOTE_ADDR"]
|
||||||
if environ["HTTP_X_FORWARDED_FOR"]:
|
if environ.get("HTTP_X_FORWARDED_FOR"):
|
||||||
remote_host = environ["HTTP_X_FORWARDED_FOR"]
|
remote_host = "%s (forwarded by %s)" % (
|
||||||
remote_useragent = "[-no-user-agent-provided-]"
|
environ["HTTP_X_FORWARDED_FOR"], remote_host)
|
||||||
if "HTTP_USER_AGENT" in environ:
|
remote_useragent = "UNKNOWN"
|
||||||
if environ["HTTP_USER_AGENT"]:
|
if environ.get("HTTP_USER_AGENT"):
|
||||||
remote_useragent = environ["HTTP_USER_AGENT"]
|
remote_useragent = environ["HTTP_USER_AGENT"]
|
||||||
depthinfo = ""
|
depthinfo = ""
|
||||||
if "HTTP_DEPTH" in environ:
|
if environ.get("HTTP_DEPTH"):
|
||||||
if environ["HTTP_DEPTH"]:
|
depthinfo = " with depth " + environ["HTTP_DEPTH"]
|
||||||
depthinfo = " with depth " + environ["HTTP_DEPTH"]
|
|
||||||
time_begin = datetime.datetime.now()
|
time_begin = datetime.datetime.now()
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"%s request for %s received from %s using \"%s\"",
|
"%s request for %s received from %s using \"%s\"",
|
||||||
|
Loading…
Reference in New Issue
Block a user