Commit 9bd5dd68 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

The delivered document's age should be computed relative to the time of

the response, not the time of the request.  If the document was not in
cache and the backend took a long time to respond, the document would
end up with a negative computed age, which when printed with %u would
appear as a large positive number (a few seconds short of either 2^32
or 2^64 depending on the size of time_t).

git-svn-id: http://www.varnish-cache.org/svn/trunk@1142 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 766d63cc
...@@ -234,7 +234,7 @@ RES_WriteObj(struct sess *sp) ...@@ -234,7 +234,7 @@ RES_WriteObj(struct sess *sp)
else else
http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid); http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid);
http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %u", http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %u",
sp->obj->age + sp->t_req.tv_sec - sp->obj->entered); sp->obj->age + sp->t_resp.tv_sec - sp->obj->entered);
http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish"); http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish");
if (sp->doclose != NULL) if (sp->doclose != NULL)
http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close"); http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment