mod_proxy fixes, from upstream via Brad

This commit is contained in:
sthen 2010-04-09 11:06:22 +00:00
parent 82aee579ee
commit d9712547e1
2 changed files with 60 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.66 2010/03/21 09:56:55 sthen Exp $
# $OpenBSD: Makefile,v 1.67 2010/04/09 11:06:22 sthen Exp $
SHARED_ONLY= Yes
COMMENT= secure, fast, compliant, and very flexible web-server
DISTNAME= lighttpd-1.4.26
PKGNAME= ${DISTNAME}p0
CATEGORIES= www net
MASTER_SITES= http://download.lighttpd.net/lighttpd/releases-1.4.x/

View File

@ -0,0 +1,58 @@
$OpenBSD: patch-src_mod_proxy_c,v 1.3 2010/04/09 11:06:22 sthen Exp $
--- src/mod_proxy.c.orig Mon Feb 1 18:28:20 2010
+++ src/mod_proxy.c Wed Apr 7 21:05:00 2010
@@ -349,6 +349,10 @@ static void proxy_connection_close(server *srv, handle
srv->cur_fds--;
}
+ if (hctx->host) {
+ hctx->host->usage--;
+ }
+
handler_ctx_free(hctx);
con->plugin_ctx[p->id] = NULL;
}
@@ -848,11 +852,11 @@ static handler_t proxy_write_request(server *srv, hand
if (-1 == ret) { /* error on our side */
log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed:", strerror(errno), errno);
- return HANDLER_WAIT_FOR_EVENT;
+ return HANDLER_ERROR;
} else if (-2 == ret) { /* remote close */
log_error_write(srv, __FILE__, __LINE__, "ssd", "write failed, remote connection close:", strerror(errno), errno);
- return HANDLER_WAIT_FOR_EVENT;
+ return HANDLER_ERROR;
}
if (hctx->wb->bytes_out == hctx->wb->bytes_in) {
@@ -989,8 +993,6 @@ static handler_t proxy_handle_fdevent(void *s, void *c
case 0:
break;
case 1:
- hctx->host->usage--;
-
/* we are done */
proxy_connection_close(srv, hctx);
@@ -1077,8 +1079,11 @@ static handler_t proxy_handle_fdevent(void *s, void *c
return HANDLER_FINISHED;
}
- con->file_finished = 1;
+ if (!con->file_finished) {
+ http_chunk_append_mem(srv, con, NULL, 0);
+ }
+ con->file_finished = 1;
proxy_connection_close(srv, hctx);
joblist_append(srv, con);
} else if (revents & FDEVENT_ERR) {
@@ -1086,6 +1091,7 @@ static handler_t proxy_handle_fdevent(void *s, void *c
log_error_write(srv, __FILE__, __LINE__, "sd", "proxy-FDEVENT_ERR, but no HUP", revents);
+ con->file_finished = 1;
joblist_append(srv, con);
proxy_connection_close(srv, hctx);
}