As found out by Chris Narkiewicz the hard way, trying to chunk encode an
empty body makes the nextclown app stop working. (see "Nextcloud stopped
working after upgrade to 6.9" on ports@).

I don't think there is a valid way to do this, so don't try to.

This is kinda maybe a hack since there might be other stuff that isn't
sending a body. So if anyone has a long list of status codes that should
be in the same list, let me know.

We can't easily find out if the fcgi server is going to send us an
empty body without reading everything from the server until we hit the
body. I'm happy to entertain a diff that does that.

In the meantime, this scratches my itch.
OK?

diff --git server_fcgi.c server_fcgi.c
index 8d3b581568f..0ac80c27d11 100644
--- server_fcgi.c
+++ server_fcgi.c
@@ -615,6 +615,10 @@ server_fcgi_header(struct client *clt, unsigned int code)
        if (kv_add(&resp->http_headers, "Server", HTTPD_SERVERNAME) == NULL)
                return (-1);
 
+       /* we cannot chunk-encode no-content */
+       if (code == 204)
+               clt->clt_fcgi.chunked = 0;
+
        /* Set chunked encoding */
        if (clt->clt_fcgi.chunked) {
                /* XXX Should we keep and handle Content-Length instead? */


-- 
I'm not entirely sure you are real.

Reply via email to