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

Function ts_lua_http_intercept

plugins/lua/ts_lua_http_intercept.cc:63–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static int
64ts_lua_http_intercept(lua_State *L)
65{
66 TSCont contp;
67 int type, n;
68 ts_lua_http_ctx *http_ctx;
69 ts_lua_http_intercept_ctx *ictx;
70
71 GET_HTTP_CONTEXT(http_ctx, L);
72
73 n = lua_gettop(L);
74
75 if (n < 1) {
76 TSError("[ts_lua][%s] ts.http.intercept need at least one param", __FUNCTION__);
77 return 0;
78 }
79
80 type = lua_type(L, 1);
81 if (type != LUA_TFUNCTION) {
82 TSError("[ts_lua][%s] ts.http.intercept should use function as param, but there is %s", __FUNCTION__, lua_typename(L, type));
83 return 0;
84 }
85
86 ictx = ts_lua_create_http_intercept_ctx(L, http_ctx, n);
87 contp = TSContCreate(ts_lua_http_intercept_entry, TSMutexCreate());
88 TSContDataSet(contp, ictx);
89
90 TSHttpTxnIntercept(contp, http_ctx->txnp);
91 http_ctx->has_hook = 1;
92
93 return 0;
94}
95
96static int
97ts_lua_http_server_intercept(lua_State *L)

Callers

nothing calls this directly

Calls 6

TSContCreateFunction · 0.85
TSMutexCreateFunction · 0.85
TSContDataSetFunction · 0.85
TSHttpTxnInterceptFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected