X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=blobdiff_plain;f=src%2Fhtparser.c;h=483554924a63a8ccdf2453bf9987a4f6a301a0e6;hp=f489b2cfddeee7ae7595aacba94d2c5887d80899;hb=6ca53b2e5e3b76345fd709a3e9d32aee69889054;hpb=61a14ba835c8f072bde823fdbd63d503687685e0 diff --git a/src/htparser.c b/src/htparser.c index f489b2c..4835549 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: @@ -335,7 +353,7 @@ static void usage(FILE *out) { fprintf(out, "usage: htparser [-hSf] [-u USER] [-r ROOT] PORTSPEC... -- ROOT [ARGS...]\n"); fprintf(out, "\twhere PORTSPEC is HANDLER[:PAR[=VAL][(,PAR[=VAL])...]] (try HANDLER:help)\n"); - fprintf(out, "\tavailable handlers are `plain'.\n"); + fprintf(out, "\tavailable handlers are `plain' and `ssl'.\n"); } static void addport(char *spec) @@ -370,6 +388,10 @@ static void addport(char *spec) /* XXX: It would be nice to decentralize this, but, meh... */ if(!strcmp(nm, "plain")) { handleplain(pars.d, pars.b, vals.b); +#ifdef HAVE_GNUTLS + } else if(!strcmp(nm, "ssl")) { + handlegnussl(pars.d, pars.b, vals.b); +#endif } else { flog(LOG_ERR, "htparser: unknown port handler `%s'", nm); exit(1);