Repository: trafficserver
Updated Branches:
  refs/heads/master e2967b5b9 -> 7b467783d


TS-4021: TSHttpTxnFollowRedirect() in ts_lua plugin. This closes #335


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7b467783
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7b467783
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7b467783

Branch: refs/heads/master
Commit: 7b467783da30ef18983ef37068ecd1300f70dcb4
Parents: e2967b5
Author: Peter Chou <[email protected]>
Authored: Fri Nov 13 16:34:40 2015 -0800
Committer: Kit Chan <[email protected]>
Committed: Fri Nov 13 16:34:40 2015 -0800

----------------------------------------------------------------------
 .../experimental/ts_lua/ts_lua_http_config.c    | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7b467783/plugins/experimental/ts_lua/ts_lua_http_config.c
----------------------------------------------------------------------
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c 
b/plugins/experimental/ts_lua/ts_lua_http_config.c
index 50cf14c..05edf21 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -223,6 +223,7 @@ static int ts_lua_http_client_packet_tos_set(lua_State *L);
 static int ts_lua_http_server_packet_tos_set(lua_State *L);
 static int ts_lua_http_client_packet_dscp_set(lua_State *L);
 static int ts_lua_http_server_packet_dscp_set(lua_State *L);
+static int ts_lua_http_enable_redirect(lua_State *L);
 
 void
 ts_lua_inject_http_config_api(lua_State *L)
@@ -267,6 +268,9 @@ ts_lua_inject_http_config_api(lua_State *L)
 
   lua_pushcfunction(L, ts_lua_http_server_packet_dscp_set);
   lua_setfield(L, -2, "server_packet_dscp_set");
+
+  lua_pushcfunction(L, ts_lua_http_enable_redirect);
+  lua_setfield(L, -2, "enable_redirect");
 }
 
 static void
@@ -482,6 +486,23 @@ ts_lua_http_client_packet_tos_set(lua_State *L)
 }
 
 static int
+ts_lua_http_enable_redirect(lua_State *L)
+{
+  int value;
+  ts_lua_http_ctx *http_ctx;
+
+  http_ctx = ts_lua_get_http_ctx(L);
+
+  value = luaL_checkinteger(L, 1);
+
+  TSDebug(TS_LUA_DEBUG_TAG, "enable redirect");
+  TSHttpTxnFollowRedirect(http_ctx->txnp, value);
+
+  return 0;
+}
+
+
+static int
 ts_lua_http_server_packet_tos_set(lua_State *L)
 {
   int value;

Reply via email to