MCPcopy Create free account
hub / github.com/apache/trafficserver / loadFile

Method loadFile

src/iocore/net/SSLSecret.cc:87–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87std::string
88SSLSecret::loadFile(const std::string &name)
89{
90 Dbg(dbg_ctl_ssl_secret, "SSLSecret::loadFile(%s)", name.c_str());
91 std::error_code error;
92 std::string const data = swoc::file::load(swoc::file::path(name), error);
93 if (error) {
94 Dbg(dbg_ctl_ssl_secret_err, "SSLSecret::loadFile(%s) failed error code=%d message=%s", name.c_str(), error.value(),
95 error.message().c_str());
96 // Loading file failed
97 Dbg(dbg_ctl_ssl_secret, "Loading file: %s failed ", name.c_str());
98 return std::string{};
99 }
100 if (dbg_ctl_ssl_secret.on()) {
101 char hash_str[EVP_MAX_MD_SIZE * 2];
102 unsigned int hash_len;
103 get_hash_str(data, hash_str, &hash_len);
104 DbgPrint(dbg_ctl_ssl_secret, "Secret hash: %.*s", hash_len, hash_str);
105 DbgPrint(dbg_ctl_ssl_secret, "Secret data: %.50s", data.c_str());
106 }
107 if (SSLConfigParams::load_ssl_file_cb) {
108 SSLConfigParams::load_ssl_file_cb(name.c_str());
109 }
110 return data;
111}
112
113void
114SSLSecret::setSecret(const std::string &name, std::string_view data)

Callers

nothing calls this directly

Calls 7

pathClass · 0.85
get_hash_strFunction · 0.85
loadFunction · 0.50
c_strMethod · 0.45
valueMethod · 0.45
messageMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected