nghttpx: Use StringRef for tls.ticket.files

This commit is contained in:
Tatsuhiro Tsujikawa 2016-10-02 22:08:51 +09:00
parent c4368a9416
commit 1037d3ad26
3 changed files with 8 additions and 8 deletions

View File

@ -151,7 +151,7 @@ bool is_secure(const StringRef &filename) {
} // namespace
std::unique_ptr<TicketKeys>
read_tls_ticket_key_file(const std::vector<std::string> &files,
read_tls_ticket_key_file(const std::vector<StringRef> &files,
const EVP_CIPHER *cipher, const EVP_MD *hmac) {
auto ticket_keys = make_unique<TicketKeys>();
auto &keys = ticket_keys->keys;
@ -2451,7 +2451,7 @@ int parse_config(Config *config, int optid, const StringRef &opt,
case SHRPX_OPTID_LISTENER_DISABLE_TIMEOUT:
return parse_duration(&config->conn.listener.timeout.sleep, opt, optarg);
case SHRPX_OPTID_TLS_TICKET_KEY_FILE:
config->tls.ticket.files.push_back(optarg.str());
config->tls.ticket.files.push_back(make_string_ref(config->balloc, optarg));
return 0;
case SHRPX_OPTID_RLIMIT_NOFILE: {
int n;

View File

@ -470,7 +470,7 @@ struct TLSConfig {
int family;
bool tls;
} memcached;
std::vector<std::string> files;
std::vector<StringRef> files;
const EVP_CIPHER *cipher;
// true if --tls-ticket-key-cipher is used
bool cipher_given;
@ -1006,7 +1006,7 @@ FILE *open_file_for_write(const char *filename);
// expected file size. This function returns TicketKey if it
// succeeds, or nullptr.
std::unique_ptr<TicketKeys>
read_tls_ticket_key_file(const std::vector<std::string> &files,
read_tls_ticket_key_file(const std::vector<StringRef> &files,
const EVP_CIPHER *cipher, const EVP_MD *hmac);
// Returns string representation of |proto|.

View File

@ -173,8 +173,8 @@ void test_shrpx_config_read_tls_ticket_key_file(void) {
close(fd1);
close(fd2);
auto ticket_keys =
read_tls_ticket_key_file({file1, file2}, EVP_aes_128_cbc(), EVP_sha256());
auto ticket_keys = read_tls_ticket_key_file(
{StringRef{file1}, StringRef{file2}}, EVP_aes_128_cbc(), EVP_sha256());
unlink(file1);
unlink(file2);
CU_ASSERT(ticket_keys.get() != nullptr);
@ -216,8 +216,8 @@ void test_shrpx_config_read_tls_ticket_key_file_aes_256(void) {
close(fd1);
close(fd2);
auto ticket_keys =
read_tls_ticket_key_file({file1, file2}, EVP_aes_256_cbc(), EVP_sha256());
auto ticket_keys = read_tls_ticket_key_file(
{StringRef{file1}, StringRef{file2}}, EVP_aes_256_cbc(), EVP_sha256());
unlink(file1);
unlink(file2);
CU_ASSERT(ticket_keys.get() != nullptr);