[core] enforce wait for POLLWR after EINPROGRESS (fixes #2744)

mod_fastcgi, mod_scgi, and mod_proxy must enforce wait for POLLWR
after EINPROGRESS or else getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)
may succeed even though socket connection is not yet established,
and subsequent writev() will fail ENOTCONN.

(thx pkubaj)

x-ref:
 "1.4.40/41 writev failed: Socket is not connected (fastcgi,scgi,proxy)"
  https://redmine.lighttpd.net/issues/2744
personal/stbuehler/mod-csrf-old
Glenn Strauss 7 years ago
parent 4bc06bfc0b
commit 666b9fd726

@ -3257,7 +3257,8 @@ SUBREQUEST_FUNC(mod_fastcgi_handle_subrequest) {
}
}
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;
}

@ -1005,7 +1005,8 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
}
}
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;
}

@ -2598,7 +2598,8 @@ SUBREQUEST_FUNC(mod_scgi_handle_subrequest) {
}
}
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;
}

Loading…
Cancel
Save