[mod_proxy,mod_scgi] shutdown remote only if local (#2743)
shutdown(fd, SHUT_WR) after sending request to proxy or SCGI only if remote is local and platform is not *BSD or Darwin. The reason this fix is special-casing *BSD and Darwin is that the Single Unix Specification and POSIX.1-2013 clearly specify that POLLHUP event should be returned by poll only when the stream is no longer writable. A half-closed socket that is still writable clearly does not match that condition, yet that is what I am seeing on Darwin (El Capitan), and presumably what others are seeing on *BSD, from which Apple originally inherited the Darwin TCP stack. Single Unix Specification (SUSv2) from 1997 (yes, that is nearly 20 years ago): http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.html POLLHUP The device has been disconnected. This event and POLLOUT are mutually exclusive; a stream can never be writable if a hangup has occurred. However, this event and POLLIN, POLLRDNORM, POLLRDBAND or POLLPRI are not mutually exclusive. This flag is only valid in the revents bitmask; it is ignored in the events member. Updated version of The Open Group Base Specifications Issue 7 (published in 2013): http://pubs.opengroup.org/onlinepubs/9699919799/ POLLHUP A device has been disconnected, or a pipe or FIFO has been closed by the last process that had it open for writing. Once set, the hangup state of a FIFO shall persist until some process opens the FIFO for writing or until all read-only file descriptors for the FIFO are closed. This event and POLLOUT are mutually-exclusive; a stream can never be writable if a hangup has occurred. However, this event and POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not mutually-exclusive. This flag is only valid in the revents bitmask; it shall be ignored in the events member. x-ref: "1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin" https://redmine.lighttpd.net/issues/2743personal/stbuehler/mod-csrf-old
parent
156bea3859
commit
1de652f40b
Loading…
Reference in New Issue