r312 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Jul 5 11:10:30 CEST 2006


Author: phk
Date: 2006-07-05 11:10:30 +0200 (Wed, 05 Jul 2006)
New Revision: 312

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/rfc2616.c
Log:
Log reponse code and object length


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-07-05 09:08:37 UTC (rev 311)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-07-05 09:10:30 UTC (rev 312)
@@ -60,6 +60,8 @@
 	unsigned		heap_idx;
 	unsigned		ban_seq;
 
+	unsigned		response;
+
 	unsigned		valid;
 	unsigned		cacheable;
 

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-07-05 09:08:37 UTC (rev 311)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-07-05 09:10:30 UTC (rev 312)
@@ -63,7 +63,7 @@
 
 	while (cl != 0) {
 		i = read(fd, p, cl);
-		assert(i > 0);
+		assert(i > 0);	/* XXX seen */
 		p += i;
 		cl -= i;
 	}
@@ -245,6 +245,8 @@
 	sp->obj->xid = sp->xid;
 
 	fd = VBE_GetFd(sp->backend, &fd_token, sp->xid);
+	if (fd == -1)
+		fd = VBE_GetFd(sp->backend, &fd_token, sp->xid);
 	assert(fd != -1);	/* XXX: handle this */
 	VSL(SLT_Backend, sp->fd, "%d %s", fd, sp->backend->vcl_name);
 
@@ -287,6 +289,9 @@
 	sbuf_finish(w->sb);
 	sp->obj->header = strdup(sbuf_data(w->sb));
 
+	VSL(SLT_Response, sp->fd, "%u", sp->obj->response);
+	VSL(SLT_Length, sp->fd, "%u", sp->obj->len);
+
 	vca_write_obj(sp, sp->obj->header, 0);
 
 	if (http_GetHdr(hp, "Connection", &b) && !strcasecmp(b, "close"))

Modified: trunk/varnish-cache/bin/varnishd/rfc2616.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-05 09:08:37 UTC (rev 311)
+++ trunk/varnish-cache/bin/varnishd/rfc2616.c	2006-07-05 09:10:30 UTC (rev 312)
@@ -130,7 +130,8 @@
 	 * Initial cacheability determination per [RFC2616, 13.4]
 	 * We do not support ranges yet, so 206 is out.
 	 */
-	switch (http_GetStatus(hp)) {
+	sp->obj->response = http_GetStatus(hp);
+	switch (sp->obj->response) {
 	case 200: /* OK */
 		sp->obj->valid = 1;
 		/* FALLTHROUGH */




More information about the varnish-commit mailing list