Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
6c5d8c50
Unverified
Commit
6c5d8c50
authored
Jun 11, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid a brain twister: For onerror=continue, use the same semantics as varnish-cache
Related prep-work for !6
parent
e2352c14
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
10 deletions
+73
-10
pesi.h
src/pesi.h
+1
-1
r03865.vtc
src/tests/r03865.vtc
+62
-0
vdp_pesi.c
src/vdp_pesi.c
+10
-9
No files found.
src/pesi.h
View file @
6c5d8c50
...
...
@@ -50,7 +50,7 @@ struct pecx {
ssize_t
l
;
int
state
;
int
abr
t
;
int
incl_con
t
;
};
struct
pesi
{
...
...
src/tests/r03865.vtc
0 → 100644
View file @
6c5d8c50
varnishtest "ESI onerror"
server s1 {
rxreq
expect req.url == "/abort"
txresp -hdr {surrogate-control: content="ESI/1.0"} \
-body {before <esi:include src="/fail" onerror="abort"/> after}
} -start
varnish v1 -cliok "param.set feature +esi_disable_xml_check"
varnish v1 -cliok "param.set feature +esi_include_onerror"
varnish v1 -vcl+backend {
import ${vmod_pesi};
sub vcl_backend_fetch {
if (bereq.url == "/fail") {
return (error(604));
}
}
sub vcl_backend_response {
set beresp.do_esi = beresp.http.surrogate-control ~ "ESI/1.0";
unset beresp.http.surrogate-control;
}
sub vcl_backend_error {
if (beresp.status == 604) {
set beresp.body = "FOOBAR";
return(deliver);
}
}
sub vcl_deliver {
pesi.activate();
}
} -start
client c1 {
txreq -url "/abort"
non_fatal
rxresphdrs
expect resp.status == 200
rxchunk
expect_close
expect resp.body == "before "
} -run
varnish v1 -vsl_catchup
server s1 -wait
server s1 {
rxreq
expect req.url == "/continue"
txresp -hdr {surrogate-control: content="ESI/1.0"} \
-body {before <esi:include src="/fail" onerror="continue"/> after}
} -start
client c1 {
fatal
txreq -url "/continue"
rxresp
expect resp.body == "before FOOBAR after"
} -run
src/vdp_pesi.c
View file @
6c5d8c50
...
...
@@ -863,7 +863,7 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
struct
nexus_gzip
*
parent_gzip
=
NULL
;
struct
bytes_tree
*
tree
;
struct
node
*
node
,
*
child
=
NULL
;
int
abr
t
,
retval
=
0
,
parallel
;
int
incl_con
t
,
retval
=
0
,
parallel
;
CHECK_OBJ_NOTNULL
(
vdx
,
VDP_CTX_MAGIC
);
...
...
@@ -908,7 +908,7 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
pp
=
ptr
;
while
(
1
)
{
abr
t
=
0
;
incl_con
t
=
0
;
switch
(
pecx
->
state
)
{
case
0
:
pecx
->
p
=
ObjGetAttr
(
req
->
wrk
,
req
->
objcore
,
...
...
@@ -982,10 +982,11 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
Debug
(
"SKIP1(%d)
\n
"
,
(
int
)
pecx
->
l
);
pecx
->
state
=
4
;
break
;
case
VEC_IA
:
abrt
=
FEATURE
(
FEATURE_ESI_INCLUDE_ONERROR
);
/* FALLTHROUGH */
case
VEC_IC
:
incl_cont
=
FEATURE
(
FEATURE_ESI_INCLUDE_ONERROR
);
/* FALLTHROUGH */
case
VEC_IA
:
pecx
->
p
++
;
q
=
(
void
*
)
strchr
((
const
char
*
)
pecx
->
p
,
'\0'
);
AN
(
q
);
...
...
@@ -1003,9 +1004,9 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
node_insert
(
tree
,
node
,
child
);
pesi
->
pecx
->
abrt
=
abr
t
;
pesi
->
pecx
->
incl_cont
=
incl_con
t
;
VSLdbgv
(
vdx
,
"vped_vdp: call vped_include "
"
abrt=%d"
,
abr
t
);
"
incl_cont=%d"
,
incl_con
t
);
parallel
=
vped_include
(
req
,
(
const
char
*
)
q
,
(
const
char
*
)
pecx
->
p
,
...
...
@@ -1244,8 +1245,8 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
parent
=
node
->
parent
;
CHECK_OBJ_NOTNULL
(
parent
,
NODE_MAGIC
);
VSLdbgv
(
req
,
"vped_deliver: req=%p boc=%p wantbody=%d
abr
t=%d"
,
req
,
boc
,
wantbody
,
pesi
->
pecx
->
abr
t
);
VSLdbgv
(
req
,
"vped_deliver: req=%p boc=%p wantbody=%d
incl_con
t=%d"
,
req
,
boc
,
wantbody
,
pesi
->
pecx
->
incl_con
t
);
assert
(
parent
->
type
==
T_NEXUS
);
if
(
wantbody
==
0
)
{
...
...
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