nghttpx: Reset config when Forwarded related option is used

This commit is contained in:
Tatsuhiro Tsujikawa 2016-01-16 11:53:18 +09:00
parent f72e496f96
commit 4c884da222
1 changed files with 5 additions and 0 deletions

View File

@ -2061,6 +2061,7 @@ int parse_config(const char *opt, const char *optarg,
return 0; return 0;
case SHRPX_OPTID_ADD_FORWARDED: case SHRPX_OPTID_ADD_FORWARDED:
mod_config()->forwarded_params = FORWARDED_NONE;
for (const auto &param : util::parse_config_str_list(optarg)) { for (const auto &param : util::parse_config_str_list(optarg)) {
if (util::strieq(param, "by")) { if (util::strieq(param, "by")) {
mod_config()->forwarded_params |= FORWARDED_BY; mod_config()->forwarded_params |= FORWARDED_BY;
@ -2105,6 +2106,8 @@ int parse_config(const char *opt, const char *optarg,
static_cast<shrpx_forwarded_node_type>(type); static_cast<shrpx_forwarded_node_type>(type);
if (optarg[0] == '_') { if (optarg[0] == '_') {
mod_config()->forwarded_by_obfuscated = optarg; mod_config()->forwarded_by_obfuscated = optarg;
} else {
mod_config()->forwarded_by_obfuscated = "";
} }
break; break;
case SHRPX_OPTID_FORWARDED_FOR: case SHRPX_OPTID_FORWARDED_FOR:
@ -2112,6 +2115,8 @@ int parse_config(const char *opt, const char *optarg,
static_cast<shrpx_forwarded_node_type>(type); static_cast<shrpx_forwarded_node_type>(type);
if (optarg[0] == '_') { if (optarg[0] == '_') {
mod_config()->forwarded_for_obfuscated = optarg; mod_config()->forwarded_for_obfuscated = optarg;
} else {
mod_config()->forwarded_for_obfuscated = "";
} }
break; break;
} }