r561 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Jul 22 18:15:17 CEST 2006


Author: phk
Date: 2006-07-22 18:15:17 +0200 (Sat, 22 Jul 2006)
New Revision: 561

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Always use GET and HTTP/1.1 against the backend for fetch


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-07-22 13:58:31 UTC (rev 560)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-07-22 16:15:17 UTC (rev 561)
@@ -303,6 +303,7 @@
 void HTTP_Init(void);
 void http_CopyHttp(struct http *to, struct http *fm);
 void http_Write(struct worker *w, struct http *hp, int resp);
+void http_GetReq(int fd, struct http *to, struct http *fm);
 void http_CopyReq(int fd, struct http *to, struct http *fm);
 void http_CopyResp(int fd, struct http *to, struct http *fm);
 void http_FilterHeader(int fd, struct http *to, struct http *fm, unsigned how);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-07-22 13:58:31 UTC (rev 560)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-07-22 16:15:17 UTC (rev 561)
@@ -51,7 +51,7 @@
 	i &= ~O_NONBLOCK;
 	i = fcntl(fd, F_SETFL, i);
 
-	while (cl != 0) {
+	while (cl > 0) {
 		i = http_Read(hp, fd, p, cl);
 		assert(i > 0);	/* XXX seen */
 		p += i;
@@ -273,7 +273,7 @@
 	assert(vc != NULL);	/* XXX: handle this */
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
-	http_CopyReq(vc->fd, vc->http, sp->http);
+	http_GetReq(vc->fd, vc->http, sp->http);
 	http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
 	http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
 

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-22 13:58:31 UTC (rev 560)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-22 16:15:17 UTC (rev 561)
@@ -517,6 +517,16 @@
 /*--------------------------------------------------------------------*/
 
 static void
+http_seth(int fd, struct http *to, unsigned n, enum shmlogtag tag, const char *fm)
+{
+	assert(n < MAX_HTTP_HDRS);
+	assert(fm != NULL);
+	to->hd[n].b = (void*)(uintptr_t)fm;
+	to->hd[n].e = strchr(fm, '\0');
+	VSLH(tag, fd, to, n);
+}
+
+static void
 http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum shmlogtag tag)
 {
 
@@ -528,6 +538,17 @@
 }
 
 void
+http_GetReq(int fd, struct http *to, struct http *fm)
+{
+
+	CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
+	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
+	http_seth(fd, to, HTTP_HDR_REQ, SLT_Request, "GET");
+	http_copyh(fd, to, fm, HTTP_HDR_URL, SLT_URL);
+	http_seth(fd, to, HTTP_HDR_PROTO, SLT_Protocol, "HTTP/1.1");
+}
+
+void
 http_CopyReq(int fd, struct http *to, struct http *fm)
 {
 




More information about the varnish-commit mailing list