Add information about keep-alive connections to mod_status.

From upstream repo, via Brad.
This commit is contained in:
sthen 2009-06-22 09:28:07 +00:00
parent 98a5bdc341
commit bcb6ce4f58
3 changed files with 76 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.58 2009/06/19 23:12:03 sthen Exp $
# $OpenBSD: Makefile,v 1.59 2009/06/22 09:28:07 sthen Exp $
SHARED_ONLY= Yes
COMMENT= secure, fast, compliant, and very flexible web-server
DISTNAME= lighttpd-1.4.23
PKGNAME= ${DISTNAME}p0
CATEGORIES= www net
MASTER_SITES= ${HOMEPAGE}/download/

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-src_connections_c,v 1.8 2009/06/22 09:28:07 sthen Exp $
--- src/connections.c.orig Sun Jun 21 22:00:27 2009
+++ src/connections.c Sun Jun 21 22:03:27 2009
@@ -782,13 +782,13 @@ int connection_reset(server *srv, connection *con) {
CLEAN(request.pathinfo);
CLEAN(request.request);
- CLEAN(request.orig_uri);
+ /* CLEAN(request.orig_uri); */
CLEAN(uri.scheme);
- CLEAN(uri.authority);
- CLEAN(uri.path);
+ /* CLEAN(uri.authority); */
+ /* CLEAN(uri.path); */
CLEAN(uri.path_raw);
- CLEAN(uri.query);
+ /* CLEAN(uri.query); */
CLEAN(physical.doc_root);
CLEAN(physical.path);
@@ -1400,6 +1400,11 @@ int connection_state_machine(server *srv, connection *
log_error_write(srv, __FILE__, __LINE__, "sds",
"state for fd", con->fd, connection_get_state(con->state));
}
+
+ buffer_reset(con->uri.authority);
+ buffer_reset(con->uri.path);
+ buffer_reset(con->uri.query);
+ buffer_reset(con->request.orig_uri);
if (http_request_parse(srv, con)) {
/* we have to read some data from the POST request */

View File

@ -0,0 +1,41 @@
$OpenBSD: patch-src_mod_status_c,v 1.1 2009/06/22 09:28:07 sthen Exp $
--- src/mod_status.c.orig Sun Jun 21 22:03:52 2009
+++ src/mod_status.c Sun Jun 21 22:08:42 2009
@@ -438,7 +438,7 @@ static handler_t mod_status_handle_server_status_html(
buffer_append_string_len(b, CONST_STR_LEN(
"<hr />\n<pre><b>legend</b>\n"
- ". = connect, C = close, E = hard error\n"
+ ". = connect, C = close, E = hard error, k = keep-alive\n"
"r = read, R = read-POST, W = write, h = handle-request\n"
"q = request-start, Q = request-end\n"
"s = response-start, S = response-end\n"));
@@ -449,8 +449,14 @@ static handler_t mod_status_handle_server_status_html(
for (j = 0; j < srv->conns->used; j++) {
connection *c = srv->conns->ptr[j];
- const char *state = connection_get_short_state(c->state);
+ const char *state;
+ if (CON_STATE_READ == c->state && c->request.orig_uri->used > 0) {
+ state = "k";
+ } else {
+ state = connection_get_short_state(c->state);
+ }
+
buffer_append_string_len(b, state, 1);
if (((j + 1) % 50) == 0) {
@@ -497,7 +503,11 @@ static handler_t mod_status_handle_server_status_html(
buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"string\">"));
- buffer_append_string(b, connection_get_state(c->state));
+ if (CON_STATE_READ == c->state && c->request.orig_uri->used > 0) {
+ buffer_append_string_len(b, CONST_STR_LEN("keep-alive"));
+ } else {
+ buffer_append_string(b, connection_get_state(c->state));
+ }
buffer_append_string_len(b, CONST_STR_LEN("</td><td class=\"int\">"));