[master] 8559412 Move the body_status enum to cache.h

Poul-Henning Kamp phk at varnish-cache.org
Mon Mar 7 11:47:18 CET 2011


commit 85594125d8e6e13a38e39377bf77b0cc1133020f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 7 10:47:05 2011 +0000

    Move the body_status enum to cache.h

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 66fa848..e195151 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -65,7 +65,15 @@
 
 #include "vsc.h"
 #include "vsl.h"
-#include "vtypes.h"
+
+enum body_status {
+	BS_NONE,
+	BS_ZERO,
+	BS_ERROR,
+	BS_CHUNKED,
+	BS_LENGTH,
+	BS_EOF
+};
 
 /*
  * NB: HDR_STATUS is only used in cache_http.c, everybody else uses the
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index cc17733..594aa4e 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -499,11 +499,6 @@ FetchBody(struct sess *sp)
 	AN(sp->director);
 	AssertObjPassOrBusy(sp->obj);
 
-	/*
-	 * Determine if we have a body or not
-	 * XXX: Missing:  RFC2616 sec. 4.4 in re 1xx, 204 & 304 responses
-	 */
-
 	AZ(sp->wrk->vgz_rx);
 	AZ(VTAILQ_FIRST(&sp->obj->store));
 	switch (sp->wrk->body_status) {
@@ -542,9 +537,9 @@ FetchBody(struct sess *sp)
 	/*
 	 * It is OK for ->end to just leave the last storage segment
 	 * sitting on sp->wrk->storage, we will always call vfp_nop_end()
-	 * to get it trimmed and added to the object.
+	 * to get it trimmed or thrown out if empty.
 	 */
-	XXXAZ(vfp_nop_end(sp));
+	AZ(vfp_nop_end(sp));
 
 	WSL(sp->wrk, SLT_Fetch_Body, sp->vbc->fd, "%u %d %u",
 	    sp->wrk->body_status, cls, mklen);
@@ -554,9 +549,6 @@ FetchBody(struct sess *sp)
 		return (__LINE__);
 	}
 
-	if (cls == 0 && sp->wrk->do_close)
-		cls = 1;
-
 	if (cls < 0) {
 		sp->wrk->stats.fetch_failed++;
 		/* XXX: Wouldn't this store automatically be released ? */
@@ -570,6 +562,9 @@ FetchBody(struct sess *sp)
 		return (__LINE__);
 	}
 
+	if (cls == 0 && sp->wrk->do_close)
+		cls = 1;
+
 	WSL(sp->wrk, SLT_Length, sp->vbc->fd, "%u", sp->obj->len);
 
 	{
diff --git a/include/Makefile.am b/include/Makefile.am
index 94eabc4..a46ae72 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -50,8 +50,7 @@ nobase_noinst_HEADERS = \
 	vrt.h \
 	vrt_obj.h \
 	vrt_stv_var.h \
-	vss.h \
-	vtypes.h
+	vss.h
 
 vrt_stv_var.h vcl_returns.h vcl.h vrt_obj.h: $(top_srcdir)/lib/libvcl/generate.py $(top_srcdir)/include/vrt.h
 	@PYTHON@ $(top_srcdir)/lib/libvcl/generate.py $(top_srcdir) $(top_builddir)
diff --git a/include/vtypes.h b/include/vtypes.h
deleted file mode 100644
index a8e1599..0000000
--- a/include/vtypes.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * Copyright (c) 2010 Linpro AS
- * All rights reserved.
- *
- * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id$
- *
- * Very special types, widely used, in their own #include to keep
- * #include-infection minimal.
- */
-
-enum body_status {
-	BS_NONE,
-	BS_ZERO,
-	BS_ERROR,
-	BS_CHUNKED,
-	BS_LENGTH,
-	BS_EOF
-};



More information about the varnish-commit mailing list