]> err.no Git - varnish/commitdiff
This is getting too longhaired: Give backend connections another
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 1 Aug 2006 12:38:26 +0000 (12:38 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 1 Aug 2006 12:38:26 +0000 (12:38 +0000)
http header which we can use to build the object headers in.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@585 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_backend.c
varnish-cache/bin/varnishd/cache_fetch.c

index 9ee3e61b3cd83cb179e32fe4d6ee02a07f04da4f..da36a24bfa2c963a48a2032f4515a3487e0470b2 100644 (file)
@@ -133,6 +133,8 @@ struct vbe_conn {
        struct event            ev;
        int                     inuse;
        struct http             *http;
+       struct http             *http2;
+       struct http             http_mem[2];
 };
 
 /* Storage -----------------------------------------------------------*/
index d666cff0d6650765aa52724961ac3e120d03a1fd..a9d158d62e64d6e3d157a5004f97af9e9c374825 100644 (file)
@@ -43,7 +43,6 @@ struct vbc_mem {
        unsigned                magic;
 #define VBC_MEM_MAGIC          0x2fd7af01
        struct vbe_conn         vbc;
-       struct http             http;
 };
 
 /* A backend IP */
@@ -72,17 +71,24 @@ static struct vbe_conn *
 vbe_new_conn(void)
 {
        struct vbc_mem *vbcm;
+       struct vbe_conn *vbc;
+       unsigned char *p;
 
-       vbcm = calloc(sizeof *vbcm + heritage.mem_workspace, 1);
+       vbcm = calloc(sizeof *vbcm + heritage.mem_workspace * 2, 1);
        if (vbcm == NULL)
                return (NULL);
        vbcm->magic = VBC_MEM_MAGIC;
        VSL_stats->n_vbe_conn++;
-       vbcm->vbc.magic = VBE_CONN_MAGIC;
-       vbcm->vbc.vbcm = vbcm;
-       vbcm->vbc.http = &vbcm->http;
-       http_Setup(&vbcm->http, (void *)(vbcm + 1), heritage.mem_workspace);
-       return (&vbcm->vbc);
+       vbc = &vbcm->vbc;
+       vbc->magic = VBE_CONN_MAGIC;
+       vbc->vbcm = vbcm;
+       vbc->http = &vbc->http_mem[0];
+       vbc->http2 = &vbc->http_mem[1];
+       p = (void *)(vbcm + 1);
+       http_Setup(vbc->http, p, heritage.mem_workspace);
+       p += heritage.mem_workspace;
+       http_Setup(vbc->http2, p, heritage.mem_workspace);
+       return (vbc);
 }
 
 static void
index c8ce3e51d6549248a199be94dd0714627204a546..0c3567e705c097fa5f56317fde3b8c74f0c41b63 100644 (file)
@@ -224,17 +224,7 @@ FetchBody(struct sess *sp)
        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
-        */
+       hp = vc->http2;
        http_ClrHeader(hp);
        hp->logtag = HTTP_Obj;
        http_CopyResp(sp->fd, hp, vc->http);
@@ -252,6 +242,8 @@ FetchBody(struct sess *sp)
        } else
                cls = 0;
 
+       http_CopyHttp(&sp->obj->http, hp);
+
        if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close"))
                cls = 1;