[4.1] 44ae23e Make it possible to do
Lasse Karstensen
lkarsten at varnish-software.com
Thu Jan 14 15:15:13 CET 2016
commit 44ae23e39e8d7f6e099a4c79af3deaece8acc2b0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Jan 8 23:08:20 2016 +0000
Make it possible to do
import vmod from "/some/dir/"
and have the default vmod shlib filename appended.
diff --git a/bin/varnishtest/tests/m00008.vtc b/bin/varnishtest/tests/m00008.vtc
index 833a282..10cb23d 100644
--- a/bin/varnishtest/tests/m00008.vtc
+++ b/bin/varnishtest/tests/m00008.vtc
@@ -23,3 +23,11 @@ varnish v1 -cliok "param.set vmod_dir /nowhere:${topbuild}/lib/libvmod_std/.libs
varnish v1 -vcl+backend {
import std;
}
+
+varnish v1 -cliok "param.set vcc_unsafe_path on"
+
+varnish v1 -cliok "param.set vmod_dir /nowhere:/else"
+
+varnish v1 -vcl+backend {
+ import std from "${topbuild}/lib/libvmod_std/.libs/";
+}
diff --git a/bin/varnishtest/tests/v00046.vtc b/bin/varnishtest/tests/v00046.vtc
index 567d3af..f87cd21 100644
--- a/bin/varnishtest/tests/v00046.vtc
+++ b/bin/varnishtest/tests/v00046.vtc
@@ -67,7 +67,7 @@ varnish v1 -errvcl {Found: 'zool' at} {
shell "rm -f ${tmpdir}/a"
shell "rm -f ${tmpdir}/_start.vcl"
-varnish v1 -errvcl {only works in nested VCL include files} {
+varnish v1 -errvcl {needs absolute filename of including file.} {
include "./foobar";
}
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 8bc60ed..62aaeae 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -511,8 +511,8 @@ vcc_resolve_includes(struct vcc *tl)
*/
if (t1->src->name[0] != '/') {
VSB_printf(tl->sb,
- "include \"./xxxxx\"; only works in "
- "nested VCL include files\n");
+ "include \"./xxxxx\"; needs absolute "
+ "filename of including file.\n");
vcc_ErrWhere(tl, t1);
return;
}
@@ -784,14 +784,14 @@ VCC_Compile(const struct vcp *vcp, struct vsb *sb,
{
struct source *sp;
char *r;
+ CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC);
+ AN(sb);
+ AN(vclsrcfile);
- if (vclsrc != NULL) {
- AZ(vclsrcfile);
- sp = vcc_new_source(vclsrc, NULL, "<input>");
- } else {
- AN(vclsrcfile);
+ if (vclsrc != NULL)
+ sp = vcc_new_source(vclsrc, NULL, vclsrcfile);
+ else
sp = vcc_file_source(vcp, sb, vclsrcfile);
- }
if (sp == NULL)
return (NULL);
r = vcc_CompileSource(vcp, sb, sp);
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 0f90e4f..d1b8f26 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -117,7 +117,11 @@ vcc_ParseImport(struct vcc *tl)
return;
}
ExpectErr(tl, CSTR);
- bprintf(fn, "%s", tl->t->dec);
+ p = strrchr(tl->t->dec, '/');
+ if (p != NULL && p[1] == '\0')
+ bprintf(fn, "%slibvmod_%.*s.so", tl->t->dec, PF(mod));
+ else
+ bprintf(fn, "%s", tl->t->dec);
vcc_NextToken(tl);
} else {
bprintf(fn, "libvmod_%.*s.so", PF(mod));
More information about the varnish-commit
mailing list