diff --git a/src/shrpx.cc b/src/shrpx.cc index 4a2103fa..356d9c0f 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -1039,7 +1039,7 @@ void fill_default_config() { namespace { void print_version(std::ostream &out) { - out << get_config()->server_name << std::endl; + out << get_config()->server_name.c_str() << std::endl; } } // namespace diff --git a/src/shrpx_config.h b/src/shrpx_config.h index bc9c774f..39197676 100644 --- a/src/shrpx_config.h +++ b/src/shrpx_config.h @@ -311,6 +311,7 @@ struct Config { // string is provided. std::string forwarded_for_obfuscated; std::string backend_tls_sni_name; + StringAdaptor server_name; std::chrono::seconds tls_session_timeout; ev_tstamp http2_upstream_read_timeout; ev_tstamp upstream_read_timeout; @@ -363,7 +364,6 @@ struct Config { nghttp2_option *http2_option; nghttp2_option *http2_client_option; const EVP_CIPHER *tls_ticket_key_cipher; - const char *server_name; char **original_argv; char **argv; char *cwd; diff --git a/src/shrpx_http.cc b/src/shrpx_http.cc index 8407f10d..79524fe9 100644 --- a/src/shrpx_http.cc +++ b/src/shrpx_http.cc @@ -44,7 +44,8 @@ std::string create_error_html(unsigned int status_code) { res += "