From e2bdf1d734e09489d0b60b15227bf74745bbd9d1 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 21 Jun 2016 22:44:26 +0900 Subject: [PATCH] nghttpx: Enforce the fact that api and healthmon are mutually exclusive --- src/shrpx.cc | 3 ++- src/shrpx_config.cc | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index ef95399c..716f393a 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1354,7 +1354,8 @@ Connections: multiple addresses. This option can take 0 or more parameters, which are - described below. + described below. Note that "api" and "healthmon" + parameters are mutually exclusive. Optionally, TLS can be disabled by specifying "no-tls" parameter. TLS is enabled by default. diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index dd5525d5..c36e5693 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -629,8 +629,16 @@ int parse_upstream_params(UpstreamParams &out, const StringRef &src_params) { } else if (util::strieq_l("no-tls", param)) { out.tls = false; } else if (util::strieq_l("api", param)) { + if (out.alt_mode && out.alt_mode != ALTMODE_API) { + LOG(ERROR) << "frontend: api and healthmon are mutually exclusive"; + return -1; + } out.alt_mode = ALTMODE_API; } else if (util::strieq_l("healthmon", param)) { + if (out.alt_mode && out.alt_mode != ALTMODE_HEALTHMON) { + LOG(ERROR) << "frontend: api and healthmon are mutually exclusive"; + return -1; + } out.alt_mode = ALTMODE_HEALTHMON; } else if (!param.empty()) { LOG(ERROR) << "frontend: " << param << ": unknown keyword";