From a10435b1c2472787346a1b4c46da5f33f700121c Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 11 Oct 2008 10:42:05 +0000 Subject: [PATCH] Decode the HTTP protocol version into a convenient struct http field. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3290 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 1 + varnish-cache/bin/varnishd/cache_http.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index f80d59d0..39738f3f 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -137,6 +137,7 @@ struct http { unsigned char conds; /* If-* headers present */ enum httpwhence logtag; int status; + double protover; 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 65edc254..e418bbe5 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -496,6 +496,13 @@ http_DissectRequest(struct sess *sp) i = http_splitline(sp->wrk, sp->fd, hp, htc, HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO); + hp->protover = 0.9; + if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0")) + hp->protover = 1.0; + else if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) + hp->protover = 1.1; + else + hp->protover = 0.9; if (i != 0) WSPR(sp, SLT_HttpGarbage, htc->rxbuf); -- 2.39.5