From 660bc389e6f8276fe0b508f890f3e3ce4567fbd5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 14 Feb 2016 21:01:54 +0900 Subject: [PATCH] nghttpx: Use ImmutableString for fetch_ocsp_response_file --- src/shrpx.cc | 11 +++++------ src/shrpx_config.cc | 2 +- src/shrpx_config.h | 2 +- src/shrpx_connection_handler.cc | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/shrpx.cc b/src/shrpx.cc index 33272f97..44c4094e 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1067,8 +1067,7 @@ void fill_default_config() { auto &ocspconf = tlsconf.ocsp; // ocsp update interval = 14400 secs = 4 hours, borrowed from h2o ocspconf.update_interval = 4_h; - ocspconf.fetch_ocsp_response_file = - strcopy(PKGDATADIR "/fetch-ocsp-response"); + ocspconf.fetch_ocsp_response_file = PKGDATADIR "/fetch-ocsp-response"; } { @@ -1579,8 +1578,8 @@ SSL/TLS: --fetch-ocsp-response-file= Path to fetch-ocsp-response script file. It should be absolute path. - Default: )" - << get_config()->tls.ocsp.fetch_ocsp_response_file.get() << R"( + Default: )" << get_config()->tls.ocsp.fetch_ocsp_response_file + << R"( --ocsp-update-interval= Set interval to update OCSP response cache. Default: )" @@ -2094,10 +2093,10 @@ void process_options( if (!upstreamconf.no_tls && !tlsconf.ocsp.disabled) { struct stat buf; - if (stat(tlsconf.ocsp.fetch_ocsp_response_file.get(), &buf) != 0) { + if (stat(tlsconf.ocsp.fetch_ocsp_response_file.c_str(), &buf) != 0) { tlsconf.ocsp.disabled = true; LOG(WARN) << "--fetch-ocsp-response-file: " - << tlsconf.ocsp.fetch_ocsp_response_file.get() + << tlsconf.ocsp.fetch_ocsp_response_file << " not found. OCSP stapling has been disabled."; } } diff --git a/src/shrpx_config.cc b/src/shrpx_config.cc index 20d30c86..6afcc47b 100644 --- a/src/shrpx_config.cc +++ b/src/shrpx_config.cc @@ -2086,7 +2086,7 @@ int parse_config(const char *opt, const char *optarg, return parse_uint(&mod_config()->http2.downstream.connections_per_worker, opt, optarg); case SHRPX_OPTID_FETCH_OCSP_RESPONSE_FILE: - mod_config()->tls.ocsp.fetch_ocsp_response_file = strcopy(optarg); + mod_config()->tls.ocsp.fetch_ocsp_response_file = optarg; return 0; case SHRPX_OPTID_OCSP_UPDATE_INTERVAL: diff --git a/src/shrpx_config.h b/src/shrpx_config.h index e5a21241..d290a37a 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -394,7 +394,7 @@ struct TLSConfig { // OCSP realted configurations struct { ev_tstamp update_interval; - std::unique_ptr fetch_ocsp_response_file; + ImmutableString fetch_ocsp_response_file; bool disabled; } ocsp; diff --git a/src/shrpx_connection_handler.cc b/src/shrpx_connection_handler.cc index 588e814b..8dea4f38 100644 --- a/src/shrpx_connection_handler.cc +++ b/src/shrpx_connection_handler.cc @@ -463,7 +463,8 @@ int ConnectionHandler::start_ocsp_update(const char *cert_file) { assert(!ev_is_active(&ocsp_.chldev)); char *const argv[] = { - const_cast(get_config()->tls.ocsp.fetch_ocsp_response_file.get()), + const_cast( + get_config()->tls.ocsp.fetch_ocsp_response_file.c_str()), const_cast(cert_file), nullptr}; char *const envp[] = {nullptr};