From 2a0d0e798b9a1f06c036c339219020f3c0592c89 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 2 Jun 2016 22:39:04 +0900 Subject: [PATCH] nghttpx: Add api parameter to --frontend option to mark API endpoint --- src/shrpx_config.cc | 4 ++++ src/shrpx_config.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index b934466b..01ef486d 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -611,6 +611,7 @@ int parse_memcached_connection_params(MemcachedConnectionParams &out, struct UpstreamParams { bool tls; + bool api; }; namespace { @@ -627,6 +628,8 @@ int parse_upstream_params(UpstreamParams &out, const StringRef &src_params) { out.tls = true; } else if (util::strieq_l("no-tls", param)) { out.tls = false; + } else if (util::strieq_l("api", param)) { + out.api = true; } else if (!param.empty()) { LOG(ERROR) << "frontend: " << param << ": unknown keyword"; return -1; @@ -1832,6 +1835,7 @@ int parse_config(const StringRef &opt, const StringRef &optarg, UpstreamAddr addr{}; addr.fd = -1; addr.tls = params.tls; + addr.api = params.api; if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) { auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size(); diff --git a/src/shrpx_config.h b/src/shrpx_config.h index ad66fd1f..dfd5997a 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -321,6 +321,8 @@ struct UpstreamAddr { bool host_unix; // true if TLS is enabled. bool tls; + // true if this is an API endpoint. + bool api; int fd; };