check env first before using HTTP_DEPTH

This commit is contained in:
Peter Bieringer 2016-09-19 20:04:11 +02:00
parent 87061df68f
commit f52fa73cab

View File

@ -316,8 +316,9 @@ class Application:
if environ["HTTP_USER_AGENT"]: if environ["HTTP_USER_AGENT"]:
remote_useragent = environ["HTTP_USER_AGENT"] remote_useragent = environ["HTTP_USER_AGENT"]
depthinfo = "" depthinfo = ""
if environ["HTTP_DEPTH"]: if "HTTP_DEPTH" in environ:
depthinfo = " with depth " + environ["HTTP_DEPTH"] if environ["HTTP_DEPTH"]:
depthinfo = " with depth " + environ["HTTP_DEPTH"]
time_begin = datetime.datetime.now() time_begin = datetime.datetime.now()
self.logger.info("%s request for %s received from %s using \"%s\"", self.logger.info("%s request for %s received from %s using \"%s\"",
environ["REQUEST_METHOD"], environ["PATH_INFO"] + depthinfo, remote_host, remote_useragent) environ["REQUEST_METHOD"], environ["PATH_INFO"] + depthinfo, remote_host, remote_useragent)