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
04f843cd
Commit
04f843cd
authored
Aug 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write stderr messages one line at a time to the Varnish log.
parent
cac7d254
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
error.vtc
src/tests/error.vtc
+2
-4
vdfp_pipe.c
src/vdfp_pipe.c
+22
-4
No files found.
src/tests/error.vtc
View file @
04f843cd
...
...
@@ -2,8 +2,6 @@
varnishtest "vdp error handling"
shell "rm -f ${tmpdir}/foo"
server s1 {
rxreq
txresp -body {foo bar baz quux}
...
...
@@ -14,7 +12,7 @@ varnish v1 -vcl+backend {
sub vcl_init {
new cat = pipe.vdp(path="${cat}");
cat.arg("
${tmpdir}/foo
");
cat.arg("
-notalegaloption
");
}
sub vcl_deliver {
...
...
@@ -29,6 +27,6 @@ client c1 {
logexpect l1 -v v1 -g vxid -d 1 -q Error {
expect 0 * Begin {^req \d+ rxreq$}
expect * = Error {^vdfp_pipe: vdp cat: ${cat} stderr}
expect * = Error {^vdfp_pipe: vdp cat: ${cat} stderr
:
}
expect * = End
} -run
src/vdfp_pipe.c
View file @
04f843cd
...
...
@@ -437,10 +437,28 @@ vdp_bytes(struct req *req, enum vdp_action act, void **priv, const void *ptr,
}
continue
;
}
// XXX write one line at a time
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: %s "
"stderr ..."
,
obj
->
name
,
obj
->
path
);
VSLb_bin
(
req
->
vsl
,
SLT_Error
,
nbytes
,
state
->
buf
);
/* Log the stderr message one line at a time. */
for
(
char
*
errmsg
=
state
->
buf
;
nbytes
>
0
;)
{
size_t
linelen
;
char
*
newline
=
memchr
(
errmsg
,
'\n'
,
nbytes
);
if
(
newline
==
NULL
)
linelen
=
nbytes
;
else
linelen
=
newline
-
errmsg
;
assert
(
linelen
<=
(
unsigned
)
nbytes
);
if
(
linelen
==
0
)
{
nbytes
--
;
errmsg
++
;
continue
;
}
VSLb
(
req
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: %s stderr: %.*s"
,
obj
->
name
,
obj
->
path
,
(
int
)
linelen
,
errmsg
);
nbytes
-=
(
linelen
+
1
);
errmsg
+=
(
linelen
+
1
);
}
}
if
(
act
==
VDP_END
)
{
if
(
fds
[
STDIN_FILENO
].
fd
!=
-
1
)
...
...
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