Commit 3a56dbdd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Also correctly initialize subsequent references to vmods.

Fixes:	878

Solved by:	tmagnien
parent 27422d81
...@@ -90,19 +90,20 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm, const char *path) ...@@ -90,19 +90,20 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm, const char *path)
x = dlsym(v->hdl, "Vmod_Name"); x = dlsym(v->hdl, "Vmod_Name");
AN(x); AN(x);
/* XXX: check that name is correct */
x = dlsym(v->hdl, "Vmod_Len"); x = dlsym(v->hdl, "Vmod_Len");
AN(x); AN(x);
i = x; i = x;
assert(len == *i); v->funclen = *i;
x = dlsym(v->hdl, "Vmod_Func"); x = dlsym(v->hdl, "Vmod_Func");
AN(x); AN(x);
memcpy(ptr, x, len);
v->funcs = x; v->funcs = x;
v->funclen = *i;
} }
assert(len == v->funclen);
memcpy(ptr, v->funcs, v->funclen);
v->ref++; v->ref++;
*hdl = v; *hdl = v;
......
#!/bin/sh
test "Loading vmods in subsequent VCLs"
server s1 {
rxreq
txresp -bodylen 4
} -start
varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
sub vcl_deliver {
set resp.http.who = std.author(phk);
}
} -start
client c1 {
txreq
rxresp
} -run
varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
sub vcl_deliver {
set resp.http.who = std.author(des);
}
}
client c1 {
txreq
rxresp
} -run
varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so" ;
sub vcl_deliver {
set resp.http.who = std.author(kristian);
}
}
client c1 {
txreq
rxresp
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment