[master] 0820070 Add rudimentary -X support to varnishncsa

Tollef Fog Heen tfheen at varnish-cache.org
Tue Aug 30 09:05:23 CEST 2011


commit 08200709bd2482fa0f4702c28d1a28cef6f345dc
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Tue Aug 30 09:04:27 2011 +0200

    Add rudimentary -X support to varnishncsa
    
    Avoid crashing if an -X parameter is passed, and skip any requests
    where the URL or Host matches the -X parameter.

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index ce58fdc..76bd83d 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -624,6 +624,13 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
 			 * Fake "%r".  This would be a lot easier if Varnish
 			 * normalized the request URL.
 			 */
+			if (!lp->df_m ||
+			    !req_header(lp, "Host") ||
+			    !lp->df_U ||
+			    !lp->df_H) {
+				clean_logline(lp);
+				return (reopen);
+			}
 			VSB_cat(os, lp->df_m);
 			VSB_putc(os, ' ');
 			if (req_header(lp, "Host")) {



More information about the varnish-commit mailing list