r291 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jul 4 11:28:21 CEST 2006


Author: phk
Date: 2006-07-04 11:28:21 +0200 (Tue, 04 Jul 2006)
New Revision: 291

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Close non HTTP/1.1 request connections


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-07-04 09:21:33 UTC (rev 290)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-07-04 09:28:21 UTC (rev 291)
@@ -171,6 +171,7 @@
 int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
 int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr);
 int http_GetReq(struct http *hp, char **b);
+int http_GetProto(struct http *hp, char **b);
 int http_GetStatus(struct http *hp);
 int http_HdrIs(struct http *hp, const char *hdr, const char *val);
 int http_GetTail(struct http *hp, unsigned len, char **b, char **e);

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-04 09:21:33 UTC (rev 290)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-04 09:28:21 UTC (rev 291)
@@ -165,6 +165,15 @@
 }
 
 int
+http_GetProto(struct http *hp, char **b)
+{
+	if (hp->proto == NULL)
+		return (0);
+	*b = hp->proto;
+	return (1);
+}
+
+int
 http_GetTail(struct http *hp, unsigned len, char **b, char **e)
 {
 

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-04 09:21:33 UTC (rev 290)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-04 09:28:21 UTC (rev 291)
@@ -116,6 +116,9 @@
 		if (http_GetHdr(sp->http, "Connection", &b) &&
 		    !strcmp(b, "close")) {
 			vca_close_session(sp, "Connection header");
+		} else if (http_GetProto(sp->http, &b) &&
+		    strcmp(b, "HTTP/1.1")) {
+			vca_close_session(sp, "not HTTP/1.1");
 		}
 
 		AZ(pthread_mutex_lock(&sessmtx));




More information about the varnish-commit mailing list