[master] c1f8780 Add "-x dumpbuiltin" to varnishd
Poul-Henning Kamp
phk at FreeBSD.org
Mon Jan 16 12:36:05 CET 2017
commit c1f87801d25c845a8162e8d115cc607a1c1b6f0d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Jan 16 11:34:34 2017 +0000
Add "-x dumpbuiltin" to varnishd
diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl
index 9f7a346..2ccbf4c 100644
--- a/bin/varnishd/builtin.vcl
+++ b/bin/varnishd/builtin.vcl
@@ -26,17 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
-
- *
- * The built-in (previously called default) VCL code.
- *
- * NB! You do NOT need to copy & paste all of these functions into your
- * own vcl code, if you do not provide a definition of one of these
- * functions, the compiler will automatically fall back to the default
- * code from this file.
- *
- * This code will be prefixed with a backend declaration built from the
- * -b argument.
+ * This is the builtin VCL code
*/
vcl 4.0;
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 2c88cb4..60e7def 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -178,6 +178,7 @@ void STV_Config(const char *spec);
void STV_Config_Transient(void);
/* mgt_vcc.c */
+void mgt_DumpBuiltin(void);
char *mgt_VccCompile(struct cli *, struct vclprog *, const char *vclname,
const char *vclsrc, const char *vclsrcfile, int C_flag);
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 77aa1d5..af8a521 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -340,6 +340,8 @@ mgt_x_arg(const char *x_arg)
mgt_DumpRstVsl();
else if (!strcmp(x_arg, "dumprstcli"))
mgt_DumpRstCli();
+ else if (!strcmp(x_arg, "dumpbuiltin"))
+ mgt_DumpBuiltin();
else
ARGV_ERR("Invalid -x argument\n");
}
diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 863a49c..6a810b6 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -76,6 +76,12 @@ static const char * const builtin_vcl =
#include "builtin_vcl.h"
"" ;
+void
+mgt_DumpBuiltin(void)
+{
+ puts(builtin_vcl);
+}
+
/*--------------------------------------------------------------------
* Invoke system VCC compiler in a sub-process
*/
diff --git a/bin/varnishtest/tests/a00009.vtc b/bin/varnishtest/tests/a00009.vtc
index c783c44..12cb05c 100644
--- a/bin/varnishtest/tests/a00009.vtc
+++ b/bin/varnishtest/tests/a00009.vtc
@@ -4,6 +4,7 @@ shell "varnishd -b 127.0.0.1:80 -C 2> ${tmpdir}/_.c"
shell "varnishd -x dumprstparam > ${tmpdir}/_.param"
shell "varnishd -x dumprstvsl > ${tmpdir}/_.vsl"
shell "varnishd -x dumprstcli > ${tmpdir}/_.cli"
+shell "varnishd -x dumpbuiltin > ${tmpdir}/_.builtin"
shell -err -expect {VCL version declaration missing} {
echo 'bad vcl' > ${tmpdir}/t.vcl
varnishd -f ${tmpdir}/t.vcl -n ${tmpdir}
More information about the varnish-commit
mailing list