[experimental-ims] 5c8bb04 Don't panic if we can both do conditional (IMS) and stream, prefer IMS, it is less work and less data to transmit.

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


commit 5c8bb0448dcf2d3b4e091ff4e7a285f578bb3f38
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 10 13:15:07 2011 +0000

    Don't panic if we can both do conditional (IMS) and stream,
    prefer IMS, it is less work and less data to transmit.
    
    Fixes	#972
    
    Thanks to:	Martin

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index beb3d55..f5d2957 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -800,6 +800,16 @@ cnt_fetchbody(struct sess *sp)
 
 	assert(WRW_IsReleased(sp->wrk));
 
+	/*
+	 * If we can deliver a 304 reply, we don't bother streaming.
+	 * Notice that vcl_deliver{} could still nuke the headers
+	 * that allow the 304, in which case we return 200 non-stream.
+	 */
+	if (sp->obj->response == 200 &&
+	    sp->http->conds &&
+	    RFC2616_Do_Cond(sp))
+		sp->wrk->do_stream = 0;
+
 	if (sp->wrk->do_stream) {
 		sp->step = STP_PREPRESP;
 		return (0);



More information about the varnish-commit mailing list