nghttpx: Use StringRef for SHRPX_UNIX_PATH_PREFIX
This commit is contained in:
parent
7972593586
commit
848e45e333
|
@ -63,6 +63,8 @@ namespace {
|
||||||
Config *config = nullptr;
|
Config *config = nullptr;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
constexpr StringRef SHRPX_UNIX_PATH_PREFIX = StringRef::from_lit("unix:");
|
||||||
|
|
||||||
const Config *get_config() { return config; }
|
const Config *get_config() { return config; }
|
||||||
|
|
||||||
Config *mod_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), ';');
|
auto addr_end = std::find(std::begin(optarg), std::end(optarg), ';');
|
||||||
|
|
||||||
DownstreamAddrConfig addr{};
|
DownstreamAddrConfig addr{};
|
||||||
if (util::istarts_with_l(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
||||||
auto path = std::begin(optarg) + str_size(SHRPX_UNIX_PATH_PREFIX);
|
auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size();
|
||||||
addr.host = ImmutableString(path, addr_end);
|
addr.host = ImmutableString(path, addr_end);
|
||||||
addr.host_unix = true;
|
addr.host_unix = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1793,8 +1795,8 @@ int parse_config(const StringRef &opt, const StringRef &optarg,
|
||||||
addr.fd = -1;
|
addr.fd = -1;
|
||||||
addr.tls = params.tls;
|
addr.tls = params.tls;
|
||||||
|
|
||||||
if (util::istarts_with_l(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
if (util::istarts_with(optarg, SHRPX_UNIX_PATH_PREFIX)) {
|
||||||
auto path = std::begin(optarg) + str_size(SHRPX_UNIX_PATH_PREFIX);
|
auto path = std::begin(optarg) + SHRPX_UNIX_PATH_PREFIX.size();
|
||||||
addr.host = ImmutableString{path, addr_end};
|
addr.host = ImmutableString{path, addr_end};
|
||||||
addr.host_unix = true;
|
addr.host_unix = true;
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,6 @@ class CertLookupTree;
|
||||||
|
|
||||||
} // namespace ssl
|
} // namespace ssl
|
||||||
|
|
||||||
constexpr char SHRPX_UNIX_PATH_PREFIX[] = "unix:";
|
|
||||||
|
|
||||||
constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE =
|
constexpr auto SHRPX_OPT_PRIVATE_KEY_FILE =
|
||||||
StringRef::from_lit("private-key-file");
|
StringRef::from_lit("private-key-file");
|
||||||
constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE =
|
constexpr auto SHRPX_OPT_PRIVATE_KEY_PASSWD_FILE =
|
||||||
|
|
Loading…
Reference in New Issue