From: Fredrik Tolf Date: Tue, 24 Aug 2010 15:38:39 +0000 (+0200) Subject: Trim any X-Ash- headers sent by the client. X-Git-Tag: 0.1~89 X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=commitdiff_plain;h=df431d1dea41436768530055dbd0e95a4acba45f Trim any X-Ash- headers sent by the client. --- diff --git a/src/htparser.c b/src/htparser.c index f489b2c..3fcca75 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -38,6 +38,23 @@ static int plex; +static void trimx(struct hthead *req) +{ + int i; + + i = 0; + while(i < req->noheaders) { + if(!strncasecmp(req->headers[i][0], "x-ash-", 6)) { + free(req->headers[i][0]); + free(req->headers[i][1]); + free(req->headers[i]); + memmove(req->headers + i, req->headers + i + 1, sizeof(*req->headers) * (--req->noheaders - i)); + } else { + i++; + } + } +} + static struct hthead *parsereq(FILE *in) { struct hthead *req; @@ -85,6 +102,7 @@ static struct hthead *parsereq(FILE *in) req = mkreq(method.b, url.b, ver.b); if(parseheaders(req, in)) goto fail; + trimx(req); goto out; fail: