diff options
author | arved <arved@FreeBSD.org> | 2016-08-18 03:48:28 +0800 |
---|---|---|
committer | arved <arved@FreeBSD.org> | 2016-08-18 03:48:28 +0800 |
commit | d154c4e2ce45ec0bc0f579779ce06bda1777d825 (patch) | |
tree | efddc6e7527612692ab48721a4cfa3dca88af7d3 | |
parent | 7185a58ee0793504bb225f015d93f2b878c4919c (diff) | |
download | freebsd-ports-gnome-d154c4e2ce45ec0bc0f579779ce06bda1777d825.tar.gz freebsd-ports-gnome-d154c4e2ce45ec0bc0f579779ce06bda1777d825.tar.zst freebsd-ports-gnome-d154c4e2ce45ec0bc0f579779ce06bda1777d825.zip |
Fix two regressions:
1) mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin:
https://redmine.lighttpd.net/issues/2743
2) writev failed: Socket is not connected (fastcgi,scgi,proxy):
https://redmine.lighttpd.net/issues/2744
PR: 211646
Submitted by: maintainer
-rw-r--r-- | www/lighttpd/Makefile | 1 | ||||
-rw-r--r-- | www/lighttpd/files/patch-src_mod__fastcgi.c | 12 | ||||
-rw-r--r-- | www/lighttpd/files/patch-src_mod__proxy.c | 34 | ||||
-rw-r--r-- | www/lighttpd/files/patch-src_mod__scgi.c | 34 |
4 files changed, 81 insertions, 0 deletions
diff --git a/www/lighttpd/Makefile b/www/lighttpd/Makefile index c89c101101e8..ee4aa69a4221 100644 --- a/www/lighttpd/Makefile +++ b/www/lighttpd/Makefile @@ -3,6 +3,7 @@ PORTNAME?= lighttpd PORTVERSION= 1.4.41 +PORTREVISION= 1 CATEGORIES?= www MASTER_SITES?= http://download.lighttpd.net/lighttpd/releases-1.4.x/ diff --git a/www/lighttpd/files/patch-src_mod__fastcgi.c b/www/lighttpd/files/patch-src_mod__fastcgi.c new file mode 100644 index 000000000000..6a1b6fb43f96 --- /dev/null +++ b/www/lighttpd/files/patch-src_mod__fastcgi.c @@ -0,0 +1,12 @@ +--- src/mod_fastcgi.c.orig 2016-08-07 17:19:10 UTC ++++ src/mod_fastcgi.c +@@ -3257,7 +3257,8 @@ SUBREQUEST_FUNC(mod_fastcgi_handle_subre + } + } + +- return (0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ return ((0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ && hctx->state != FCGI_STATE_CONNECT_DELAYED) + ? fcgi_send_request(srv, hctx) + : HANDLER_WAIT_FOR_EVENT; + } diff --git a/www/lighttpd/files/patch-src_mod__proxy.c b/www/lighttpd/files/patch-src_mod__proxy.c new file mode 100644 index 000000000000..ca3354141483 --- /dev/null +++ b/www/lighttpd/files/patch-src_mod__proxy.c @@ -0,0 +1,34 @@ +--- src/mod_proxy.c.orig 2016-07-31 12:42:39 UTC ++++ src/mod_proxy.c +@@ -854,7 +854,20 @@ static handler_t proxy_write_request(ser + + if (hctx->wb->bytes_out == hctx->wb_reqlen) { + fdevent_event_clr(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); +- shutdown(hctx->fd, SHUT_WR);/* future: remove if HTTP/1.1 request */ ++ #if (defined(__APPLE__) && defined(__MACH__)) \ ++ || defined(__FreeBSD__) || defined(__NetBSD__) \ ++ || defined(__OpenBSD__) || defined(__DragonflyBSD__) ++ /*(*BSD stack on remote might signal POLLHUP and remote ++ * might treat as socket error instead of half-close)*/ ++ #else ++ /*(remote could be different machine running affected OS, ++ * so only issue shutdown for known local sockets)*/ ++ if ( '/' == host->host->ptr[0] ++ || buffer_is_equal_string(host->host, CONST_STR_LEN("127.0.0.1")) ++ || buffer_is_equal_string(host->host, CONST_STR_LEN("::1"))) { ++ shutdown(hctx->fd, SHUT_WR);/* future: remove if HTTP/1.1 request */ ++ } ++ #endif + proxy_set_state(srv, hctx, PROXY_STATE_READ); + } else { + off_t wblen = hctx->wb->bytes_in - hctx->wb->bytes_out; +@@ -992,7 +1005,8 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequ + } + } + +- return (0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ return ((0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ && hctx->state != PROXY_STATE_CONNECT) + ? proxy_send_request(srv, hctx) + : HANDLER_WAIT_FOR_EVENT; + } diff --git a/www/lighttpd/files/patch-src_mod__scgi.c b/www/lighttpd/files/patch-src_mod__scgi.c new file mode 100644 index 000000000000..947356aa1dd3 --- /dev/null +++ b/www/lighttpd/files/patch-src_mod__scgi.c @@ -0,0 +1,34 @@ +--- src/mod_scgi.c.orig 2016-08-07 12:39:31 UTC ++++ src/mod_scgi.c +@@ -2438,7 +2438,20 @@ static handler_t scgi_write_request(serv + + if (hctx->wb->bytes_out == hctx->wb_reqlen) { + fdevent_event_clr(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); +- shutdown(hctx->fd, SHUT_WR); ++ #if (defined(__APPLE__) && defined(__MACH__)) \ ++ || defined(__FreeBSD__) || defined(__NetBSD__) \ ++ || defined(__OpenBSD__) || defined(__DragonflyBSD__) ++ /*(*BSD stack on remote might signal POLLHUP and remote ++ * might treat as socket error instead of half-close)*/ ++ #else ++ /*(remote could be different machine running affected OS, ++ * so only issue shutdown for known local sockets)*/ ++ if ( '/' == host->host->ptr[0] ++ || buffer_is_equal_string(host->host, CONST_STR_LEN("127.0.0.1")) ++ || buffer_is_equal_string(host->host, CONST_STR_LEN("::1"))) { ++ shutdown(hctx->fd, SHUT_WR); ++ } ++ #endif + scgi_set_state(srv, hctx, FCGI_STATE_READ); + } else { + off_t wblen = hctx->wb->bytes_in - hctx->wb->bytes_out; +@@ -2585,7 +2598,8 @@ SUBREQUEST_FUNC(mod_scgi_handle_subreque + } + } + +- return (0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ return ((0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) ++ && hctx->state != FCGI_STATE_CONNECT) + ? scgi_send_request(srv, hctx) + : HANDLER_WAIT_FOR_EVENT; + } |