nghttpx: Use StringRef for HttpProxy

This commit is contained in:
Tatsuhiro Tsujikawa 2016-10-02 22:27:40 +09:00
parent 97843e3874
commit 8efccddcf4
2 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}; };