[Cherokee-commits] [1806] cherokee/trunk:
SVN at cherokee-project.com
SVN at cherokee-project.com
Thu Aug 14 11:09:01 CEST 2008
Revision: 1806
http://svn.cherokee-project.com/changeset/1806
Author: alo
Date: 2008-08-14 11:09:01 +0200 (Thu, 14 Aug 2008)
Log Message:
-----------
Modified Paths:
--------------
cherokee/trunk/ChangeLog
cherokee/trunk/cherokee/connection.c
Modified: cherokee/trunk/ChangeLog
===================================================================
--- cherokee/trunk/ChangeLog 2008-08-13 19:30:19 UTC (rev 1805)
+++ cherokee/trunk/ChangeLog 2008-08-14 09:09:01 UTC (rev 1806)
@@ -1,3 +1,8 @@
+2008-08-14 Alvaro Lopez Ortega <alvaro at alobbs.com>
+
+ * cherokee/connection.c: Allows 3xx replies to keep the connection
+ alive.
+
2008-08-13 Taher Shihadeh <taher at unixwars.com>
* doc/basics.txt, doc/basics_why_cherokee.txt,
Modified: cherokee/trunk/cherokee/connection.c
===================================================================
--- cherokee/trunk/cherokee/connection.c 2008-08-13 19:30:19 UTC (rev 1805)
+++ cherokee/trunk/cherokee/connection.c 2008-08-14 09:09:01 UTC (rev 1806)
@@ -356,10 +356,6 @@
vsrv = CONN_VSRV(conn);
entry = vsrv->error_handler;
- /* On error, it will close the socket
- */
- conn->keepalive = 0;
-
/* It has a common handler. It has to be freed.
*/
if (conn->handler != NULL) {
@@ -389,6 +385,14 @@
}
#endif
+ /* Only 3xx errors can keep the connection alive
+ */
+ if ((! (http_type_300 (conn->error_code))) ||
+ (! (conn->handler->support & hsupport_length)))
+ {
+ conn->keepalive = 0;
+ }
+
/* Nothing should be mmaped any longer
*/
if (conn->io_entry_ref != NULL) {
@@ -558,11 +562,18 @@
}
}
+ /* It might need to deactive Keep-Alive
+ */
if ((conn->keepalive != 0) &&
- HANDLER_SUPPORTS(conn->handler, hsupport_maybe_length)) {
- if (strcasestr (conn->header_buffer.buf, "Content-Length: ") == NULL) {
+ (http_method_with_body (conn->error_code)))
+ {
+ if (HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length)) {
+ if (strcasestr (conn->header_buffer.buf, "Content-Length: ") == NULL)
+ conn->keepalive = 0;
+ }
+
+ if (HANDLER_SUPPORTS (conn->handler, hsupport_length) == 0)
conn->keepalive = 0;
- }
}
/* Add the server headers
@@ -1710,7 +1721,6 @@
if (strncasecmp (ptr, "close", 5) == 0) {
conn->keepalive = 0;
}
-
} else {
conn->keepalive = 0;
}
@@ -1783,21 +1793,13 @@
conn->request.buf,
conn->local_directory.buf);
- /* If the connection is keep-alive
- * then verify whether the handler supports it.
- */
- if ((conn->keepalive != 0) &&
- (HANDLER_SUPPORTS (conn->handler, hsupport_length) == 0) &&
- (HANDLER_SUPPORTS (conn->handler, hsupport_maybe_length) == 0))
- {
- conn->keepalive = 0;
- }
-
/* Ensure the space for headers and I/O buffer
*/
cherokee_buffer_ensure_size (&conn->header_buffer, 384);
cherokee_buffer_ensure_size (&conn->buffer, DEFAULT_READ_SIZE+1);
+ /* Init the connection handler object
+ */
return cherokee_handler_init (conn->handler);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.octality.com/pipermail/cherokee-commits/attachments/20080814/b2351e9e/attachment-0001.htm
More information about the Cherokee-commits
mailing list