Updated Branches: refs/heads/master a27b9e73a -> f1bffdf25
TS-2188 Never consider a simple / path as a healthcheck This is an optimization, and a safety net, such that a simple / path can never be considered for a healthcheck. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9e82415f Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9e82415f Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9e82415f Branch: refs/heads/master Commit: 9e82415fc2c40a628589f4053ad1103c5730bdb8 Parents: 49d00ff Author: Scott Harris <[email protected]> Authored: Mon Sep 9 13:36:22 2013 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Mon Sep 9 13:37:28 2013 -0600 ---------------------------------------------------------------------- CHANGES | 3 +++ plugins/experimental/healthchecks/README | 4 +++- plugins/experimental/healthchecks/healthchecks.c | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 878b55b..6734ed8 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,9 @@ Changes with Apache Traffic Server 4.1.0 *) [TS-2191] not reschedule http_sm when the sm_list`s lock is not acquired. + *) [TS-2188] Fixes to make healthcheck plugin not segfault, and parse + the log files properly. Author: Scott Harris <[email protected]>. + *) [TS-1086] Avoid edge case returning 304 to an unconditional request. Diagnosis and patch by Mohamad Khateeb. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/plugins/experimental/healthchecks/README ---------------------------------------------------------------------- diff --git a/plugins/experimental/healthchecks/README b/plugins/experimental/healthchecks/README index 920dbe7..ab156ac 100644 --- a/plugins/experimental/healthchecks/README +++ b/plugins/experimental/healthchecks/README @@ -6,8 +6,10 @@ This configuration contains one, or several, lines of the format <URI-path> <file-path> <mime> <file-exists-code> <file-missing-code> +The URI-path can *not* be "/" only. -For example, + +Examples: /__hc /var/run/ts-alive text/plain 200 403 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9e82415f/plugins/experimental/healthchecks/healthchecks.c ---------------------------------------------------------------------- diff --git a/plugins/experimental/healthchecks/healthchecks.c b/plugins/experimental/healthchecks/healthchecks.c index 47b4f7b..c7ae166 100644 --- a/plugins/experimental/healthchecks/healthchecks.c +++ b/plugins/experimental/healthchecks/healthchecks.c @@ -500,6 +500,10 @@ health_check_origin(TSCont contp ATS_UNUSED, TSEvent event ATS_UNUSED, void *eda int path_len = 0; const char* path = TSUrlPathGet(reqp, url_loc, &path_len); + /* Short circuit the / path, common case, and we won't allow healthecks on / */ + if (!path || !path_len) + goto cleanup; + while (info) { if (info->p_len == path_len && !memcmp(info->path, path, path_len)) { TSDebug(PLUGIN_NAME, "Found match for /%.*s", path_len, path);
