Kit Chan created TS-3674:
----------------------------

             Summary:  bug in ts_lua plugin for adding package path 
                 Key: TS-3674
                 URL: https://issues.apache.org/jira/browse/TS-3674
             Project: Traffic Server
          Issue Type: Bug
          Components: Lua, Plugins
            Reporter: Kit Chan


Specifically the following situation will make the server fail to restart

-- /tmp/global_lua.lua , used in plugin.config
ts.add_package_path('/tmp/lib/?.lua')
local g_config = require "g_config"

function send_response()
    ts.client_response.header['g_Rhost'] = ts.ctx['rhost']
    ts.client_response.header['g_config'] = g_config.name
    return 0
end

function do_global_read_request()
    local req_host = ts.client_request.header.Host
    ts.ctx['rhost'] = string.reverse(req_host)
    ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, send_response)
    return 0
end

-- /tmp/lib/g_config.lua
local g_config = {}
  g_config.name = 'xxx'
return g_config

-- /tmp/remap_lua.lua , used in remap.config
ts.add_package_path('/tmp/lib/?.lua')
local r_config = require "r_config"

function send_response()
    ts.client_response.header['r_Rhost'] = ts.ctx['rhost']
    ts.client_response.header['r_config'] = r_config.name
    return 0
end

function do_remap()
    local req_host = ts.client_request.header.Host
    ts.ctx['rhost'] = string.reverse(req_host)
    ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, send_response)
    return 0
end

-- /tmp/lib/r_config.lua
local r_config = {}
  r_config.name = 'yyy'
return r_config

That's because of a bug in the code for adding package path. Providing a fix 
soon.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to