nghttpx: Enforce the fact that api and healthmon are mutually exclusive

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-21 22:44:26 +09:00
parent 4aa79763be
commit e2bdf1d734
2 changed files with 10 additions and 1 deletions

View File

@ -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.

View File

@ -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";