]> err.no Git - varnish/commitdiff
Skip space before request/response
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Jul 2006 13:27:21 +0000 (13:27 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 6 Jul 2006 13:27:21 +0000 (13:27 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@351 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_http.c

index 5c7d4daeb5363959550d2595a3fb88d567bd38ff..a0db9e821074295ae41d47a910263a361c61830a 100644 (file)
@@ -210,11 +210,13 @@ http_Dissect(struct http *hp, int fd, int rr)
 {
        char *p, *q, *r;
 
+       for (p = hp->s ; p < hp->v && isspace(*p); p++)
+               continue;
        assert(hp->t != NULL);
        if (rr == 1) {
                /* First, isolate and possibly identify request type */
-               hp->req = hp->s;
-               for (p = hp->s; isalpha(*p); p++)
+               hp->req = p;
+               for (; isalpha(*p); p++)
                        ;
                VSLR(SLT_Request, fd, hp->req, p);
                *p++ = '\0';
@@ -244,8 +246,7 @@ http_Dissect(struct http *hp, int fd, int rr)
                p++;
        } else {
                /* First, protocol */
-               hp->proto = hp->s;
-               p = hp->s;
+               hp->proto = p;
                while (!isspace(*p))
                        p++;
                VSLR(SLT_Protocol, fd, hp->proto, p);
@@ -295,6 +296,8 @@ http_Dissect(struct http *hp, int fd, int rr)
                }
        }
        assert(hp->t <= hp->v);
+       if (hp->t != r)
+               printf("hp->t %p r %p\n", hp->t, r);
        assert(hp->t == r);
 }
 
@@ -305,7 +308,10 @@ http_header_complete(struct http *hp)
 {
        char *p;
 
-       p = hp->s;
+       for (p = hp->s ; p < hp->v && isspace(*p); p++)
+               continue;
+       if (p >= hp->v)
+               return (0);
        while (1) {
                /* XXX: we could save location of all linebreaks for later */
                p = strchr(p, '\n');