]> err.no Git - varnish/commitdiff
Decode the HTTP protocol version into a convenient struct http field.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 11 Oct 2008 10:42:05 +0000 (10:42 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 11 Oct 2008 10:42:05 +0000 (10:42 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3290 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_http.c

index f80d59d0f7f1ff1eb73461640a6c54914324ba1c..39738f3fd72d30bcf33f8f4848f1af54c2d2c315 100644 (file)
@@ -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];
index 65edc254bcbefe0fd6b984993c2da239d8309389..e418bbe58e4862b4794d275219b9aec37ac11623 100644 (file)
@@ -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);