Line 0
Link Here
|
|
|
1 |
--- src/mod_proxy.c.orig 2016-07-31 12:42:39 UTC |
2 |
+++ src/mod_proxy.c |
3 |
@@ -854,7 +854,20 @@ static handler_t proxy_write_request(ser |
4 |
|
5 |
if (hctx->wb->bytes_out == hctx->wb_reqlen) { |
6 |
fdevent_event_clr(srv->ev, &(hctx->fde_ndx), hctx->fd, FDEVENT_OUT); |
7 |
- shutdown(hctx->fd, SHUT_WR);/* future: remove if HTTP/1.1 request */ |
8 |
+ #if (defined(__APPLE__) && defined(__MACH__)) \ |
9 |
+ || defined(__FreeBSD__) || defined(__NetBSD__) \ |
10 |
+ || defined(__OpenBSD__) || defined(__DragonflyBSD__) |
11 |
+ /*(*BSD stack on remote might signal POLLHUP and remote |
12 |
+ * might treat as socket error instead of half-close)*/ |
13 |
+ #else |
14 |
+ /*(remote could be different machine running affected OS, |
15 |
+ * so only issue shutdown for known local sockets)*/ |
16 |
+ if ( '/' == host->host->ptr[0] |
17 |
+ || buffer_is_equal_string(host->host, CONST_STR_LEN("127.0.0.1")) |
18 |
+ || buffer_is_equal_string(host->host, CONST_STR_LEN("::1"))) { |
19 |
+ shutdown(hctx->fd, SHUT_WR);/* future: remove if HTTP/1.1 request */ |
20 |
+ } |
21 |
+ #endif |
22 |
proxy_set_state(srv, hctx, PROXY_STATE_READ); |
23 |
} else { |
24 |
off_t wblen = hctx->wb->bytes_in - hctx->wb->bytes_out; |
25 |
@@ -992,7 +1005,8 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequ |
26 |
} |
27 |
} |
28 |
|
29 |
- return (0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) |
30 |
+ return ((0 == hctx->wb->bytes_in || !chunkqueue_is_empty(hctx->wb)) |
31 |
+ && hctx->state != PROXY_STATE_CONNECT) |
32 |
? proxy_send_request(srv, hctx) |
33 |
: HANDLER_WAIT_FOR_EVENT; |
34 |
} |