Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
cc2b4c4d
Commit
cc2b4c4d
authored
Sep 19, 2014
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add std.cache_req_body to call VRT_CacheReqBody from VCL
Initial patch by Meng Zhnag - jammy.linux@gmail.com
parent
7e5ec4c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
c00055.vtc
bin/varnishtest/tests/c00055.vtc
+3
-1
c00067.vtc
bin/varnishtest/tests/c00067.vtc
+3
-1
vmod.vcc
lib/libvmod_std/vmod.vcc
+8
-0
vmod_std.c
lib/libvmod_std/vmod_std.c
+9
-0
No files found.
bin/varnishtest/tests/c00055.vtc
View file @
cc2b4c4d
...
@@ -11,8 +11,10 @@ server s1 {
...
@@ -11,8 +11,10 @@ server s1 {
} -start
} -start
varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend {
varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend {
import ${vmod_std};
sub vcl_recv {
sub vcl_recv {
C{ VRT_CacheReqBody(ctx, 1000); }C
std.cache_req_body(1KB);
return (pass);
return (pass);
}
}
sub vcl_deliver {
sub vcl_deliver {
...
...
bin/varnishtest/tests/c00067.vtc
View file @
cc2b4c4d
...
@@ -31,8 +31,10 @@ client c1 {
...
@@ -31,8 +31,10 @@ client c1 {
delay .2
delay .2
varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend {
varnish v1 -cliok "param.set vcc_allow_inline_c true" -vcl+backend {
import ${vmod_std};
sub vcl_recv {
sub vcl_recv {
C{ VRT_CacheReqBody(ctx, 1000); }C
std.cache_req_body(1000B);
}
}
}
}
...
...
lib/libvmod_std/vmod.vcc
View file @
cc2b4c4d
...
@@ -199,6 +199,14 @@ Description
...
@@ -199,6 +199,14 @@ Description
Example
Example
set req.url = std.querysort(req.url);
set req.url = std.querysort(req.url);
$Function VOID cache_req_body(BYTES)
Description
Cache the req.body if it is smaller than the given size
Example
std.cache_req_body(1KB);
This will cache the req.body if its size is smaller than 1KB.
SEE ALSO
SEE ALSO
...
...
lib/libvmod_std/vmod_std.c
View file @
cc2b4c4d
...
@@ -230,3 +230,12 @@ vmod_timestamp(const struct vrt_ctx *ctx, VCL_STRING label)
...
@@ -230,3 +230,12 @@ vmod_timestamp(const struct vrt_ctx *ctx, VCL_STRING label)
VSLb_ts_req
(
ctx
->
req
,
label
,
VTIM_real
());
VSLb_ts_req
(
ctx
->
req
,
label
,
VTIM_real
());
}
}
}
}
VCL_VOID
__match_proto__
(
td_std_cache_req_body
)
vmod_cache_req_body
(
const
struct
vrt_ctx
*
ctx
,
VCL_BYTES
size
)
{
int
result
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
result
=
VRT_CacheReqBody
(
ctx
,
size
);
VSLb
(
ctx
->
vsl
,
SLT_Debug
,
"VRT_CacheReqBody[size: %zu] result: %d"
,
(
size_t
)
size
,
result
);
}
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