nghttpx: Use ImmutableString for private_key_file

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-14 21:13:46 +09:00
parent 529a59d309
commit c999987baf
4 changed files with 7 additions and 8 deletions

View File

@ -2085,7 +2085,7 @@ void process_options(
}
if (!upstreamconf.no_tls &&
(!tlsconf.private_key_file || !tlsconf.cert_file)) {
(tlsconf.private_key_file.empty() || !tlsconf.cert_file)) {
print_usage(std::cerr);
LOG(FATAL) << "Too few arguments";
exit(EXIT_FAILURE);

View File

@ -1745,7 +1745,7 @@ int parse_config(const char *opt, const char *optarg,
return 0;
}
case SHRPX_OPTID_PRIVATE_KEY_FILE:
mod_config()->tls.private_key_file = strcopy(optarg);
mod_config()->tls.private_key_file = optarg;
return 0;
case SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE: {
@ -1911,7 +1911,7 @@ int parse_config(const char *opt, const char *optarg,
return 0;
case SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE:
mod_config()->tls.client.private_key_file = strcopy(optarg);
mod_config()->tls.client.private_key_file = optarg;
return 0;
case SHRPX_OPTID_CLIENT_CERT_FILE:

View File

@ -408,7 +408,7 @@ struct TLSConfig {
// Client private key and certificate used in backend connections.
struct {
std::unique_ptr<char[]> private_key_file;
ImmutableString private_key_file;
std::unique_ptr<char[]> cert_file;
} client;
@ -426,7 +426,7 @@ struct TLSConfig {
long int tls_proto_mask;
std::string backend_sni_name;
std::chrono::seconds session_timeout;
std::unique_ptr<char[]> private_key_file;
ImmutableString private_key_file;
std::unique_ptr<char[]> private_key_passwd;
std::unique_ptr<char[]> cert_file;
std::unique_ptr<char[]> dh_param_file;

View File

@ -1245,7 +1245,7 @@ SSL_CTX *setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
auto &tlsconf = get_config()->tls;
auto ssl_ctx = ssl::create_ssl_context(tlsconf.private_key_file.get(),
auto ssl_ctx = ssl::create_ssl_context(tlsconf.private_key_file.c_str(),
tlsconf.cert_file.get()
#ifdef HAVE_NEVERBLEED
,
@ -1325,8 +1325,7 @@ SSL_CTX *setup_downstream_client_ssl_context(
#endif // HAVE_NEVERBLEED
StringRef{tlsconf.cacert},
StringRef::from_maybe_nullptr(tlsconf.client.cert_file.get()),
StringRef::from_maybe_nullptr(tlsconf.client.private_key_file.get()),
alpn, next_proto_select_cb);
StringRef{tlsconf.client.private_key_file}, alpn, next_proto_select_cb);
}
CertLookupTree *create_cert_lookup_tree() {