Hi,

I applied this patch to the base OpenBSD 6.9 httpd source tree, recompiled & installed.

Wordpress works in both Firefox and Chrome, Roundcubemail works in both Firefox and Chrome.

However, my Andriod Nextcloud client is now broken again.  I get a "Connection Error".

Is there a way I can help you troubleshoot this?

There is nothing significant when I run a httpd -d -v -v -v -v -v

Thanks,
Steve Williams


On 19/05/2021 12:44 p.m., Florian Obser wrote:
The whole point of using Transfer-Encoding: chunked for fastcgi was so
that we do not need to provide a Content-Length header if upstream
doesn't give us one. (We'd need to slurp in all the data ugh).

Now turns out that if we disable chunked encoding for zero sized bodies
some browsers are picky and want a Content-Length: 0 (Firefox, Safari)
or they'll just sit there and wait for the connection to close.

Problem reported by Matthias Pressfreund with wordpress.
Debugged with the help of weerd@ who pointed out that the problem is
actually browser dependent. From there it was pretty clear what the
problem was.

OK?

diff --git server_fcgi.c server_fcgi.c
index 31d7322e9f7..b9dc4f6fe04 100644
--- server_fcgi.c
+++ server_fcgi.c
@@ -636,6 +636,13 @@ server_fcgi_header(struct client *clt, unsigned int code)
                if (kv_add(&resp->http_headers,
                    "Transfer-Encoding", "chunked") == NULL)
                        return (-1);
+       } else {
+               key.kv_key = "Content-Length";
+               if ((kv = kv_find(&resp->http_headers, &key)) == NULL) {
+                       if (kv_add(&resp->http_headers,
+                           "Content-Length", "0") == NULL)
+                               return (-1);
+               }
        }
/* Is it a persistent connection? */


Reply via email to