[experimental-ims] 13a0986 Merge backend conditional requests with 3.0.1

Geoff Simmons geoff at varnish-cache.org
Wed Aug 31 16:05:04 CEST 2011


commit 13a0986e289dd1c6d196130ddba5c1234d4e3f1e
Author: Geoff Simmons <geoff at uplex.de>
Date:   Wed Aug 31 15:23:54 2011 +0200

    Merge backend conditional requests with 3.0.1

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 3007dde..d2accb1 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -663,20 +663,8 @@ cnt_fetchbody(struct sess *sp)
 	int i;
 	struct http *hp, *hp2;
 	char *b;
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-	uint16_t nhttp;
+	uint16_t nhttp, stale_nhttp;
 	unsigned l;
-=======
-	unsigned l, nhttp, stale_nhttp;
->>>>>>> Merged conditional backend request feature
-=======
-	unsigned l, nhttp, stale_nhttp;
->>>>>>> Merged conditional backend request feature
-=======
-	unsigned l, nhttp, stale_nhttp;
->>>>>>> Merged conditional backend request feature
 	struct vsb *vary = NULL;
 	int varyl = 0, pass;
 
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 414d063..e39b358 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -504,18 +504,6 @@ FetchBody(struct sess *sp)
         if (sp->wrk->beresp->status != 304)
         	AZ(VTAILQ_FIRST(&sp->obj->store));
 
-        /* If we've freshened from another object and got a "Not Modified"
-         * response, then we have already duped the other object's body.
-         */
-        if (sp->wrk->beresp->status != 304)
-        	AZ(VTAILQ_FIRST(&sp->obj->store));
-
-        /* If we've freshened from another object and got a "Not Modified"
-         * response, then we have already duped the other object's body.
-         */
-        if (sp->wrk->beresp->status != 304)
-        	AZ(VTAILQ_FIRST(&sp->obj->store));
-
 	AZ(sp->wrk->vgz_rx);
 	switch (sp->wrk->body_status) {
 	case BS_NONE:
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 0318463..104cc60 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -407,9 +407,10 @@ HSH_Lookup(struct sess *sp, struct objhead **poh)
                if (EXP_Keep(sp, o) >= sp->t_req
                    && (http_GetHdr(o->http, H_Last_Modified, &p)
                        || http_GetHdr(o->http, H_ETag, &p)))
-                   if (stale_o == NULL || stale_ttl < o->entered + o->exp.ttl) {
-                       stale_o = o;
-                       stale_ttl = o->entered + o->exp.ttl;
+                   if (stale_o == NULL ||
+		       stale_ttl < o->exp.entered + o->exp.ttl) {
+			   stale_o = o;
+			   stale_ttl = o->exp.entered + o->exp.ttl;
                    }
 
 	}
diff --git a/bin/varnishd/cache_vrt_var.c b/bin/varnishd/cache_vrt_var.c
index c27e28f..dc3b93e 100644
--- a/bin/varnishd/cache_vrt_var.c
+++ b/bin/varnishd/cache_vrt_var.c
@@ -116,7 +116,7 @@ VRT_l_##obj##_status(const struct sess *sp, int num)		\
 {								\
 								\
 	assert(num >= 100 && num <= 999);			\
-	cont->http->status = (unint16_t) num;			\
+	cont->http->status = (uint16_t) num;			\
 }
 
 #define VRT_DO_STATUS_r(obj, cont, http, nullable)		\
@@ -389,30 +389,35 @@ VRT_r_req_restarts(const struct sess *sp)
  * keep are relative to ttl.
  */
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-#define VRT_DO_EXP(which, exp, fld, offset, extra)		\
-								\
-void __match_proto__()						\
-VRT_l_##which##_##fld(struct sess *sp, double a)		\
-{								\
-								\
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
-	if (a > 0.)						\
-		a += offset;					\
-	EXP_Set_##fld(&exp, a);					\
-	extra;							\
-}								\
-								\
-double __match_proto__()					\
-VRT_r_##which##_##fld(struct sess *sp)				\
-{								\
-								\
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			\
-	return(EXP_Get_##fld(&exp) - offset);			\
+#define VRT_DO_EXP_l(which, cont, fld, offset, extra)		    \
+void __match_proto__()						    \
+VRT_l_##which##_##fld(struct sess *sp, double a)		    \
+{								    \
+								    \
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			    \
+	if (a > 0.)						    \
+		a += offset;					    \
+	EXP_Set_##fld(&cont->exp, a);				    \
+	extra;							    \
+}
+
+#define VRT_DO_EXP_r(which, cont, fld, offset, nullable)	    \
+double __match_proto__()					    \
+VRT_r_##which##_##fld(struct sess *sp)				    \
+{								    \
+								    \
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			    \
+	if (nullable && cont == NULL) {				    \
+	    ILLEGAL_R(sp, #which, #fld);			    \
+	    return (-1);					    \
+	}							    \
+	return(EXP_Get_##fld(&cont->exp) - offset);		    \
 }
 
+#define VRT_DO_EXP(which, cont, fld, offset, nullable, extra)	    \
+VRT_DO_EXP_l(which, cont, fld, offset, extra)  		            \
+VRT_DO_EXP_r(which, cont, fld, offset, nullable)
+
 static void
 vrt_wsp_exp(const struct sess *sp, unsigned xid, const struct exp *e)
 {
@@ -421,103 +426,30 @@ vrt_wsp_exp(const struct sess *sp, unsigned xid, const struct exp *e)
 	    sp->t_req, e->age + (sp->t_req - e->entered));
 }
 
-VRT_DO_EXP(req, sp->exp, ttl, 0, )
-VRT_DO_EXP(req, sp->exp, grace, 0, )
-VRT_DO_EXP(req, sp->exp, keep, 0, )
+VRT_DO_EXP(req, sp, ttl, 0, 0, )
+VRT_DO_EXP(req, sp, grace, 0, 0, )
+VRT_DO_EXP(req, sp, keep, 0, 0, )
 
-VRT_DO_EXP(obj, sp->obj->exp, grace, 0,
+VRT_DO_EXP(obj, sp->obj, grace, 0, 0,
    EXP_Rearm(sp->obj);
    vrt_wsp_exp(sp, sp->obj->xid, &sp->obj->exp);)
-VRT_DO_EXP(obj, sp->obj->exp, ttl, (sp->t_req - sp->obj->exp.entered),
+VRT_DO_EXP(obj, sp->obj, ttl, (sp->t_req - sp->obj->exp.entered), 0,
    EXP_Rearm(sp->obj);
    vrt_wsp_exp(sp, sp->obj->xid, &sp->obj->exp);)
-VRT_DO_EXP(obj, sp->obj->exp, keep, 0,
+VRT_DO_EXP(obj, sp->obj, keep, 0, 0,
    EXP_Rearm(sp->obj);
    vrt_wsp_exp(sp, sp->obj->xid, &sp->obj->exp);)
 
-VRT_DO_EXP(beresp, sp->wrk->exp, grace, 0,
+VRT_DO_EXP(beresp, sp->wrk, grace, 0, 0,
    vrt_wsp_exp(sp, sp->xid, &sp->wrk->exp);)
-VRT_DO_EXP(beresp, sp->wrk->exp, ttl, 0,
+VRT_DO_EXP(beresp, sp->wrk, ttl, 0, 0,
    vrt_wsp_exp(sp, sp->xid, &sp->wrk->exp);)
-VRT_DO_EXP(beresp, sp->wrk->exp, keep, 0,
+VRT_DO_EXP(beresp, sp->wrk, keep, 0, 0,
    vrt_wsp_exp(sp, sp->xid, &sp->wrk->exp);)
-=======
-=======
->>>>>>> Merged conditional backend request feature
-=======
->>>>>>> Merged conditional backend request feature
-#define VRT_DO_EXP_l(which, cont, fld, extra)			    \
-void __match_proto__()						    \
-VRT_l_##which##_##fld(struct sess *sp, double a)		    \
-{								    \
-								    \
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			    \
-	EXP_Set_##fld(&cont->exp, a);				    \
-	extra;							    \
-}
-
-#define VRT_DO_EXP_r(which, cont, fld, nullable)		    \
-double __match_proto__()					    \
-VRT_r_##which##_##fld(struct sess *sp)				    \
-{								    \
-								    \
-	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);			    \
-	if (nullable && cont == NULL) {				    \
-	    ILLEGAL_R(sp, #which, #fld);			    \
-	    return (-1);					    \
-	}							    \
-	return(EXP_Get_##fld(&cont->exp));			    \
-}
-
-#define VRT_DO_EXP(which, cont, fld, nullable, extra)		    \
-VRT_DO_EXP_l(which, cont, fld, extra)				    \
-VRT_DO_EXP_r(which, cont, fld, nullable)			    \
-
-VRT_DO_EXP(req, sp, ttl, 0, )
-VRT_DO_EXP(req, sp, grace, 0, )
-VRT_DO_EXP(req, sp, keep, 0, )
-VRT_DO_EXP(obj, sp->obj, grace, 0, EXP_Rearm(sp->obj))
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-=======
->>>>>>> Merged conditional backend request feature
-VRT_DO_EXP(obj, sp->obj, ttl, 0, EXP_Rearm(sp->obj))
-VRT_DO_EXP(obj, sp->obj, keep, 0, EXP_Rearm(sp->obj))
-VRT_DO_EXP(beresp, sp->wrk, grace, 0, )
-VRT_DO_EXP(beresp, sp->wrk, ttl, 0, )
-<<<<<<< HEAD
-=======
-VRT_DO_EXP(obj, sp->obj, ttl, 0,
-	   EXP_Rearm(sp->obj);
-	   WSP(sp, SLT_TTL, "%u VCL %.0f %.0f", sp->obj->xid, a, sp->t_req))
-VRT_DO_EXP(obj, sp->obj, keep, 0, EXP_Rearm(sp->obj))
-VRT_DO_EXP(beresp, sp->wrk, grace, 0, )
-VRT_DO_EXP(beresp, sp->wrk, ttl, 0,
-	   WSP(sp, SLT_TTL, "%u VCL %.0f %.0f", sp->xid, a, sp->t_req))
->>>>>>> Merged conditional backend request feature
-=======
->>>>>>> Merged conditional backend request feature
-=======
-RT_DO_EXP(obj, sp->obj, ttl, 0,
-	   EXP_Rearm(sp->obj);
-	   WSP(sp, SLT_TTL, "%u VCL %.0f %.0f", sp->obj->xid, a, sp->t_req))
-VRT_DO_EXP(obj, sp->obj, keep, 0, EXP_Rearm(sp->obj))
-VRT_DO_EXP(beresp, sp->wrk, grace, 0, )
-VRT_DO_EXP(beresp, sp->wrk, ttl, 0,
-	   WSP(sp, SLT_TTL, "%u VCL %.0f %.0f", sp->xid, a, sp->t_req))
->>>>>>> Merged conditional backend request feature
-VRT_DO_EXP(beresp, sp->wrk, keep, 0, )
-VRT_DO_EXP_r(stale_obj, sp->stale_obj, grace, 1)
-VRT_DO_EXP_r(stale_obj, sp->stale_obj, ttl, 1)
-VRT_DO_EXP_r(stale_obj, sp->stale_obj, keep, 1)
-<<<<<<< HEAD
-<<<<<<< HEAD
->>>>>>> Merged conditional backend request feature
-=======
->>>>>>> Merged conditional backend request feature
-=======
->>>>>>> Merged conditional backend request feature
+    
+VRT_DO_EXP_r(stale_obj, sp->stale_obj, grace, 0, 1)
+VRT_DO_EXP_r(stale_obj, sp->stale_obj, ttl, 0, 1)
+VRT_DO_EXP_r(stale_obj, sp->stale_obj, keep, 0, 1)
 
 /*--------------------------------------------------------------------
  * req.xid
diff --git a/bin/varnishtest/tests/i00000.vtc b/bin/varnishtest/tests/i00000.vtc
index 32451d6..4c4aeb5 100644
--- a/bin/varnishtest/tests/i00000.vtc
+++ b/bin/varnishtest/tests/i00000.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "VCL compiler coverage test: conditional refresh extension"
-=======
-test "VCL compiler coverage test: conditional refresh extension"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "VCL compiler coverage test: conditional refresh extension"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "VCL compiler coverage test: conditional refresh extension"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "VCL compiler coverage test: conditional refresh extension"
->>>>>>> Merge conditional backend requests with current trunk
 
 ## stale_obj is r/o in miss, fetch and error, illegal everywhere else
 
diff --git a/bin/varnishtest/tests/i00001.vtc b/bin/varnishtest/tests/i00001.vtc
index 61dc99a..306cc57 100644
--- a/bin/varnishtest/tests/i00001.vtc
+++ b/bin/varnishtest/tests/i00001.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Test basic conditional requests to backends"
-=======
-test "Test basic conditional requests to backends"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Test basic conditional requests to backends"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Test basic conditional requests to backends"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Test basic conditional requests to backends"
->>>>>>> Merge conditional backend requests with current trunk
 
 ## By default (default_keep = default_grace), cond. requests happen during grace
 
diff --git a/bin/varnishtest/tests/i00002.vtc b/bin/varnishtest/tests/i00002.vtc
index b03e6e2..adae568 100644
--- a/bin/varnishtest/tests/i00002.vtc
+++ b/bin/varnishtest/tests/i00002.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "handling stale_obj in vcl_miss() and vcl_fetch()"
-=======
-test "handling stale_obj in vcl_miss() and vcl_fetch()"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "handling stale_obj in vcl_miss() and vcl_fetch()"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "handling stale_obj in vcl_miss() and vcl_fetch()"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "handling stale_obj in vcl_miss() and vcl_fetch()"
->>>>>>> Merge conditional backend requests with current trunk
 
 server s1 {
         rxreq
diff --git a/bin/varnishtest/tests/i00003.vtc b/bin/varnishtest/tests/i00003.vtc
index 83d9d4d..293e843 100644
--- a/bin/varnishtest/tests/i00003.vtc
+++ b/bin/varnishtest/tests/i00003.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Test some anticipated use cases for conditional backend requests"
-=======
-test "Test some anticipated use cases for conditional backend requests"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Test some anticipated use cases for conditional backend requests"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Test some anticipated use cases for conditional backend requests"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Test some anticipated use cases for conditional backend requests"
->>>>>>> Merge conditional backend requests with current trunk
 
 ## In vcl_miss(), it is possible to veto a conditional request by removing any
 ## If-Modified-Since or If-None-Match header.
diff --git a/bin/varnishtest/tests/i00004.vtc b/bin/varnishtest/tests/i00004.vtc
index b70682b..bb70176 100644
--- a/bin/varnishtest/tests/i00004.vtc
+++ b/bin/varnishtest/tests/i00004.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Verify the semantics of keep (timeout for conditional requests)"
-=======
-test "Verify the semantics of keep (timeout for conditional requests)"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify the semantics of keep (timeout for conditional requests)"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Verify the semantics of keep (timeout for conditional requests)"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify the semantics of keep (timeout for conditional requests)"
->>>>>>> Merge conditional backend requests with current trunk
 
 server s1 {
         rxreq
diff --git a/bin/varnishtest/tests/i00005.vtc b/bin/varnishtest/tests/i00005.vtc
index 419a8b8..983afb2 100644
--- a/bin/varnishtest/tests/i00005.vtc
+++ b/bin/varnishtest/tests/i00005.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Verify interactions of ttl, keep, grace and bans"
-=======
-test "Verify interactions of ttl, keep, grace and bans"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify interactions of ttl, keep, grace and bans"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Verify interactions of ttl, keep, grace and bans"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify interactions of ttl, keep, grace and bans"
->>>>>>> Merge conditional backend requests with current trunk
 
 ## Banned objects are not used for conditional requests
 
diff --git a/bin/varnishtest/tests/i00006.vtc b/bin/varnishtest/tests/i00006.vtc
index 4d4c769..db15078 100644
--- a/bin/varnishtest/tests/i00006.vtc
+++ b/bin/varnishtest/tests/i00006.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Verify effects of ttl, keep and grace on expiration"
-=======
-test "Verify effects of ttl, keep and grace on expiration"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify effects of ttl, keep and grace on expiration"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Verify effects of ttl, keep and grace on expiration"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Verify effects of ttl, keep and grace on expiration"
->>>>>>> Merge conditional backend requests with current trunk
 
 ## Verify that an object's lifetime in the cache is
 ## obj.ttl + max(obj.grace, obj.keep)
diff --git a/bin/varnishtest/tests/i00007.vtc b/bin/varnishtest/tests/i00007.vtc
index 219b3cb..4a9b8c0 100644
--- a/bin/varnishtest/tests/i00007.vtc
+++ b/bin/varnishtest/tests/i00007.vtc
@@ -1,22 +1,6 @@
 # $Id$
 
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
-<<<<<<< HEAD
 varnishtest "Passes through responses to backend conditionals to the client if status != 304 or 200"
-=======
-test "Passes through responses to backend conditionals to the client if status != 304 or 200"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Passes through responses to backend conditionals to the client if status != 304 or 200"
->>>>>>> Merge conditional backend requests with current trunk
-=======
-test "Passes through responses to backend conditionals to the client if status != 304 or 200"
->>>>>>> Merged conditional backend request feature
-=======
-varnishtest "Passes through responses to backend conditionals to the client if status != 304 or 200"
->>>>>>> Merge conditional backend requests with current trunk
 
 # Testing a sample from each of the Nxx status codes
 



More information about the varnish-commit mailing list