From c8da3fb929faae4dd365c55a2233dc11126af505 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 30 Sep 2007 20:08:26 +0000 Subject: [PATCH] Cache the numeric status code. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2062 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 1 + varnish-cache/bin/varnishd/cache_http.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index fcaa870d..90f342f7 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -116,6 +116,7 @@ struct http { unsigned char conds; /* If-* headers present */ enum httpwhence logtag; + int status; txt hd[HTTP_HDR_MAX]; unsigned char hdf[HTTP_HDR_MAX]; diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 4eb331d4..1b58ae91 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -327,8 +327,10 @@ http_GetStatus(const struct http *hp) { Tcheck(hp->hd[HTTP_HDR_STATUS]); - return (strtoul(hp->hd[HTTP_HDR_STATUS].b, - NULL /* XXX */, 10)); + if (hp->status == 0) + hp->status = strtoul(hp->hd[HTTP_HDR_STATUS].b, + NULL /* XXX */, 10)); + return (hp->status); } const char * -- 2.39.5