This is an automated email from the ASF dual-hosted git repository.
kichan pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 7662c30 TS-4911: ts_lua plugin is modified to clear
'client_response_hdrp' pointer when it enters SEND_RESPONSE_HDR hook.
7662c30 is described below
commit 7662c30e48a444d0d8d37b2e2d34f71b21e3bfcd
Author: rb304g <[email protected]>
AuthorDate: Thu Sep 29 18:42:56 2016 +0000
TS-4911: ts_lua plugin is modified to clear 'client_response_hdrp' pointer
when it enters SEND_RESPONSE_HDR hook.
---
plugins/experimental/ts_lua/ts_lua.c | 7 +++++++
plugins/experimental/ts_lua/ts_lua_util.c | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/plugins/experimental/ts_lua/ts_lua.c
b/plugins/experimental/ts_lua/ts_lua.c
index 476c04a..11041dc 100644
--- a/plugins/experimental/ts_lua/ts_lua.c
+++ b/plugins/experimental/ts_lua/ts_lua.c
@@ -278,6 +278,13 @@ globalHookHandler(TSCont contp, TSEvent event ATS_UNUSED,
void *edata)
break;
case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
+ // client response can be changed within a transaction
+ // (e.g. due to the follow redirect feature). So, clearing the pointers
+ // to allow API(s) to fetch the pointers again when it re-enters the hook
+ if (http_ctx->client_response_hdrp != NULL) {
+ TSHandleMLocRelease(http_ctx->client_response_bufp, TS_NULL_MLOC,
http_ctx->client_response_hdrp);
+ http_ctx->client_response_hdrp = NULL;
+ }
lua_getglobal(l, TS_LUA_FUNCTION_G_SEND_RESPONSE);
break;
diff --git a/plugins/experimental/ts_lua/ts_lua_util.c
b/plugins/experimental/ts_lua/ts_lua_util.c
index 4cfc9b8..b089d37 100644
--- a/plugins/experimental/ts_lua/ts_lua_util.c
+++ b/plugins/experimental/ts_lua/ts_lua_util.c
@@ -709,6 +709,14 @@ ts_lua_http_cont_handler(TSCont contp, TSEvent ev, void
*edata)
case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
+ // client response can be changed within a transaction
+ // (e.g. due to the follow redirect feature). So, clearing the pointers
+ // to allow API(s) to fetch the pointers again when it re-enters the hook
+ if (http_ctx->client_response_hdrp != NULL) {
+ TSHandleMLocRelease(http_ctx->client_response_bufp, TS_NULL_MLOC,
http_ctx->client_response_hdrp);
+ http_ctx->client_response_hdrp = NULL;
+ }
+
lua_getglobal(L, TS_LUA_FUNCTION_SEND_RESPONSE);
if (lua_type(L, -1) == LUA_TFUNCTION) {
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].