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
0d278dbd
Commit
0d278dbd
authored
Aug 06, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the vdp.arg() method.
parent
b1dea62c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
5 deletions
+172
-5
README.rst
README.rst
+7
-0
configure.ac
configure.ac
+2
-0
Makefile.am
src/Makefile.am
+2
-1
arg.vtc
src/tests/arg.vtc
+112
-0
vdfp_pipe.c
src/vdfp_pipe.c
+45
-4
vdfp_pipe.vcc
src/vdfp_pipe.vcc
+4
-0
No files found.
README.rst
View file @
0d278dbd
...
...
@@ -65,6 +65,13 @@ new xvdp = pipe.vdp(STRING path, STRING name, BYTES bufsz)
XXX ...
.. _xvdp.arg():
VOID xvdp.arg(STRING)
---------------------
XXX ...
.. _pipe.version():
STRING version()
...
...
configure.ac
View file @
0d278dbd
...
...
@@ -23,6 +23,8 @@ AC_PROG_CPP
# To get absolute paths in the vtc tests.
AC_PATH_PROG([CAT], [cat], [])
AC_PATH_PROG([TR], [tr], [])
AC_PATH_PROG([SED], [sed], [])
AX_PTHREAD(,[AC_MSG_ERROR([Could not configure pthreads support])])
...
...
src/Makefile.am
View file @
0d278dbd
...
...
@@ -29,7 +29,8 @@ AM_TESTS_ENVIRONMENT = \
LD_LIBRARY_PATH
=
"
$(VARNISH_LIBRARY_PATH)
"
TEST_EXTENSIONS
=
.vtc
VTC_LOG_COMPILER
=
varnishtest
-v
AM_VTC_LOG_FLAGS
=
-Dvmod_pipe
=
"
$(VMOD_PIPE)
"
-Dcat
=
"
$(CAT)
"
AM_VTC_LOG_FLAGS
=
-Dvmod_pipe
=
"
$(VMOD_PIPE)
"
-Dcat
=
"
$(CAT)
"
-Dtr
=
"
$(TR)
"
\
-Dsed
=
"
$(SED)
"
TESTS
=
@VMOD_TESTS@
# To test an individual VTC test named test.vtc:
...
...
src/tests/arg.vtc
0 → 100644
View file @
0d278dbd
This diff is collapsed.
Click to expand it.
src/vdfp_pipe.c
View file @
0d278dbd
...
...
@@ -68,7 +68,9 @@ struct VPFX(pipe_vdp) {
char
*
name
;
char
*
path
;
struct
vdp
*
vdp
;
char
**
argv
;
size_t
bufsz
;
int
argc
;
};
struct
vdp_map
{
...
...
@@ -205,7 +207,6 @@ vdp_init(struct req *req, void **priv)
if
(
state
->
chldpid
==
0
)
{
char
*
envp
[]
=
{
NULL
};
char
*
argv
[
2
];
close
(
STDIN_FILENO
);
close
(
STDOUT_FILENO
);
...
...
@@ -220,10 +221,8 @@ vdp_init(struct req *req, void **priv)
if
(
mk_dup
(
err
[
1
],
STDERR_FILENO
,
obj
->
name
,
req
->
vsl
)
!=
0
)
exit
(
EXIT_FAILURE
);
argv
[
0
]
=
obj
->
path
;
argv
[
1
]
=
NULL
;
errno
=
0
;
if
(
execve
(
obj
->
path
,
argv
,
envp
)
==
-
1
)
{
if
(
execve
(
obj
->
path
,
obj
->
argv
,
envp
)
==
-
1
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot "
"exec %s: %s"
,
obj
->
name
,
obj
->
path
,
vstrerror
(
errno
));
...
...
@@ -585,6 +584,17 @@ vmod_vdp__init(VRT_CTX, struct VPFX(pipe_vdp) **vdpp, const char *obj_name,
map
->
obj
=
vdp_obj
;
AZ
(
VRBT_INSERT
(
vdp_tree
,
&
tree_h
,
map
));
errno
=
0
;
vdp_obj
->
argv
=
malloc
(
2
*
sizeof
(
*
vdp_obj
->
argv
));
if
(
vdp_obj
->
argv
==
NULL
)
{
VDPFAIL
(
ctx
,
"new %s: cannot allocate argv: %s"
,
obj_name
,
vstrerror
(
errno
));
return
;
}
vdp_obj
->
argv
[
0
]
=
vdp_obj
->
path
;
vdp_obj
->
argv
[
1
]
=
NULL
;
vdp_obj
->
argc
=
1
;
return
;
}
...
...
@@ -602,9 +612,40 @@ vmod_vdp__fini(struct VPFX(pipe_vdp) **vdpp)
free
(
vdp_obj
->
name
);
if
(
vdp_obj
->
path
!=
NULL
)
free
(
vdp_obj
->
path
);
if
(
vdp_obj
->
argv
!=
NULL
)
{
for
(
int
i
=
1
;
vdp_obj
->
argv
[
i
]
!=
NULL
;
i
++
)
free
(
vdp_obj
->
argv
[
i
]);
free
(
vdp_obj
->
argv
);
}
FREE_OBJ
(
vdp_obj
);
}
/* XXX currently only for vcl_init */
VCL_VOID
vmod_vdp_arg
(
VRT_CTX
,
struct
VPFX
(
pipe_vdp
)
*
obj
,
VCL_STRING
arg
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
obj
,
PIPE_VDP_MAGIC
);
if
(
arg
==
NULL
)
{
VDPFAIL
(
ctx
,
"%s.arg(): arg is NULL"
,
obj
->
name
);
return
;
}
errno
=
0
;
obj
->
argv
=
realloc
(
obj
->
argv
,
(
obj
->
argc
+
2
)
*
sizeof
(
*
obj
->
argv
));
if
(
obj
->
argv
==
NULL
)
{
VDPFAIL
(
ctx
,
"%s.arg(): cannot re-allocate argv: %s"
,
obj
->
name
,
vstrerror
(
errno
));
return
;
}
obj
->
argv
[
obj
->
argc
]
=
strdup
(
arg
);
obj
->
argv
[
obj
->
argc
+
1
]
=
NULL
;
obj
->
argc
++
;
return
;
}
VCL_STRING
vmod_version
(
VRT_CTX
)
{
...
...
src/vdfp_pipe.vcc
View file @
0d278dbd
...
...
@@ -54,6 +54,10 @@ $Object vdp(STRING path, STRING name=0, BYTES bufsz=0)
XXX ...
$Method VOID .arg(STRING)
XXX ...
$Function STRING version()
Return the version string for this library.
...
...
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