summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wsgitools/filters.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/wsgitools/filters.py b/wsgitools/filters.py
index 5b97e27..580a1c7 100644
--- a/wsgitools/filters.py
+++ b/wsgitools/filters.py
@@ -219,23 +219,31 @@ class RequestLogWSGIFilter(BaseWSGIFilter):
BaseWSGIFilter.__init__(self)
assert hasattr(log, "write")
self.log = log
+ self.remote = "?"
+ self.user = "-"
self.time = time.strftime("%d/%b/%Y:%T %z")
+ self.reqmethod = ""
+ self.path = ""
+ self.proto = None
+ self.status = ""
self.length = 0
+ self.referrer = None
+ self.useragent = None
def filter_environ(self, environ):
"""BaseWSGIFilter interface
@type environ: {str: str}
@rtype: {str: str}
"""
assert isinstance(environ, dict)
- self.remote = environ.get("REMOTE_ADDR", "?")
- self.user = environ.get("REMOTE_USER", "-")
+ self.remote = environ.get("REMOTE_ADDR", self.remote)
+ self.user = environ.get("REMOTE_USER", self.user)
self.reqmethod = environ["REQUEST_METHOD"]
self.path = environ["SCRIPT_NAME"] + environ["PATH_INFO"]
if environ.get("QUERY_STRING"):
self.path = "%s?%s" % (self.path, environ["QUERY_STRING"])
- self.proto = environ.get("SERVER_PROTOCOL", None)
- self.referrer = environ.get("HTTP_REFERER", "-")
- self.useragent = environ.get("HTTP_USER_AGENT", "-")
+ self.proto = environ.get("SERVER_PROTOCOL", self.proto)
+ self.referrer = environ.get("HTTP_REFERER", self.referrer)
+ self.useragent = environ.get("HTTP_USER_AGENT", self.useragent)
return environ
def filter_status(self, status):
"""BaseWSGIFilter interface