|
@@ -7,7 +7,7 @@ class PlaintextTestType(FrameworkTestType):
|
|
|
|
|
|
def verify(self, base_url):
|
|
def verify(self, base_url):
|
|
url = base_url + self.plaintext_url
|
|
url = base_url + self.plaintext_url
|
|
- response = self._curl(url)
|
|
|
|
|
|
+ full_response = self._curl(url)
|
|
body = self._curl_body(url)
|
|
body = self._curl_body(url)
|
|
|
|
|
|
# Empty response
|
|
# Empty response
|
|
@@ -16,11 +16,6 @@ class PlaintextTestType(FrameworkTestType):
|
|
elif len(body) == 0:
|
|
elif len(body) == 0:
|
|
return [('fail','Empty Response', url)]
|
|
return [('fail','Empty Response', url)]
|
|
|
|
|
|
- # Ensure required response headers are present
|
|
|
|
- if any(v not in response for v in ('Server','Date','Content-Type: text/plain')) \
|
|
|
|
- or all(v not in response for v in ('Content-Length','Transfer-Encoding')):
|
|
|
|
- return [('warn','Required response header missing.',url)]
|
|
|
|
-
|
|
|
|
# Case insensitive
|
|
# Case insensitive
|
|
orig = body
|
|
orig = body
|
|
body = body.lower()
|
|
body = body.lower()
|
|
@@ -32,6 +27,11 @@ class PlaintextTestType(FrameworkTestType):
|
|
return [('warn', """Server is returning %s more bytes than are required.
|
|
return [('warn', """Server is returning %s more bytes than are required.
|
|
This may negatively affect benchmark performance""" % (len(body) - len("hello, world!")), url)]
|
|
This may negatively affect benchmark performance""" % (len(body) - len("hello, world!")), url)]
|
|
|
|
|
|
|
|
+ # Ensure required response headers are present
|
|
|
|
+ if any(v.lower() not in full_response.lower() for v in ('Server','Date','Content-Type: text/plain')) \
|
|
|
|
+ or all(v.lower() not in full_response.lower() for v in ('Content-Length','Transfer-Encoding')):
|
|
|
|
+ return [('warn','Required response header missing.',url)]
|
|
|
|
+
|
|
return [('pass', '', url)]
|
|
return [('pass', '', url)]
|
|
|
|
|
|
def get_url(self):
|
|
def get_url(self):
|