Commit 1cff57c4 authored by Vincent Pelletier's avatar Vincent Pelletier

apachedex: Add support for non-standard 444 and 499 status codes.

Give them captions.
Also, tread 499 as a non-error: client closed the connection before server
could respond, so it is likely not something the server could be
considered responsible for. Of course, the response time still matters,
so if these statuses come after slow responses it will still affect the
score.
parent 6073b969
......@@ -131,8 +131,13 @@ AUTO_PERIOD_COEF = 200
LARGER_THAN_INTEGER_STR = 'A'
SMALLER_THAN_INTEGER_STR = ''
HTTP_STATUS_CAPTION_DICT = httplib.responses.copy()
# Non-standard status codes
HTTP_STATUS_CAPTION_DICT.setdefault(499, 'Client Closed Request')
HTTP_STATUS_CAPTION_DICT.setdefault(444, 'No Response')
def statusIsError(status):
return status[0] > '3'
return status[0] > '3' and status != '499'
def getClassForDuration(duration, threshold):
if duration <= threshold:
......@@ -455,7 +460,7 @@ class GenericSiteStats(object):
return '<td class="%s">%s</td>' % (getClassForStatusHit(hit, status), hit)
def statusAsHtml(status):
try:
definition = httplib.responses[int(status)]
definition = HTTP_STATUS_CAPTION_DICT[int(status)]
except KeyError:
return status
else:
......
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