changeset 524:99effe970c9d

scgisvc: send response body iff request method was not HEAD A HEAD request made over a scgi socket should *not* return a body. At least this is what nginx expects given that the moment it receives the empty line terminating the headers, it closes the connection to us. Attempting to send the body has been causing occasional -ESPIPE errors to be logged by blahgd. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 28 Jul 2018 21:00:57 -0400
parents 28f8d12f3f9f
children 90cb00f83e5b
files scgisvc.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scgisvc.c	Sat Jul 28 20:55:36 2018 -0400
+++ b/scgisvc.c	Sat Jul 28 21:00:57 2018 -0400
@@ -391,7 +391,9 @@
 
 	req->scgi_stats.write_header_time = gettime();
 
-	ret = scgi_write_body(req);
+	/* Write out the body for everything but HEAD requests */
+	if (req->request.method != SCGI_REQUEST_METHOD_HEAD)
+		ret = scgi_write_body(req);
 
 	req->scgi_stats.write_body_time = gettime();