[core] replace con->response.keep_alive
set con->keep_alive = 0 to indicate backend request to close connection
This commit is contained in:
parent
25185d1de0
commit
23b0d867c5
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue