Commit 4523deed authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Skip space before request/response


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@351 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 82af1432
...@@ -210,11 +210,13 @@ http_Dissect(struct http *hp, int fd, int rr) ...@@ -210,11 +210,13 @@ http_Dissect(struct http *hp, int fd, int rr)
{ {
char *p, *q, *r; char *p, *q, *r;
for (p = hp->s ; p < hp->v && isspace(*p); p++)
continue;
assert(hp->t != NULL); assert(hp->t != NULL);
if (rr == 1) { if (rr == 1) {
/* First, isolate and possibly identify request type */ /* First, isolate and possibly identify request type */
hp->req = hp->s; hp->req = p;
for (p = hp->s; isalpha(*p); p++) for (; isalpha(*p); p++)
; ;
VSLR(SLT_Request, fd, hp->req, p); VSLR(SLT_Request, fd, hp->req, p);
*p++ = '\0'; *p++ = '\0';
...@@ -244,8 +246,7 @@ http_Dissect(struct http *hp, int fd, int rr) ...@@ -244,8 +246,7 @@ http_Dissect(struct http *hp, int fd, int rr)
p++; p++;
} else { } else {
/* First, protocol */ /* First, protocol */
hp->proto = hp->s; hp->proto = p;
p = hp->s;
while (!isspace(*p)) while (!isspace(*p))
p++; p++;
VSLR(SLT_Protocol, fd, hp->proto, p); VSLR(SLT_Protocol, fd, hp->proto, p);
...@@ -295,6 +296,8 @@ http_Dissect(struct http *hp, int fd, int rr) ...@@ -295,6 +296,8 @@ http_Dissect(struct http *hp, int fd, int rr)
} }
} }
assert(hp->t <= hp->v); assert(hp->t <= hp->v);
if (hp->t != r)
printf("hp->t %p r %p\n", hp->t, r);
assert(hp->t == r); assert(hp->t == r);
} }
...@@ -305,7 +308,10 @@ http_header_complete(struct http *hp) ...@@ -305,7 +308,10 @@ http_header_complete(struct http *hp)
{ {
char *p; char *p;
p = hp->s; for (p = hp->s ; p < hp->v && isspace(*p); p++)
continue;
if (p >= hp->v)
return (0);
while (1) { while (1) {
/* XXX: we could save location of all linebreaks for later */ /* XXX: we could save location of all linebreaks for later */
p = strchr(p, '\n'); p = strchr(p, '\n');
......
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