Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdfp-pipe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvdfp-pipe
Commits
4d0710d4
Commit
4d0710d4
authored
Aug 08, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass the varnishd worker environment to the invoked process.
parent
f89ff340
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
configure.ac
configure.ac
+1
-0
Makefile.am
src/Makefile.am
+1
-1
env.vtc
src/tests/env.vtc
+28
-0
vdfp_pipe.c
src/vdfp_pipe.c
+3
-3
No files found.
configure.ac
View file @
4d0710d4
...
...
@@ -25,6 +25,7 @@ AC_PROG_CPP
AC_PATH_PROG([CAT], [cat], [])
AC_PATH_PROG([TR], [tr], [])
AC_PATH_PROG([SED], [sed], [])
AC_PATH_PROG([ENV], [env], [])
AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])
...
...
src/Makefile.am
View file @
4d0710d4
...
...
@@ -30,7 +30,7 @@ AM_TESTS_ENVIRONMENT = \
TEST_EXTENSIONS
=
.vtc
VTC_LOG_COMPILER
=
varnishtest
-v
AM_VTC_LOG_FLAGS
=
-Dvmod_pipe
=
"
$(VMOD_PIPE)
"
-Dcat
=
"
$(CAT)
"
-Dtr
=
"
$(TR)
"
\
-Dsed
=
"
$(SED)
"
-Dsed
=
"
$(SED)
"
-Denv
=
"
$(ENV)
"
TESTS
=
@VMOD_TESTS@
# To test an individual VTC test named test.vtc:
...
...
src/tests/env.vtc
0 → 100644
View file @
4d0710d4
# looks like -*- vcl -*-
varnishtest "environment variables in the invoked process"
server s1 {
rxreq
txresp -body {foo bar baz quux}
} -start
varnish v1 -vcl+backend {
import ${vmod_pipe};
sub vcl_init {
new env = pipe.vdp("${env}");
env.arg("-v");
}
sub vcl_deliver {
set resp.filters = "env";
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen > 0
} -run
src/vdfp_pipe.c
View file @
4d0710d4
...
...
@@ -47,6 +47,8 @@
#include "vcc_if.h"
extern
char
**
environ
;
#define VFAIL(ctx, type, fmt, ...) \
VRT_fail((ctx), type " pipe failure: " fmt, __VA_ARGS__)
...
...
@@ -231,8 +233,6 @@ vdp_init(struct req *req, void **priv)
}
if
(
state
->
chldpid
==
0
)
{
char
*
envp
[]
=
{
NULL
};
close
(
STDIN_FILENO
);
close
(
STDOUT_FILENO
);
close
(
STDERR_FILENO
);
...
...
@@ -247,7 +247,7 @@ vdp_init(struct req *req, void **priv)
exit
(
EXIT_FAILURE
);
errno
=
0
;
if
(
execve
(
obj
->
path
,
argv
,
env
p
)
==
-
1
)
{
if
(
execve
(
obj
->
path
,
argv
,
env
iron
)
==
-
1
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot "
"exec %s: %s"
,
obj
->
name
,
obj
->
path
,
vstrerror
(
errno
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment