don't close the connection twice on HUP|IN

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@365 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.3.14
Jan Kneschke 18 years ago
parent b527f569af
commit efa87f47c1

@ -474,30 +474,25 @@ static handler_t cgi_connection_close(server *srv, handler_ctx *hctx) {
#ifndef __WIN32
#if 0
log_error_write(srv, __FILE__, __LINE__, "sdd",
"emergency exit: cgi",
con->fd,
hctx->fd);
#endif
/* the connection to the browser went away, but we still have a connection
* to the CGI script
*
* close cgi-connection
*/
/* close connection to the cgi-script */
fdevent_event_del(srv->ev, &(hctx->fde_ndx), hctx->fd);
fdevent_unregister(srv->ev, hctx->fd);
if (close(hctx->fd)) {
log_error_write(srv, __FILE__, __LINE__, "sds", "cgi close failed ", hctx->fd, strerror(errno));
if (hctx->fd != -1) {
/* close connection to the cgi-script */
fdevent_event_del(srv->ev, &(hctx->fde_ndx), hctx->fd);
fdevent_unregister(srv->ev, hctx->fd);
if (close(hctx->fd)) {
log_error_write(srv, __FILE__, __LINE__, "sds", "cgi close failed ", hctx->fd, strerror(errno));
}
hctx->fd = -1;
hctx->fde_ndx = -1;
}
hctx->fd = -1;
hctx->fde_ndx = -1;
pid = hctx->pid;
con->plugin_ctx[p->id] = NULL;
@ -597,7 +592,8 @@ static handler_t cgi_handle_fdevent(void *s, void *ctx, int revents) {
#endif
cgi_connection_close(srv, hctx);
break;
/* if we get a IN|HUP and have read everything don't exec the close twice */
return HANDLER_FINISHED;
case FDEVENT_HANDLED_ERROR:
connection_set_state(srv, con, CON_STATE_HANDLE_REQUEST);
con->http_status = 500;

Loading…
Cancel
Save