From: Fredrik Tolf <fredrik@dolda2000.com>
Date: Mon, 4 Oct 2010 22:39:30 +0000 (+0200)
Subject: htparser: Add a `Server' header if none previously present.
X-Git-Tag: 0.3~14
X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=1c3e01675acafadd2b44d54b541a57de5b5031f1;p=ashd.git

htparser: Add a `Server' header if none previously present.
---

diff --git a/src/htparser.c b/src/htparser.c
index 4325e97..33ceb49 100644
--- a/src/htparser.c
+++ b/src/htparser.c
@@ -272,6 +272,9 @@ void serve(FILE *in, struct conn *conn)
 	if((resp = parseresp(out)) == NULL)
 	    break;
 	replstr(&resp->ver, req->ver);
+	
+	if(!getheader(resp, "server"))
+	    headappheader(resp, "Server", sprintf3("ashd/%s", VERSION));
 
 	if(!strcmp(req->ver, "HTTP/1.0")) {
 	    writeresp(in, resp);