Trim any X-Ash- headers sent by the client.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 24 Aug 2010 15:38:39 +0000 (17:38 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 24 Aug 2010 15:38:39 +0000 (17:38 +0200)
src/htparser.c

index f489b2c..3fcca75 100644 (file)
 
 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: