From d45db7ded013eda2a0e90eef4b63b4770b5dfe3f Mon Sep 17 00:00:00 2001 From: Walter Karas Date: Mon, 14 Sep 2020 19:08:25 -0500 Subject: [PATCH] Make custom xdebug HTTP header name available to other plugins. The custom header name is passed to the xdebug plugin as plugin parameter. This change makes it available as a global TS API user parameter. --- plugins/xdebug/xdebug.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/xdebug/xdebug.cc b/plugins/xdebug/xdebug.cc index 5e811907c3e..30a1d108c58 100644 --- a/plugins/xdebug/xdebug.cc +++ b/plugins/xdebug/xdebug.cc @@ -706,6 +706,13 @@ TSPluginInit(int argc, const char *argv[]) } xDebugHeader.len = strlen(xDebugHeader.str); + // Make xDebugHeader available to other plugins, as a C-style string. + // + int idx = -1; + TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx) == TS_SUCCESS); + TSReleaseAssert(idx >= 0); + TSUserArgSet(nullptr, idx, const_cast(xDebugHeader.str)); + AuxDataMgr::init("xdebug"); // Setup the global hook