nghttpx: Use StringRef for SHRPX_UNIX_PATH_PREFIX

This commit is contained in:
Tatsuhiro Tsujikawa 2016-03-25 01:00:04 +09:00
parent 7972593586
commit 848e45e333
2 changed files with 6 additions and 6 deletions

View File

@ -63,6 +63,8 @@ namespace {
Config *config = nullptr;
} // namespace
constexpr StringRef SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:");
const Config *get_config() { return config; }
Config *mod_config() { return config; }
@ -1749,8 +1751,8 @@ int parse_config(const StringRef &opt, const StringRef &optarg,
auto addr_end = std::find(std::begin(optarg), std::end(optarg), ';');
DownstreamAddrConfig addr{};
if (util::istarts_with_l(optarg, SHRPX_UNIX_PATH_PREFIX)) {
auto path = std::begin(optarg) + str_size(SHRPX_UNIX_PATH_PREFIX);
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size();
addr.host = ImmutableString(path, addr_end);
addr.host_unix = true;
} else {
@ -1793,8 +1795,8 @@ int parse_config(const StringRef &opt, const StringRef &optarg,
addr.fd = -1;
addr.tls = params.tls;
if (util::istarts_with_l(optarg, SHRPX_UNIX_PATH_PREFIX)) {
auto path = std::begin(optarg) + str_size(SHRPX_UNIX_PATH_PREFIX);
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size();
addr.host = ImmutableString{path, addr_end};
addr.host_unix = true;

View File

@ -69,8 +69,6 @@ class CertLookupTree;
} // namespace ssl
constexpr char SHRPX_UNIX_PATH_PREFIX[] = "unix:";
constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE =
StringRef::from_lit("private-key-file");
constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE =