r351 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Jul 6 15:27:22 CEST 2006


Author: phk
Date: 2006-07-06 15:27:21 +0200 (Thu, 06 Jul 2006)
New Revision: 351

Modified:
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Skip space before request/response


Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-06 13:02:28 UTC (rev 350)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-07-06 13:27:21 UTC (rev 351)
@@ -210,11 +210,13 @@
 {
 	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 @@
 		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 @@
 		}
 	}
 	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 @@
 {
 	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');




More information about the varnish-commit mailing list