r2115 - trunk/varnish-cache/bin/varnishd

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Oct 18 15:48:47 CEST 2007

In message <20071018133845.707CA1EC403 at projects.linpro.no>, cecilihf at projects.l
inpro.no writes:
>Author: cecilihf
>Date: 2007-10-18 15:38:45 +0200 (Thu, 18 Oct 2007)
>New Revision: 2115
>   trunk/varnish-cache/bin/varnishd/cache_fetch.c
>Make pass mode work for POST requests. Solves ticket #47.

Uhm, that is not enough, the pipelined contents may not contain
the full post request body.

>+	if (!strcmp(http_GetReq(sp->http), "POST")) {
>+		sprintf(hdr, "%ccontent-length:", 15);
>+		assert(http_GetHdr(sp->http, hdr, &ptr));

I might have tipped my hat for you, you you had written:

		hdr[0] = sprintf(hdr + 1, "content-length:");
		assert(http_GetHdr(sp->http, hdr, &ptr));

Or even:

		assert(http_GetHdr(sp->http, "\017content-length:", &ptr));

But we already have magically predefined constants for all the
usual headers, so the correct way is:

		assert(http_GetHdr(sp->http, H_Content_Length, &ptr));

... apart from the "assert" which is probably needlessly draconian.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-commit mailing list