summaryrefslogtreecommitdiff
path: root/src/response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/response.c')
-rw-r--r--src/response.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/response.c b/src/response.c
index ae9aeff..df543a5 100644
--- a/src/response.c
+++ b/src/response.c
@@ -1,3 +1,14 @@
+#include "response.h"
+#include "keyvalue.h"
+#include "log.h"
+#include "stat_cache.h"
+#include "chunk.h"
+
+#include "configfile.h"
+#include "connections.h"
+
+#include "plugin.h"
+
#include <sys/types.h>
#include <sys/stat.h>
@@ -13,17 +24,6 @@
#include <stdio.h>
-#include "response.h"
-#include "keyvalue.h"
-#include "log.h"
-#include "stat_cache.h"
-#include "chunk.h"
-
-#include "configfile.h"
-#include "connections.h"
-
-#include "plugin.h"
-
#include "sys-socket.h"
#include "version.h"
@@ -45,8 +45,10 @@ int http_response_write_header(server *srv, connection *con) {
buffer_append_string(b, get_http_status_name(con->http_status));
/* disable keep-alive if requested */
- if (con->request_count > con->conf.max_keep_alive_requests) {
+ if (con->request_count > con->conf.max_keep_alive_requests || 0 == con->conf.max_keep_alive_idle) {
con->keep_alive = 0;
+ } else {
+ con->keep_alive_idle = con->conf.max_keep_alive_idle;
}
if (con->request.http_version != HTTP_VERSION_1_1 || con->keep_alive == 0) {
@@ -70,7 +72,7 @@ int http_response_write_header(server *srv, connection *con) {
if (ds->value->used && ds->key->used &&
0 != strncasecmp(ds->key->ptr, CONST_STR_LEN("X-LIGHTTPD-")) &&
- 0 != strcasecmp(ds->key->ptr, "X-Sendfile")) {
+ 0 != strncasecmp(ds->key->ptr, CONST_STR_LEN("X-Sendfile"))) {
if (0 == strcasecmp(ds->key->ptr, "Date")) have_date = 1;
if (0 == strcasecmp(ds->key->ptr, "Server")) have_server = 1;
if (0 == strcasecmp(ds->key->ptr, "Content-Encoding") && 304 == con->http_status) continue;