Mailing List Archive

[6857] cherokee/trunk/qa: Adds a new QA test.
Revision: 6857
http://svn.cherokee-project.com/changeset/6857
Author: alo
Date: 2011-09-16 17:41:07 +0200 (Fri, 16 Sep 2011)
Log Message:
-----------
Adds a new QA test. It covers whether after a 301 response a
keep-alive connection isn't closed. Bug #568.

Modified Paths:
--------------
cherokee/trunk/qa/Makefile.am

Added Paths:
-----------
cherokee/trunk/qa/291-Redir-keepalive.py

Added: cherokee/trunk/qa/291-Redir-keepalive.py
===================================================================
--- cherokee/trunk/qa/291-Redir-keepalive.py (rev 0)
+++ cherokee/trunk/qa/291-Redir-keepalive.py 2011-09-16 15:41:07 UTC (rev 6857)
@@ -0,0 +1,39 @@
+from base import *
+
+DIR = "redir-keepalive-1"
+
+class Test (TestBase):
+ def __init__ (self):
+ TestBase.__init__ (self, __file__)
+ self.name = "Keep-alive after 301 response"
+ self.expected_error = 301
+
+ request_base = "GET /%s HTTP/1.1\r\n" % (DIR) + \
+ "Host: example.com\r\n"
+
+ self.request = request_base + \
+ "Connection: keep-alive\r\n" + \
+ "\r\n" + \
+ request_base + \
+ "Connection: close\r\n"
+
+ def Prepare (self, www):
+ # Local directory
+ self.Mkdir (www, DIR)
+
+ def CustomTest (self):
+
+ parts = self.reply.split ('HTTP/1.1 301')
+ if len(parts) != 3:
+ return -1
+
+ first_response = parts[1]
+ second_response = parts[2]
+
+ if "close" in first_response.lower():
+ return -1
+
+ if not "close" in second_response.lower():
+ return -1
+
+ return 0

Modified: cherokee/trunk/qa/Makefile.am
===================================================================
--- cherokee/trunk/qa/Makefile.am 2011-09-16 10:43:55 UTC (rev 6856)
+++ cherokee/trunk/qa/Makefile.am 2011-09-16 15:41:07 UTC (rev 6857)
@@ -311,7 +311,8 @@
287-rule-inheritance.py \
288-GZip-IE16.py \
289-Connection_TE.py \
-290-Question-mark-in-name.py
+290-Question-mark-in-name.py \
+291-Redir-keepalive.py

test:
python -m compileall .