|
|
|
@ -916,10 +916,17 @@ static handler_t connection_handle_fdevent(server *srv, void *context, int reven
|
|
|
|
|
} else if (revents & FDEVENT_HUP) {
|
|
|
|
|
connection_set_state(srv, con, CON_STATE_ERROR);
|
|
|
|
|
} else if (revents & FDEVENT_RDHUP) {
|
|
|
|
|
int events = fdevent_event_get_interest(srv->ev, con->fd);
|
|
|
|
|
events &= ~(FDEVENT_IN|FDEVENT_RDHUP);
|
|
|
|
|
con->conf.stream_request_body &= ~(FDEVENT_STREAM_REQUEST_BUFMIN|FDEVENT_STREAM_REQUEST_POLLIN);
|
|
|
|
|
con->is_readable = 1; /*(can read 0 for end-of-stream)*/
|
|
|
|
|
con->keep_alive = 0;
|
|
|
|
|
if (con->request.content_length < -1) { /*(transparent proxy mode; no more data to read)*/
|
|
|
|
|
con->request.content_length = con->request_content_queue->bytes_in;
|
|
|
|
|
}
|
|
|
|
|
if (sock_addr_get_family(&con->dst_addr) == AF_UNIX) {
|
|
|
|
|
/* future: will getpeername() on AF_UNIX properly check if still connected? */
|
|
|
|
|
fdevent_event_clr(srv->ev, &con->fde_ndx, con->fd, FDEVENT_RDHUP);
|
|
|
|
|
con->keep_alive = 0;
|
|
|
|
|
fdevent_event_set(srv->ev, &con->fde_ndx, con->fd, events);
|
|
|
|
|
} else if (fdevent_is_tcp_half_closed(con->fd)) {
|
|
|
|
|
/* Success of fdevent_is_tcp_half_closed() after FDEVENT_RDHUP indicates TCP FIN received,
|
|
|
|
|
* but does not distinguish between client shutdown(fd, SHUT_WR) and client close(fd).
|
|
|
|
@ -928,8 +935,7 @@ static handler_t connection_handle_fdevent(server *srv, void *context, int reven
|
|
|
|
|
* future: might getpeername() to check for TCP RST on half-closed sockets
|
|
|
|
|
* (without FDEVENT_RDHUP interest) when checking for write timeouts
|
|
|
|
|
* once a second in server.c, though getpeername() on Windows might not indicate this */
|
|
|
|
|
fdevent_event_clr(srv->ev, &con->fde_ndx, con->fd, FDEVENT_RDHUP);
|
|
|
|
|
con->keep_alive = 0;
|
|
|
|
|
fdevent_event_set(srv->ev, &con->fde_ndx, con->fd, events);
|
|
|
|
|
} else {
|
|
|
|
|
/* Failure of fdevent_is_tcp_half_closed() indicates TCP RST
|
|
|
|
|
* (or unable to tell (unsupported OS), though should not
|
|
|
|
|