trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [trafficserver] branch 6.2.x updated: TS-4911: ts_lua plugin is modified to clear 'client_response_hdrp' pointer when it enters SEND_RESPONSE_HDR hook.
Date Fri, 04 Nov 2016 03:11:08 GMT
This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/6.2.x by this push:
       new  6897ebc   TS-4911: ts_lua plugin is modified to clear 'client_response_hdrp' pointer
when it enters SEND_RESPONSE_HDR hook.
6897ebc is described below

commit 6897ebc723439aab45b12a8e883623f13f341e34
Author: rb304g <rb304g@att.com>
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.
    
    (cherry picked from commit 7662c30e48a444d0d8d37b2e2d34f71b21e3bfcd)
---
 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 c4e3a6a..7c1b6f3 100644
--- a/plugins/experimental/ts_lua/ts_lua.c
+++ b/plugins/experimental/ts_lua/ts_lua.c
@@ -263,6 +263,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 13d2a58..a991440 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
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message