VRT_CacheReqBody without inline-C?

Meng Zhang jammy.linux at gmail.com
Wed Jul 30 17:00:41 CEST 2014


Just created one, please review. 

From e6f95f0bafa656de41c25ecd74f6d626ab70c25f Mon Sep 17 00:00:00 2001
From: ijammy <mzhang at yottaa.com>
Date: Wed, 30 Jul 2014 22:56:40 +0800
Subject: [PATCH] Add std.cache_req_body for VRT_CacheReqBody

---
 lib/libvmod_std/vmod.vcc   |  7 +++++++
 lib/libvmod_std/vmod_std.c | 12 ++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc
index fbee007..aa3c342 100644
--- a/lib/libvmod_std/vmod.vcc
+++ b/lib/libvmod_std/vmod.vcc
@@ -192,6 +192,13 @@ Description
 Example
         set req.url = std.querysort(req.url);
 
+$Function VOID cache_req_body(REAL)
+
+Description
+       Cache the req.body if it is smaller than the given size
+Example
+       std.cache_req_body(1000);
+       This will cache the req.body if its size is smaller than 1000B
 
 
 SEE ALSO
diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 718fb71..08fc13d 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -224,3 +224,15 @@ vmod_timestamp(const struct vrt_ctx *ctx, VCL_STRING label)
 		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_REAL size)
+{
+
+	long long llsize = (long long)size;
+	int result;
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	result = VRT_CacheReqBody(ctx,llsize);
+	VSLb(ctx->vsl, SLT_Debug,"VRT_CacheReqBody[size: %lld] result: %d",llsize,result);
+
+}
-- 
2.0.1.442.g7fe6834






On 30 Jul, 2014, at 3:57 pm, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:

> --------
> In message <53D692F4.7030904 at schokola.de>, Nils Goroll writes:
> 
>> are there any plans for VRT_CacheReqBody ? move into std or the like?
> 
> Yes, we should probably do that.
> 
> Patch anyone ?
> 
> 
> -- 
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe    
> Never attribute to malice what can adequately be explained by incompetence.
> 
> _______________________________________________
> varnish-dev mailing list
> varnish-dev at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140730/ff76f1ae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-std.cache_req_body-for-VRT_CacheReqBody.patch
Type: application/octet-stream
Size: 1489 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140730/ff76f1ae/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140730/ff76f1ae/attachment-0001.html>


More information about the varnish-dev mailing list