Mailing List Archive

[6855] cherokee/trunk: Better parsing of the "Connection:" header.
Revision: 6855
http://svn.cherokee-project.com/changeset/6855
Author: alo
Date: 2011-09-15 19:14:08 +0200 (Thu, 15 Sep 2011)
Log Message:
-----------
Better parsing of the "Connection:" header.

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

Added Paths:
-----------
cherokee/trunk/qa/289-Connection_TE.py

Modified: cherokee/trunk/cherokee/connection.c
===================================================================
--- cherokee/trunk/cherokee/connection.c 2011-09-15 17:13:59 UTC (rev 6854)
+++ cherokee/trunk/cherokee/connection.c 2011-09-15 17:14:08 UTC (rev 6855)
@@ -2429,13 +2429,13 @@
ret = cherokee_header_get_known (&conn->header, header_connection, &ptr, &ptr_len);
if (ret == ret_ok) {
if (conn->header.version == http_version_11) {
- if (strncasecmp (ptr, "Close", 5) != 0)
+ if (strncasestrn (ptr, ptr_len, "close", 5) == NULL)
goto granted;
else
goto denied;

} else {
- if (strncasecmp (ptr, "Keep-Alive", 10) == 0)
+ if (strncasestrn (ptr, ptr_len, "keep-alive", 10) != NULL)
goto granted;
else
goto denied;

Added: cherokee/trunk/qa/289-Connection_TE.py
===================================================================
--- cherokee/trunk/qa/289-Connection_TE.py (rev 0)
+++ cherokee/trunk/qa/289-Connection_TE.py 2011-09-15 17:14:08 UTC (rev 6855)
@@ -0,0 +1,13 @@
+from base import *
+
+class Test (TestBase):
+ def __init__ (self):
+ TestBase.__init__ (self, __file__)
+ self.name = "Connection: TE, close"
+ self.request = "GET / HTTP/1.1\r\n" +\
+ "Connection: TE, close\r\n" + \
+ "Host: www.cherokee-project.com\r\n"
+
+ self.expected_error = 200
+ self.expected_content = ['Connection: close']
+ self.forbidden_content = ['keep-alive']

Modified: cherokee/trunk/qa/Makefile.am
===================================================================
--- cherokee/trunk/qa/Makefile.am 2011-09-15 17:13:59 UTC (rev 6854)
+++ cherokee/trunk/qa/Makefile.am 2011-09-15 17:14:08 UTC (rev 6855)
@@ -309,7 +309,8 @@
285-Flcache-overwrite.py \
286-CGI-Permissions.py \
287-rule-inheritance.py \
-288-GZip-IE16.py
+288-GZip-IE16.py \
+289-Connection_TE.py

test:
python -m compileall .