Commit 5a66bc83 authored by Denis Bilenko's avatar Denis Bilenko

pywsgi.py: log something sensible if log_request() was called before request was finished

parent 48bcc0c1
......@@ -368,13 +368,20 @@ class WSGIHandler(object):
def format_request(self):
now = datetime.now().replace(microsecond=0)
return '%s - - [%s] "%s" %s %s %.6f' % (
if self.time_finish:
delta = '%.6f' % (self.time_finish - self.time_start)
length = self.response_length
else:
delta = '-'
if not self.response_length:
length = '-'
return '%s - - [%s] "%s" %s %s %s' % (
self.client_address[0],
now,
self.requestline,
(self.status or '000').split()[0],
self.response_length,
self.time_finish - self.time_start)
length,
delta)
def run_application(self):
self.result = self.application(self.environ, self.start_response)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment