summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-02-08 23:18:36 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2019-02-08 23:18:36 -0500
commit23b0d867c5454423fe153849a7ed7114a10e056b (patch)
treed1fd900e48d07cc28bd2581c4944cb9323c85318
parent25185d1de0e152e4d4461b856c7d537ea12e2ef5 (diff)
downloadlighttpd-git-23b0d867c5454423fe153849a7ed7114a10e056b.tar.gz
[core] replace con->response.keep_alive
set con->keep_alive = 0 to indicate backend request to close connection
-rw-r--r--src/base.h2
-rw-r--r--src/connections-glue.c1
-rw-r--r--src/connections.c17
-rw-r--r--src/http-header-glue.c6
4 files changed, 4 insertions, 22 deletions
diff --git a/src/base.h b/src/base.h
index 827ce5da..1f56303b 100644
--- a/src/base.h
+++ b/src/base.h
@@ -50,8 +50,6 @@ typedef struct {
typedef struct {
off_t content_length;
- int keep_alive; /* used by the subrequests in proxy, cgi and fcgi to say the subrequest was keep-alive or not */
-
unsigned int htags; /* bitfield of flagged headers present in response */
array *headers;
int send_chunked;
diff --git a/src/connections-glue.c b/src/connections-glue.c
index 8b4f9712..7d8a9e04 100644
--- a/src/connections-glue.c
+++ b/src/connections-glue.c
@@ -492,7 +492,6 @@ void connection_response_reset(server *srv, connection *con) {
con->is_writable = 1;
con->file_finished = 0;
con->file_started = 0;
- con->response.keep_alive = 0;
if (con->physical.path) { /*(skip for mod_fastcgi authorizer)*/
buffer_clear(con->physical.doc_root);
buffer_reset(con->physical.path);
diff --git a/src/connections.c b/src/connections.c
index ac032555..e9d18a61 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -422,22 +422,6 @@ static int connection_handle_write_prepare(server *srv, connection *con) {
con->keep_alive = 0;
}
}
-
- /**
- * if the backend sent a Connection: close, follow the wish
- *
- * NOTE: if the backend sent Connection: Keep-Alive, but no Content-Length, we
- * will close the connection. That's fine. We can always decide the close
- * the connection
- *
- * FIXME: to be nice we should remove the Connection: ...
- */
- if (con->response.htags & HTTP_HEADER_CONNECTION) {
- /* a subrequest disable keep-alive although the client wanted it */
- if (con->keep_alive && !con->response.keep_alive) {
- con->keep_alive = 0;
- }
- }
}
if (con->request.http_method == HTTP_METHOD_HEAD) {
@@ -1200,7 +1184,6 @@ static int connection_handle_request(server *srv, connection *con) {
con->is_writable = 1;
con->file_finished = 0;
con->file_started = 0;
- con->response.keep_alive = 0;
con->error_handler_saved_status = con->http_status;
con->error_handler_saved_method = con->request.http_method;
diff --git a/src/http-header-glue.c b/src/http-header-glue.c
index 6aae9728..168c2520 100644
--- a/src/http-header-glue.c
+++ b/src/http-header-glue.c
@@ -988,8 +988,10 @@ static int http_response_process_headers(server *srv, connection *con, http_resp
break;
case HTTP_HEADER_CONNECTION:
if (opts->backend == BACKEND_PROXY) continue;
- con->response.keep_alive =
- (0 == strcasecmp(value, "Keep-Alive")) ? 1 : 0;
+ /*(should parse for tokens and do case-insensitive match for "close"
+ * but this is an imperfect though simplistic attempt to honor
+ * backend request to close)*/
+ if (NULL != strstr(value, "lose")) con->keep_alive = 0;
break;
case HTTP_HEADER_CONTENT_LENGTH:
con->response.content_length = strtoul(value, NULL, 10);