nghttpx: Add api parameter to --frontend option to mark API endpoint

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-02 22:39:04 +09:00
parent 8b6947eda5
commit 2a0d0e798b
2 changed files with 6 additions and 0 deletions

View File

@ -611,6 +611,7 @@ int parse_memcached_connection_params(MemcachedConnectionParams &out,
struct UpstreamParams { struct UpstreamParams {
bool tls; bool tls;
bool api;
}; };
namespace { namespace {
@ -627,6 +628,8 @@ int parse_upstream_params(UpstreamParams &out, const StringRef &src_params) {
out.tls = true; out.tls = true;
} else if (util::strieq_l("no-tls", param)) { } else if (util::strieq_l("no-tls", param)) {
out.tls = false; out.tls = false;
} else if (util::strieq_l("api", param)) {
out.api = true;
} else if (!param.empty()) { } else if (!param.empty()) {
LOG(ERROR) << "frontend: " << param << ": unknown keyword"; LOG(ERROR) << "frontend: " << param << ": unknown keyword";
return -1; return -1;
@ -1832,6 +1835,7 @@ int parse_config(const StringRef &opt, const StringRef &optarg,
UpstreamAddr addr{}; UpstreamAddr addr{};
addr.fd = -1; addr.fd = -1;
addr.tls = params.tls; addr.tls = params.tls;
addr.api = params.api;
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) { if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size(); auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size();

View File

@ -321,6 +321,8 @@ struct UpstreamAddr {
bool host_unix; bool host_unix;
// true if TLS is enabled. // true if TLS is enabled.
bool tls; bool tls;
// true if this is an API endpoint.
bool api;
int fd; int fd;
}; };