Exemplo n.º 1
0
/*
 * Copies all occurrences of *hdr to a destination header *dst_h. Uses
 * vmod_header_append(), so all copies are kept intact.
 *
 * XXX: Not sure I like the idea of iterating a list of headers while
 * XXX: adding to it. It may be correct now, but perhaps not so much in
 * XXX: the future.
 */
static void
header_http_cphdr(VRT_CTX, const struct http *hp, const char *hdr,
    VCL_HEADER dst)
{
        unsigned u;
	const char *p;

        for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
		if (!header_http_match(ctx, hp, u, NULL, hdr))
			continue;

		p = hp->hd[u].b + hdr[0];
		while (*p == ' ' || *p == '\t')
			p++;
                vmod_append(ctx, dst, p, vrt_magic_string_end);
        }
}
Exemplo n.º 2
0
/*
 * Copies all occurrences of *hdr to a destination header *dst_h. Uses
 * vmod_header_append(), so all copies are kept intact.
 *
 * XXX: Not sure I like the idea of iterating a list of headers while
 * XXX: adding to it. It may be correct now, but perhaps not so much in
 * XXX: the future.
 */
static void
header_http_cphdr(struct sess *sp,
		  const struct http *hp,
		  const char *hdr,
		  enum gethdr_e dst_e,
		  const char *dst_h)
{
        unsigned u;
	char *p;

        for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
		if (!header_http_match(hp, u, NULL, hdr))
			continue;
		
		p = hp->hd[u].b + hdr[0];
		while (vct_issp(*p))
			p++;
                vmod_append(sp, dst_e, dst_h, p, vrt_magic_string_end);
        }
}