[experimental-ims] 0d276b4 Reduce the http.protover field from double to uint8_t for space reasons.

Geoff Simmons geoff at varnish-cache.org
Fri Jul 8 11:47:42 CEST 2011


commit 0d276b43db1baf703519d907a80a4b98ab73e874
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 20 08:33:35 2011 +0000

    Reduce the http.protover field from double to uint8_t for space reasons.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index f3558ff..0fe1271 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -171,7 +171,7 @@ struct http {
 	unsigned char		conds;		/* If-* headers present */
 	enum httpwhence		logtag;
 	int			status;
-	double			protover;
+	uint8_t			protover;
 
 	unsigned		shd;		/* Size of hd space */
 	txt			*hd;
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 4375344..4a17c56 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -200,7 +200,7 @@ cnt_prepresp(struct sess *sp)
 			sp->wrk->res_mode |= RES_LEN;
 		else if (!sp->wantbody) {
 			/* Nothing */
-		} else if (sp->http->protover >= 1.1) {
+		} else if (sp->http->protover >= 11) {
 			sp->wrk->res_mode |= RES_CHUNKED;
 		} else {
 			sp->wrk->res_mode |= RES_EOF;
diff --git a/bin/varnishd/cache_http.c b/bin/varnishd/cache_http.c
index 8df780a..5d8050a 100644
--- a/bin/varnishd/cache_http.c
+++ b/bin/varnishd/cache_http.c
@@ -420,7 +420,7 @@ http_DoConnection(const struct http *hp)
 	unsigned u;
 
 	if (!http_GetHdr(hp, H_Connection, &p)) {
-		if (hp->protover < 1.1)
+		if (hp->protover < 11)
 			return ("not HTTP/1.1");
 		return (NULL);
 	}
@@ -640,11 +640,11 @@ http_ProtoVer(struct http *hp)
 {
 
 	if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0"))
-		hp->protover = 1.0;
+		hp->protover = 10;
 	else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1"))
-		hp->protover = 1.1;
+		hp->protover = 11;
 	else
-		hp->protover = 0.9;
+		hp->protover = 9;
 }
 
 
diff --git a/bin/varnishd/rfc2616.c b/bin/varnishd/rfc2616.c
index 83ebd71..7b2525f 100644
--- a/bin/varnishd/rfc2616.c
+++ b/bin/varnishd/rfc2616.c
@@ -186,7 +186,7 @@ RFC2616_Body(const struct sess *sp)
 
 	hp = sp->wrk->beresp;
 
-	if (hp->protover < 1.1 && !http_HdrIs(hp, H_Connection, "keep-alive"))
+	if (hp->protover < 11 && !http_HdrIs(hp, H_Connection, "keep-alive"))
 		sp->wrk->do_close = 1;
 	else if (http_HdrIs(hp, H_Connection, "close"))
 		sp->wrk->do_close = 1;
@@ -262,7 +262,7 @@ RFC2616_Body(const struct sess *sp)
 		return (BS_EOF);
 	}
 
-	if (hp->protover < 1.1) {
+	if (hp->protover < 11) {
 		/*
 		 * With no Connection header, assume EOF.
 		 */



More information about the varnish-commit mailing list