On Thu, Aug 11, 2022 at 02:00:39PM +0300, Alexey Vatchenko wrote:
> > On 10 Aug 2022, at 16:26, Alexey Vatchenko <[email protected]> wrote:
> >> On 10 Aug 2022, at 10:06, Omar Polo <[email protected]> wrote:
> >>
> >> I experienced a similar issue with both slowcgi and gotwebd (a fastcgi
> >> application.) Can you please try the diff I posted a couple of days
> >> ago on tech@?
> >
> > Built and put it on server. Let’s see in production environment.
> > Thanks!
>
> I’m getting complains that the problem returned.
>
> But I haven’t applied patch for slowcgi. Is it mandatory? I believe it
> shouldn’t.
>
> As I mentioned earlier, sometime the client is fast enough to make new
> request before slowcgi daemon closes connection triggering
> server_file_error() with EOF (or server_fcgi_error() in your case). So, our
> goal to get to server_read_http() with reset client structure.
I think you need this diff on top of all what is in -current.
The problem is that when a request is finished we need to adjust the state
of the connection to fall back to the right mode. I think this is the
right place and right magic but am not very happy with the solution
itself. httpd misses some basic abstractions.
--
:wq Claudio
Index: server_fcgi.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v
retrieving revision 1.93
diff -u -p -r1.93 server_fcgi.c
--- server_fcgi.c 12 Aug 2022 08:40:25 -0000 1.93
+++ server_fcgi.c 12 Aug 2022 10:01:30 -0000
@@ -584,11 +584,23 @@ server_fcgi_read(struct bufferevent *bev
((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;
}