Florian Obser([email protected]) on 2021.05.14 19:13:49 +0200: > 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.
https://datatracker.ietf.org/doc/html/rfc7230#page-32 gives the list as ... any response with a 1xx (Informational), 204 (No Content), or 304 (Not Modified) status code is always terminated by the first empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message body. see the text for other responses that must have an empty body (for other reasons than the status code). /Benno > > 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? ok benno@ > > 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. >
