Commit 8efccddc authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Use StringRef for HttpProxy

parent 97843e38
...@@ -2258,11 +2258,12 @@ int parse_config(Config *config, int optid, const StringRef &opt, ...@@ -2258,11 +2258,12 @@ int parse_config(Config *config, int optid, const StringRef &opt,
// Surprisingly, u.field_set & UF_USERINFO is nonzero even if // Surprisingly, u.field_set & UF_USERINFO is nonzero even if
// userinfo component is empty string. // userinfo component is empty string.
if (!uf.empty()) { 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) { 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 { } else {
LOG(ERROR) << opt << ": no hostname specified"; LOG(ERROR) << opt << ": no hostname specified";
return -1; return -1;
......
...@@ -439,9 +439,9 @@ struct TicketKeys { ...@@ -439,9 +439,9 @@ struct TicketKeys {
struct HttpProxy { struct HttpProxy {
Address addr; Address addr;
// host in http proxy URI // host in http proxy URI
std::string host; StringRef host;
// userinfo in http proxy URI, not percent-encoded form // userinfo in http proxy URI, not percent-encoded form
std::string userinfo; StringRef userinfo;
// port in http proxy URI // port in http proxy URI
uint16_t port; uint16_t port;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment