r584 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Aug 1 14:04:56 CEST 2006


Author: phk
Date: 2006-08-01 14:04:56 +0200 (Tue, 01 Aug 2006)
New Revision: 584

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Experiment:  don't use req's workspace to build object http header.



Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-08-01 09:39:52 UTC (rev 583)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-08-01 12:04:56 UTC (rev 584)
@@ -17,6 +17,7 @@
 #include "shmlog.h"
 #include "libvarnish.h"
 #include "cache.h"
+#include "heritage.h"
 
 /*
  * Chunked encoding is a hack.  We prefer to have a single chunk or a 
@@ -211,6 +212,7 @@
 	struct vbe_conn *vc;
 	char *b;
 	int body = 1;		/* XXX */
+	struct http *hp;
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
@@ -222,16 +224,21 @@
 	if (http_GetHdr(vc->http, H_Last_Modified, &b))
 		sp->obj->last_modified = TIM_parse(b);
 
+	hp = &sp->obj->http;
+	hp->s = malloc(heritage.mem_workspace);
+	assert(hp->s != NULL);
+	hp->e = hp->s + heritage.mem_workspace;
+	hp->v = hp->s;
 	/*
 	 * We borrow the sessions workspace and http header for building the
 	 * headers to store in the object, then copy them over there.
 	 * The actual headers to reply with are built later on over in
 	 * cache_response.c
 	 */
-	http_ClrHeader(sp->http);
-	sp->http->logtag = HTTP_Obj;
-	http_CopyResp(sp->fd, sp->http, vc->http);
-	http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_INS);
+	http_ClrHeader(hp);
+	hp->logtag = HTTP_Obj;
+	http_CopyResp(sp->fd, hp, vc->http);
+	http_FilterHeader(sp->fd, hp, vc->http, HTTPH_A_INS);
 	
 	if (body) {
 		if (http_GetHdr(vc->http, H_Content_Length, &b))
@@ -240,11 +247,10 @@
 			cls = fetch_chunked(sp, vc->fd, vc->http);
 		else 
 			cls = fetch_eof(sp, vc->fd, vc->http);
-		http_PrintfHeader(sp->fd, sp->http,
+		http_PrintfHeader(sp->fd, hp,
 		    "Content-Length: %u", sp->obj->len);
 	} else
 		cls = 0;
-	http_CopyHttp(&sp->obj->http, sp->http);
 
 	if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close"))
 		cls = 1;




More information about the varnish-commit mailing list