nghttpx: Fix bug that backend tls keyword did not work with -s option
This commit is contained in:
parent
c9aba4ea0c
commit
757bcf1310
14
src/shrpx.cc
14
src/shrpx.cc
|
@ -2088,6 +2088,8 @@ void process_options(int argc, char **argv,
|
|||
// non-catch-all patterns to catch-all pattern.
|
||||
DownstreamAddrGroupConfig catch_all(StringRef::from_lit("/"));
|
||||
auto proto = PROTO_NONE;
|
||||
auto tls = false;
|
||||
auto tls_seen = false;
|
||||
for (auto &g : addr_groups) {
|
||||
if (proto == PROTO_NONE) {
|
||||
proto = g.proto;
|
||||
|
@ -2097,10 +2099,22 @@ void process_options(int argc, char **argv,
|
|||
"be the same for all backends.";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!tls_seen) {
|
||||
tls = g.tls;
|
||||
tls_seen = true;
|
||||
} else if (tls != g.tls) {
|
||||
LOG(ERROR) << SHRPX_OPT_BACKEND
|
||||
<< ": <PATTERN> was ignored with --http2-proxy, and tls "
|
||||
"must be enabled or disabled for all backends.";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::move(std::begin(g.addrs), std::end(g.addrs),
|
||||
std::back_inserter(catch_all.addrs));
|
||||
}
|
||||
catch_all.proto = proto;
|
||||
catch_all.tls = tls;
|
||||
std::vector<DownstreamAddrGroupConfig>().swap(addr_groups);
|
||||
std::vector<WildcardPattern>().swap(mod_config()->wildcard_patterns);
|
||||
// maybe not necessary?
|
||||
|
|
|
@ -343,7 +343,9 @@ struct DownstreamAddrConfig {
|
|||
|
||||
struct DownstreamAddrGroupConfig {
|
||||
DownstreamAddrGroupConfig(const StringRef &pattern)
|
||||
: pattern(pattern.c_str(), pattern.size()), proto(PROTO_HTTP1) {}
|
||||
: pattern(pattern.c_str(), pattern.size()),
|
||||
proto(PROTO_HTTP1),
|
||||
tls(false) {}
|
||||
|
||||
ImmutableString pattern;
|
||||
std::vector<DownstreamAddrConfig> addrs;
|
||||
|
|
Loading…
Reference in New Issue