From fc7489e044720818c041fb05dcde35c4abd2108b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 30 Sep 2018 12:30:19 +0900 Subject: [PATCH] nghttpx: Fix mruby parameter validation --- src/shrpx_config.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 9133ba0b..27f376a2 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -1056,12 +1056,14 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr, // If some backends do not specify mruby file, and there is at // least one backend with mruby file, it is used for all // backends in the group. - if (g.mruby_file.empty()) { - g.mruby_file = make_string_ref(downstreamconf.balloc, params.mruby); - } else if (g.mruby_file != params.mruby) { - LOG(ERROR) << "backend: mruby: multiple different mruby file found in " - "a single group"; - return -1; + if (!params.mruby.empty()) { + if (g.mruby_file.empty()) { + g.mruby_file = make_string_ref(downstreamconf.balloc, params.mruby); + } else if (g.mruby_file != params.mruby) { + LOG(ERROR) << "backend: mruby: multiple different mruby file found " + "in a single group"; + return -1; + } } g.addrs.push_back(addr);