MCPcopy Create free account
hub / github.com/apache/trafficserver / ts_lua_http_server_intercept

Function ts_lua_http_server_intercept

plugins/lua/ts_lua_http_intercept.cc:96–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96static int
97ts_lua_http_server_intercept(lua_State *L)
98{
99 TSCont contp;
100 int type, n;
101 ts_lua_http_ctx *http_ctx;
102 ts_lua_http_intercept_ctx *ictx;
103
104 GET_HTTP_CONTEXT(http_ctx, L);
105
106 n = lua_gettop(L);
107
108 if (n < 1) {
109 TSError("[ts_lua][%s] ts.http.server_intercept need at least one param", __FUNCTION__);
110 return 0;
111 }
112
113 type = lua_type(L, 1);
114 if (type != LUA_TFUNCTION) {
115 TSError("[ts_lua][%s] ts.http.server_intercept should use function as param, but there is %s", __FUNCTION__,
116 lua_typename(L, type));
117 return 0;
118 }
119
120 ictx = ts_lua_create_http_intercept_ctx(L, http_ctx, n);
121 contp = TSContCreate(ts_lua_http_intercept_entry, TSMutexCreate());
122 TSContDataSet(contp, ictx);
123
124 TSHttpTxnServerIntercept(contp, http_ctx->txnp);
125 http_ctx->has_hook = 1;
126
127 return 0;
128}
129
130static int
131ts_lua_http_intercept_entry(TSCont contp, TSEvent event, void *edata)

Callers

nothing calls this directly

Calls 6

TSContCreateFunction · 0.85
TSMutexCreateFunction · 0.85
TSContDataSetFunction · 0.85
TSHttpTxnServerInterceptFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected