From: claudio Date: Mon, 15 Aug 2022 10:29:03 +0000 (+0000) Subject: For FCGI_END_REQUEST reset the clt struct similar to what is done in the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b3aaf4900241d466fa79a3aa79e966e01b71f93a;p=openbsd For FCGI_END_REQUEST reset the clt struct similar to what is done in the file and other cases. Especially when the session uses keep-alive it is important to set TOREAD_HTTP_HEADER so that the state machine knows what's next. OK op@ --- diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index e29ad9936d3..2e5e647cb9c 100644 --- a/usr.sbin/httpd/server_fcgi.c +++ b/usr.sbin/httpd/server_fcgi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_fcgi.c,v 1.93 2022/08/12 08:40:25 claudio Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.94 2022/08/15 10:29:03 claudio Exp $ */ /* * Copyright (c) 2014 Florian Obser @@ -584,12 +584,24 @@ server_fcgi_read(struct bufferevent *bev, void *arg) ((struct http_descriptor *) clt->clt_descreq)->http_method == HTTP_METHOD_HEAD) - break; - if (server_fcgi_writechunk(clt) == -1) { + /* nothing */ ; + else if (server_fcgi_writechunk(clt) == -1) { server_abort_http(clt, 500, "encoding error"); return; } + if (clt->clt_fcgi.type == FCGI_END_REQUEST) { + bufferevent_enable(clt->clt_bev, + EV_READ|EV_WRITE); + if (clt->clt_persist) + clt->clt_toread = + TOREAD_HTTP_HEADER; + else + clt->clt_toread = + TOREAD_HTTP_NONE; + clt->clt_done = 0; + server_reset_http(clt); + } break; } evbuffer_drain(clt->clt_srvevb,