<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Just created one, please review. </div><div><br></div><div><div>From e6f95f0bafa656de41c25ecd74f6d626ab70c25f Mon Sep 17 00:00:00 2001</div><div>From: ijammy <<a href="mailto:mzhang@yottaa.com">mzhang@yottaa.com</a>></div><div>Date: Wed, 30 Jul 2014 22:56:40 +0800</div><div>Subject: [PATCH] Add std.cache_req_body for VRT_CacheReqBody</div><div><br></div><div>---</div><div> lib/libvmod_std/vmod.vcc | 7 +++++++</div><div> lib/libvmod_std/vmod_std.c | 12 ++++++++++++</div><div> 2 files changed, 19 insertions(+)</div><div><br></div><div>diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc</div><div>index fbee007..aa3c342 100644</div><div>--- a/lib/libvmod_std/vmod.vcc</div><div>+++ b/lib/libvmod_std/vmod.vcc</div><div>@@ -192,6 +192,13 @@ Description</div><div> Example</div><div> set req.url = std.querysort(req.url);</div><div> </div><div>+$Function VOID cache_req_body(REAL)</div><div>+</div><div>+Description</div><div>+ Cache the req.body if it is smaller than the given size</div><div>+Example</div><div>+ std.cache_req_body(1000);</div><div>+ This will cache the req.body if its size is smaller than 1000B</div><div> </div><div> </div><div> SEE ALSO</div><div>diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c</div><div>index 718fb71..08fc13d 100644</div><div>--- a/lib/libvmod_std/vmod_std.c</div><div>+++ b/lib/libvmod_std/vmod_std.c</div><div>@@ -224,3 +224,15 @@ vmod_timestamp(const struct vrt_ctx *ctx, VCL_STRING label)</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>VSLb_ts_req(ctx->req, label, VTIM_real());</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div> }</div><div>+</div><div>+VCL_VOID __match_proto__(td_std_cache_req_body)</div><div>+vmod_cache_req_body(const struct vrt_ctx *ctx, VCL_REAL size)</div><div>+{</div><div>+</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>long long llsize = (long long)size;</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>int result;</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>result = VRT_CacheReqBody(ctx,llsize);</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>VSLb(ctx->vsl, SLT_Debug,"VRT_CacheReqBody[size: %lld] result: %d",llsize,result);</div><div>+</div><div>+}</div><div>-- </div><div>2.0.1.442.g7fe6834</div></div><div><br></div><div><br></div><div><br></div><div></div></body></html>