diff options
Diffstat (limited to 'sapi/cgi/fastcgi.c')
-rw-r--r-- | sapi/cgi/fastcgi.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index ac55672ef0..8315c0c472 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -662,6 +662,7 @@ static int fcgi_read_request(fcgi_request *req) unsigned char buf[FCGI_MAX_LENGTH+8]; req->keep = 0; + req->closed = 0; req->in_len = 0; req->out_hdr = NULL; req->out_pos = req->out_buf; @@ -886,7 +887,6 @@ int fcgi_accept_request(fcgi_request *req) HANDLE pipe; OVERLAPPED ov; #endif - fcgi_finish_request(req); while (1) { if (req->fd < 0) { @@ -1177,13 +1177,16 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l return len; } -int fcgi_finish_request(fcgi_request *req) +int fcgi_finish_request(fcgi_request *req, int force_close) { int ret = 1; if (req->fd >= 0) { - ret = fcgi_flush(req, 1); - fcgi_close(req, 0, 1); + if (!req->closed) { + ret = fcgi_flush(req, 1); + req->closed = 1; + } + fcgi_close(req, force_close, 1); } return ret; } |