Wed, 05 Jun 2024 19:49:17 +0200
fix cgi_writeevent not returning immediately when cgi IO is already done
src/server/safs/cgi.c | file | annotate | diff | comparison | revisions |
--- a/src/server/safs/cgi.c Sun Jun 02 18:56:43 2024 +0200 +++ b/src/server/safs/cgi.c Wed Jun 05 19:49:17 2024 +0200 @@ -325,7 +325,7 @@ } event->finish = cgi_event_finish; - handler->writeev->finish = NULL; + handler->writeev->finish = NULL; // TODO: maybe this can be removed CgiIOResult ret = cgi_read_output(handler, ev, "readevent"); switch(ret) { case CGI_IO_COMPLETE: { @@ -360,11 +360,16 @@ CGIHandler *handler = event->cookie; if(handler->cgi_eof || handler->result == REQ_ABORTED) { + // same as in cgi_stdout_readevent + // request processing will be finished by the read event log_ereport(LOG_DEBUG, "cgi-send: req: %p writeevent cgi_eof = TRUE result: %d", handler->parser->rq, handler->result); + handler->poll_out = FALSE; + event->finish = NULL; + return 0; } event->finish = cgi_event_finish; - handler->readev->finish = NULL; + handler->readev->finish = NULL; // TODO: maybe this can be removed CgiIOResult ret = cgi_read_output(handler, ev, "writeevent"); switch(ret) { case CGI_IO_COMPLETE: { @@ -474,7 +479,7 @@ return CGI_IO_NEED_READ; } handler->cgi_eof = TRUE; - log_ereport(LOG_DEBUG, "cgi-send: rq: %p pid: %d set cgi_eof : %s", rq, handler->process.pid, debug_log); + log_ereport(LOG_DEBUG, "cgi-send: req: %p pid: %d set cgi_eof : %s", rq, handler->process.pid, debug_log); return ret; }