src/server/safs/cgi.c

changeset 536
e95fa761db0c
parent 535
bf07abfe7f0a
child 538
f9a7b5c76208
--- 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;
 }
 

mercurial