nghttpx: Use ImmutableString for private_key_file
This commit is contained in:
parent
529a59d309
commit
c999987baf
|
@ -2085,7 +2085,7 @@ void process_options(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!upstreamconf.no_tls &&
|
if (!upstreamconf.no_tls &&
|
||||||
(!tlsconf.private_key_file || !tlsconf.cert_file)) {
|
(tlsconf.private_key_file.empty() || !tlsconf.cert_file)) {
|
||||||
print_usage(std::cerr);
|
print_usage(std::cerr);
|
||||||
LOG(FATAL) << "Too few arguments";
|
LOG(FATAL) << "Too few arguments";
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -1745,7 +1745,7 @@ int parse_config(const char *opt, const char *optarg,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case SHRPX_OPTID_PRIVATE_KEY_FILE:
|
case SHRPX_OPTID_PRIVATE_KEY_FILE:
|
||||||
mod_config()->tls.private_key_file = strcopy(optarg);
|
mod_config()->tls.private_key_file = optarg;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE: {
|
case SHRPX_OPTID_PRIVATE_KEY_PASSWD_FILE: {
|
||||||
|
@ -1911,7 +1911,7 @@ int parse_config(const char *opt, const char *optarg,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case SHRPX_OPTID_CLIENT_PRIVATE_KEY_FILE:
|
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;
|
return 0;
|
||||||
case SHRPX_OPTID_CLIENT_CERT_FILE:
|
case SHRPX_OPTID_CLIENT_CERT_FILE:
|
||||||
|
|
|
@ -408,7 +408,7 @@ struct TLSConfig {
|
||||||
|
|
||||||
// Client private key and certificate used in backend connections.
|
// Client private key and certificate used in backend connections.
|
||||||
struct {
|
struct {
|
||||||
std::unique_ptr<char[]> private_key_file;
|
ImmutableString private_key_file;
|
||||||
std::unique_ptr<char[]> cert_file;
|
std::unique_ptr<char[]> cert_file;
|
||||||
} client;
|
} client;
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ struct TLSConfig {
|
||||||
long int tls_proto_mask;
|
long int tls_proto_mask;
|
||||||
std::string backend_sni_name;
|
std::string backend_sni_name;
|
||||||
std::chrono::seconds session_timeout;
|
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[]> private_key_passwd;
|
||||||
std::unique_ptr<char[]> cert_file;
|
std::unique_ptr<char[]> cert_file;
|
||||||
std::unique_ptr<char[]> dh_param_file;
|
std::unique_ptr<char[]> dh_param_file;
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ SSL_CTX *setup_server_ssl_context(std::vector<SSL_CTX *> &all_ssl_ctx,
|
||||||
|
|
||||||
auto &tlsconf = get_config()->tls;
|
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()
|
tlsconf.cert_file.get()
|
||||||
#ifdef HAVE_NEVERBLEED
|
#ifdef HAVE_NEVERBLEED
|
||||||
,
|
,
|
||||||
|
@ -1325,8 +1325,7 @@ SSL_CTX *setup_downstream_client_ssl_context(
|
||||||
#endif // HAVE_NEVERBLEED
|
#endif // HAVE_NEVERBLEED
|
||||||
StringRef{tlsconf.cacert},
|
StringRef{tlsconf.cacert},
|
||||||
StringRef::from_maybe_nullptr(tlsconf.client.cert_file.get()),
|
StringRef::from_maybe_nullptr(tlsconf.client.cert_file.get()),
|
||||||
StringRef::from_maybe_nullptr(tlsconf.client.private_key_file.get()),
|
StringRef{tlsconf.client.private_key_file}, alpn, next_proto_select_cb);
|
||||||
alpn, next_proto_select_cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CertLookupTree *create_cert_lookup_tree() {
|
CertLookupTree *create_cert_lookup_tree() {
|
||||||
|
|
Loading…
Reference in New Issue