1-- Licensed to the Apache Software Foundation (ASF) under one 2-- or more contributor license agreements. See the NOTICE file 3-- distributed with this work for additional information 4-- regarding copyright ownership. The ASF licenses this file 5-- to you under the Apache License, Version 2.0 (the 6-- "License"); you may not use this file except in compliance 7-- with the License. You may obtain a copy of the License at 8-- 9-- http://www.apache.org/licenses/LICENSE-2.0 10-- 11-- Unless required by applicable law or agreed to in writing, software 12-- distributed under the License is distributed on an "AS IS" BASIS, 13-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14-- See the License for the specific language governing permissions and 15-- limitations under the License. 16 17 18local module = {} 19 20function module.test() 21 return 0 22end 23 24function module.set_hook() 25 ts.hook(TS_LUA_HOOK_TXN_CLOSE, module.test) 26end 27 28 29function module.set_context() 30 ts.ctx['test'] = 'test10' 31end 32 33function module.check_internal() 34 return ts.http.is_internal_request() 35end 36 37function module.return_constant() 38 return TS_LUA_REMAP_DID_REMAP 39end 40 41function module.split(s, delimiter) 42 result = {} 43 for match in (s..delimiter):gmatch("(.-)"..delimiter) do 44 table.insert(result, match) 45 end 46 return result 47end 48 49return module 50