/* * Return true if the hp->hd[u] header matches *hdr and the regex *re * matches the content. * * If re is NULL, content is not tested and as long as it's the right * header, a match is returned. */ static int header_http_match(VRT_CTX, const struct http *hp, unsigned u, void *re, const char *hdr) { const char *start; unsigned l; assert(hdr); assert(hp); Tcheck(hp->hd[u]); if (hp->hd[u].b == NULL) return (0); l = hdr[0]; if (!header_http_IsHdr(&hp->hd[u], hdr)) return (0); if (re == NULL) return (1); start = hp->hd[u].b + l; while (*start != '\0' && *start == ' ') start++; if (!*start) return (0); if (VRT_re_match(ctx, start, re)) return (1); return (0); }
static bool is_param_regfiltered(const char *param, int length, struct filter_context *context) { if (length == 0) { return true; } char p[length + 1]; memcpy(p, param, length); p[length + 1] = '\0'; #ifdef QS_NEED_RE_CTX return (bool) VRT_re_match(context->params.regfilter.re_ctx, p, context->params.regfilter.re); #else return (bool) VRT_re_match(p, context->params.regfilter.re); #endif }