Add SSLKEYLOGFILE support
This commit is contained in:
parent
35b6fddbcc
commit
d074d8c1de
|
@ -75,6 +75,15 @@ bool recorded(const std::chrono::steady_clock::time_point &t) {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
std::ofstream keylog_file;
|
||||||
|
void keylog_callback(const SSL *ssl, const char *line) {
|
||||||
|
keylog_file.write(line, strlen(line));
|
||||||
|
keylog_file.put('\n');
|
||||||
|
keylog_file.flush();
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
Config::Config()
|
Config::Config()
|
||||||
: ciphers(tls::DEFAULT_CIPHER_LIST),
|
: ciphers(tls::DEFAULT_CIPHER_LIST),
|
||||||
tls13_ciphers("TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_"
|
tls13_ciphers("TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_"
|
||||||
|
@ -2624,6 +2633,14 @@ int main(int argc, char **argv) {
|
||||||
SSL_CTX_set_alpn_protos(ssl_ctx, proto_list.data(), proto_list.size());
|
SSL_CTX_set_alpn_protos(ssl_ctx, proto_list.data(), proto_list.size());
|
||||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||||
|
|
||||||
|
auto keylog_filename = getenv("SSLKEYLOGFILE");
|
||||||
|
if (keylog_filename) {
|
||||||
|
keylog_file.open(keylog_filename, std::ios_base::app);
|
||||||
|
if (keylog_file) {
|
||||||
|
SSL_CTX_set_keylog_callback(ssl_ctx, keylog_callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string user_agent = "h2load nghttp2/" NGHTTP2_VERSION;
|
std::string user_agent = "h2load nghttp2/" NGHTTP2_VERSION;
|
||||||
Headers shared_nva;
|
Headers shared_nva;
|
||||||
shared_nva.emplace_back(":scheme", config.scheme);
|
shared_nva.emplace_back(":scheme", config.scheme);
|
||||||
|
|
Loading…
Reference in New Issue