From 9fb8a90f623e2351ada24b0797f8a7b4c6ccdced Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Sat, 28 Aug 2004 15:07:42 +0000 Subject: [PATCH] To be honest, I'd prefer testing being done to this version instead since this is likely the "best" solution without more intrusive changes... Folding this in makes it easier to test and hopefully provide better feedback if we still want to try for a release soon. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@104883 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/http_protocol.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/http_protocol.c b/src/main/http_protocol.c index 8211a446605..9c86708573a 100644 --- a/src/main/http_protocol.c +++ b/src/main/http_protocol.c @@ -391,7 +391,6 @@ API_EXPORT(int) ap_set_keepalive(request_rec *r) int wimpy = ap_find_token(r->pool, ap_table_get(r->headers_out, "Connection"), "close"); const char *conn = ap_table_get(r->headers_in, "Connection"); - const char *herebefore = ap_table_get(r->notes, "ap_set_keepalive-called"); /* The following convoluted conditional determines whether or not * the current connection should remain persistent after this response @@ -442,17 +441,19 @@ API_EXPORT(int) ap_set_keepalive(request_rec *r) ) { int left = r->server->keep_alive_max - r->connection->keepalives; - r->connection->keepalive = 1; /* * ap_set_keepalive could be called multiple times (eg: in * ap_die() followed by ap_send_http_header()) during this * one single request. To ensure that we don't incorrectly * increment the keepalives counter for each call, we - * use notes to store a state flag. + * assume that only here do we set keepalive. So if keepalive + * is already set to 1, we must have already been here and + * we should not increment the keepalives counter since we + * already done so for this request. */ - if (!herebefore) { + if (r->connection->keepalive != 1) { + r->connection->keepalive = 1; r->connection->keepalives++; - ap_table_setn(r->notes, "ap_set_keepalive-called", "1"); } /* If they sent a Keep-Alive token, send one back */ -- 2.47.2