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
3a8ab1ed
Commit
3a8ab1ed
authored
Aug 02, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rework the vmod interface for setting flags
parent
12fa49fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
35 deletions
+69
-35
README.rst
README.rst
+19
-14
Makefile.am
src/Makefile.am
+1
-0
tbl_set_parameter.h
src/tbl_set_parameter.h
+2
-0
serial.vtc
src/tests/serial.vtc
+2
-2
vdp_pesi.c
src/vdp_pesi.c
+28
-7
vdp_pesi.vcc
src/vdp_pesi.vcc
+17
-12
No files found.
README.rst
View file @
3a8ab1ed
...
...
@@ -65,26 +65,31 @@ missing error handling in varnish-cache. Notice that the VMOD has no
known way to check for this condition, so please address any blame
appropriately.
.. _vmod_pesi.se
rial
:
.. _vmod_pesi.se
t
:
VOID se
rial(BOOL serial=0
)
--------------------------
VOID se
t(ENUM {serial} parameter, [BOOL bool]
)
--------------------------
--------------------
Activates serial mode if the argument is ``true``
.
To be called from ``vcl_deliver {}`` only
.
To be called from vcl_deliver {} only, the default argument is
``false``.
Set per (sub)request parameters for pesi which are documented
below. Parameters may require one or more of the other additional
arguments as documented below. Failure to provide them triggers a VCL
error.
In serial mode, no new threads will be started from this request and
all ESI subrequests at the next level only will be processed by the
current thread.
* ``serial``, requires *bool* argument
In other words, the setting only affects include processing for the
current response body.
Activates serial mode if *bool* is ``true``.
It is strongly recommended to _not_ use serial mode from ESI level 0
because the ESI level 0 thread is responsible for sending available
data to the client.
In serial mode, no new threads will be started from this request, so
all ESI subrequests at the next level will be processed by the
current thread. In other words, the setting only affects include
processing for the current response body.
It is strongly recommended to _not_ use serial mode from ESI level 0
because the ESI level 0 thread is responsible for sending available
data to the client and thus should be running concurrently to other
parallel ESI threads.
.. _vmod_pesi.version:
...
...
src/Makefile.am
View file @
3a8ab1ed
...
...
@@ -9,6 +9,7 @@ vmod_LTLIBRARIES = libvmod_pesi.la
libvmod_pesi_la_SOURCES
=
\
vdp_pesi.c
\
tbl_set_parameter.h
\
foreign/qdef.h
\
foreign/from_cache_esi_deliver.h
\
foreign/from_cache_esi_deliver.c
...
...
src/tbl_set_parameter.h
0 → 100644
View file @
3a8ab1ed
VMODENUM
(
serial
,
PF_CFG_SERIAL
)
#undef VMODENUM
src/tests/serial.vtc
View file @
3a8ab1ed
...
...
@@ -49,7 +49,7 @@ varnish v1 -arg "-p debug=+syncvsl" -vcl+backend {
sub vcl_deliver {
pesi.activate();
pesi.se
rial(
true);
pesi.se
t(serial,
true);
}
} -start
...
...
@@ -264,7 +264,7 @@ varnish v1 -vcl+backend {
sub vcl_deliver {
pesi.activate();
if (std.integer(req.http.Serial-Level, -1) >= req.esi_level) {
pesi.se
rial(
true);
pesi.se
t(serial,
true);
}
}
}
...
...
src/vdp_pesi.c
View file @
3a8ab1ed
...
...
@@ -2966,20 +2966,37 @@ vmod_activate(VRT_CTX)
req
->
filter_list
=
filters
;
}
static
unsigned
vmod_set_param_flag
(
VCL_ENUM
e
)
{
#define VMODENUM(p,f) if (e == VENUM(p)) return(f);
#include "tbl_set_parameter.h"
WRONG
(
"illegal enum"
);
}
VCL_VOID
vmod_se
rial
(
VRT_CTX
,
VCL_BOOL
b
)
vmod_se
t
(
VRT_CTX
,
struct
VARGS
(
set
)
*
args
)
{
struct
vmod_priv
*
priv_task
;
unsigned
vclflags
;
unsigned
f
,
vclflags
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
ctx
->
method
!=
VCL_MET_DELIVER
)
{
VRT_fail
(
ctx
,
"pesi.se
rial
() may only be called "
VRT_fail
(
ctx
,
"pesi.se
t
() may only be called "
"from vcl_deliver{}"
);
return
;
}
/* as of now, all parameters require a bool parameter */
if
(
args
->
valid_bool
==
0
)
{
VRT_fail
(
ctx
,
"pesi.set(%s) requires a bool "
"parameter"
,
args
->
parameter
);
return
;
}
/* get current flags from priv_task */
priv_task
=
VRT_priv_task
(
ctx
,
priv_task_id_cfg
);
if
(
priv_task
==
NULL
)
{
...
...
@@ -2998,11 +3015,15 @@ vmod_serial(VRT_CTX, VCL_BOOL b)
assert
(
priv_task
->
len
==
1
);
}
AZ
(
vclflags
&
~
PF_MASK_CFG
);
/* set by args */
vclflags
&=
~
PF_CFG_SERIAL
;
if
(
b
)
vclflags
|=
PF_CFG_SERIAL
;
f
=
vmod_set_param_flag
(
args
->
parameter
);
vclflags
&=
~
f
;
if
(
args
->
bool
)
vclflags
|=
f
;
AZ
(
vclflags
&
~
PF_MASK_CFG
);
priv_task
->
priv
=
(
void
*
)(
uintptr_t
)
vclflags
;
}
...
...
src/vdp_pesi.vcc
View file @
3a8ab1ed
...
...
@@ -54,23 +54,28 @@ missing error handling in varnish-cache. Notice that the VMOD has no
known way to check for this condition, so please address any blame
appropriately.
$Function VOID se
rial(BOOL serial=0
)
$Function VOID se
t(ENUM { serial } parameter, [BOOL bool]
)
Activates serial mode if the argument is ``true``
.
To be called from ``vcl_deliver {}`` only
.
To be called from vcl_deliver {} only, the default argument is
``false``.
Set per (sub)request parameters for pesi which are documented
below. Parameters may require one or more of the other additional
arguments as documented below. Failure to provide them triggers a VCL
error.
In serial mode, no new threads will be started from this request and
all ESI subrequests at the next level only will be processed by the
current thread.
* ``serial``, requires *bool* argument
In other words, the setting only affects include processing for the
current response body.
Activates serial mode if *bool* is ``true``.
It is strongly recommended to _not_ use serial mode from ESI level 0
because the ESI level 0 thread is responsible for sending available
data to the client.
In serial mode, no new threads will be started from this request, so
all ESI subrequests at the next level will be processed by the
current thread. In other words, the setting only affects include
processing for the current response body.
It is strongly recommended to _not_ use serial mode from ESI level 0
because the ESI level 0 thread is responsible for sending available
data to the client and thus should be running concurrently to other
parallel ESI threads.
$Function STRING version()
...
...
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