From 18fcdee1a96886723c2fbde93d89e07c26d8d208 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 5 Jul 2006 09:10:30 +0000 Subject: [PATCH] Log reponse code and object length git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@312 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 ++ varnish-cache/bin/varnishd/cache_fetch.c | 7 ++++++- varnish-cache/bin/varnishd/rfc2616.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 8c56c554..73ab9ad0 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -60,6 +60,8 @@ struct object { unsigned heap_idx; unsigned ban_seq; + unsigned response; + unsigned valid; unsigned cacheable; diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index e4442608..5a3b8fe0 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -63,7 +63,7 @@ fetch_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char while (cl != 0) { i = read(fd, p, cl); - assert(i > 0); + assert(i > 0); /* XXX seen */ p += i; cl -= i; } @@ -245,6 +245,8 @@ FetchSession(struct worker *w, struct sess *sp) 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 @@ FetchSession(struct worker *w, struct sess *sp) 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")) diff --git a/varnish-cache/bin/varnishd/rfc2616.c b/varnish-cache/bin/varnishd/rfc2616.c index 8e5c289e..8f95c63d 100644 --- a/varnish-cache/bin/varnishd/rfc2616.c +++ b/varnish-cache/bin/varnishd/rfc2616.c @@ -130,7 +130,8 @@ RFC2616_cache_policy(struct sess *sp, struct http *hp) * 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 */ -- 2.39.5