Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/admin-guide/plugins/xdebug.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@ not be modified or deleted.
:file:`plugin.config` file. It currently takes a single, optional
configuration option, ``--header``. E.g.

::

--header=ATS-My-Debug

This overrides the default ``X-Debug`` header name.

All the debug headers are disabled by default, and you need to enable them
selectively by passing header names to ``--enable`` option.

::

--enable=x-remap,x-cache

This enables ``X-Remap`` and ``X-Cache``. If a client's request has
Expand Down
6 changes: 6 additions & 0 deletions plugins/xdebug/xdebug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ XScanRequestHeaders(TSCont /* contp */, TSEvent event, void *edata)
if (value == nullptr || vsize == 0) {
continue;
}
TSDebug("xdebug", "Validating value: '%.*s'", vsize, value);

#define header_field_eq(name, vptr, vlen) (((int)name.size() == vlen) && (strncasecmp(name.data(), vptr, vlen) == 0))

Expand Down Expand Up @@ -822,8 +823,10 @@ updateAllowedHeaders(const char *optarg)
const auto ite = std::find_if(std::begin(header_flags), std::end(header_flags),
[token](const struct XHeader &x) { return x.name.compare(token) == 0; });
if (ite != std::end(header_flags)) {
TSDebug("xdebug", "Enabled allowed header name: %s", token);
allowedHeaders |= ite->flag;
} else {
TSDebug("xdebug", "Unknown header name: %s", token);
TSError("[xdebug] Unknown header name: %s", token);
}
}
Expand All @@ -833,6 +836,8 @@ updateAllowedHeaders(const char *optarg)
void
TSPluginInit(int argc, const char *argv[])
{
TSDebug("xdebug", "initializing plugin");

static const struct option longopt[] = {
{const_cast<char *>("header"), required_argument, nullptr, 'h' },
{const_cast<char *>("enable"), required_argument, nullptr, 'e' },
Expand All @@ -854,6 +859,7 @@ TSPluginInit(int argc, const char *argv[])

switch (opt) {
case 'h':
TSDebug("xdebug", "Setting header: %s", optarg);
xDebugHeader.str = TSstrdup(optarg);
break;
case 'e':
Expand Down