[master] 5f25e69 When the completion function returns empty, reset the rxbuffer in the central code, rather than the completion function.

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 5 22:12:05 CEST 2016


commit 5f25e696c2c27f78864aaf13bdf7c60a758b5f83
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 5 20:10:10 2016 +0000

    When the completion function returns empty, reset the rxbuffer in
    the central code, rather than the completion function.

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index db04b0a..c6823d0 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -269,7 +269,10 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func,
 			/* Working on it */
 			if (t1 != NULL && isnan(*t1))
 				*t1 = now;
-		} else if (hs != HTC_S_EMPTY)
+		} else if (hs == HTC_S_EMPTY) {
+			htc->rxbuf_e = htc->rxbuf_b;
+			*htc->rxbuf_e = '\0';
+		} else
 			WRONG("htc_status_e");
 
 		tmo = tn - now;
diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index 07b2fef..8bac16b 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -75,12 +75,9 @@ HTTP1_Complete(struct http_conn *htc)
 	/* Skip any leading white space */
 	for (p = htc->rxbuf_b ; vct_islws(*p); p++)
 		continue;
-	if (p == htc->rxbuf_e) {
-		/* All white space */
-		htc->rxbuf_e = htc->rxbuf_b;
-		*htc->rxbuf_e = '\0';
+	if (p == htc->rxbuf_e)
 		return (HTC_S_EMPTY);
-	}
+
 	/*
 	 * Here we just look for NL[CR]NL to see that reception
 	 * is completed.  More stringent validation happens later.



More information about the varnish-commit mailing list