Just created one, please review. 

From e6f95f0bafa656de41c25ecd74f6d626ab70c25f Mon Sep 17 00:00:00 2001
From: ijammy <[email protected]>
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 = "">
 
+$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



Attachment: 0001-Add-std.cache_req_body-for-VRT_CacheReqBody.patch
Description: Binary data



On 30 Jul, 2014, at 3:57 pm, Poul-Henning Kamp <[email protected]> wrote:

--------
In message <[email protected]>, 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
[email protected]         | 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
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev








_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to