]> err.no Git - varnish/commitdiff
Log reponse code and object length
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 5 Jul 2006 09:10:30 +0000 (09:10 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 5 Jul 2006 09:10:30 +0000 (09:10 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@312 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/rfc2616.c

index 8c56c55478d0584b15385c01900b9bcefe4b4e40..73ab9ad0832bab7360a58ce74bd06a84d6d1c06b 100644 (file)
@@ -60,6 +60,8 @@ struct object {
        unsigned                heap_idx;
        unsigned                ban_seq;
 
+       unsigned                response;
+
        unsigned                valid;
        unsigned                cacheable;
 
index e4442608a754748855afda279252319a9b545efa..5a3b8fe0f0f40921777a20079d1421665ea00c38 100644 (file)
@@ -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"))
index 8e5c289e69caf1db121912f3ab69bb5d5d20a9b2..8f95c63d80eeb5b2be06bb01261676fb05024dc2 100644 (file)
@@ -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 */