diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 6ed55919..2bad2a8b 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -2258,11 +2258,12 @@ int parse_config(Config *config, int optid, const StringRef &opt, // Surprisingly, u.field_set & UF_USERINFO is nonzero even if // userinfo component is empty string. if (!uf.empty()) { - proxy.userinfo = util::percent_decode(std::begin(uf), std::end(uf)); + proxy.userinfo = util::percent_decode(config->balloc, uf); } } if (u.field_set & UF_HOST) { - http2::copy_url_component(proxy.host, &u, UF_HOST, optarg.c_str()); + proxy.host = make_string_ref( + config->balloc, util::get_uri_field(optarg.c_str(), u, UF_HOST)); } else { LOG(ERROR) << opt << ": no hostname specified"; return -1; diff --git a/src/shrpx_config.h b/src/shrpx_config.h index ff55a2a0..6aa8cab6 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -439,9 +439,9 @@ struct TicketKeys { struct HttpProxy { Address addr; // host in http proxy URI - std::string host; + StringRef host; // userinfo in http proxy URI, not percent-encoded form - std::string userinfo; + StringRef userinfo; // port in http proxy URI uint16_t port; };