From 8efccddcf452b9f8c1bd6816c1d44e2b38fef66c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 2 Oct 2016 22:27:40 +0900 Subject: [PATCH] nghttpx: Use StringRef for HttpProxy --- src/shrpx_config.cc | 5 +++-- src/shrpx_config.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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; };