hello tech@,
here is a diff that will cause httpd's fcgi code to not set the HTTP
date header if it has already been set. the code i am using for an fcgi
server
(https://github.com/golang/go/blob/master/src/net/http/fcgi/child.go#L102)
unconditionally sets the Date header, so with httpd there is a
duplicate "Date:" header in responses.
quick glances at lighttpd and apache2 seem to agree with this behavior.
Index: server_fcgi.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/server_fcgi.c,v
retrieving revision 1.74
diff -u -p -u -p -r1.74 server_fcgi.c
--- server_fcgi.c 21 Jan 2017 11:32:04 -0000 1.74
+++ server_fcgi.c 18 Jul 2017 21:31:01 -0000
@@ -661,8 +661,10 @@ server_fcgi_header(struct client *clt, u
}
/* Date header is mandatory and should be added as late as possible */
- if (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 ||
- kv_add(&resp->http_headers, "Date", tmbuf) == NULL)
+ key.kv_key = "Date";
+ if ((kv = kv_find(&resp->http_headers, &key)) == NULL &&
+ (server_http_time(time(NULL), tmbuf, sizeof(tmbuf)) <= 0 ||
+ kv_add(&resp->http_headers, "Date", tmbuf) == NULL))
return (-1);
/* Write initial header (fcgi might append more) */