nghttpx: Add $ssl_session_reused log variable
The syntax for this variable is the same as nginx: if SSL/TLS session was reused, "r" is produced. Otherwise ".".
This commit is contained in:
parent
197493afd4
commit
515c313073
|
@ -1348,6 +1348,8 @@ Logging:
|
|||
* $ssl_cipher: cipher used for SSL/TLS connection.
|
||||
* $ssl_protocol: protocol for SSL/TLS connection.
|
||||
* $ssl_session_id: session ID for SSL/TLS connection.
|
||||
* $ssl_session_reused: "r" if SSL/TLS session was
|
||||
reused. Otherwise, "."
|
||||
|
||||
Default: )" << DEFAULT_ACCESSLOG_FORMAT << R"(
|
||||
--errorlog-file=<PATH>
|
||||
|
|
|
@ -389,6 +389,8 @@ std::vector<LogFragment> parse_log_format(const char *optarg) {
|
|||
type = SHRPX_LOGF_SSL_PROTOCOL;
|
||||
} else if (util::strieq_l("$ssl_session_id", var_start, varlen)) {
|
||||
type = SHRPX_LOGF_SSL_SESSION_ID;
|
||||
} else if (util::strieq_l("$ssl_session_reused", var_start, varlen)) {
|
||||
type = SHRPX_LOGF_SSL_SESSION_REUSED;
|
||||
} else {
|
||||
LOG(WARN) << "Unrecognized log format variable: "
|
||||
<< std::string(var_start, varlen);
|
||||
|
|
|
@ -294,6 +294,14 @@ void upstream_accesslog(const std::vector<LogFragment> &lfv,
|
|||
copy_hex_low(lgsp.tls_info->session_id,
|
||||
lgsp.tls_info->session_id_length, avail, p);
|
||||
break;
|
||||
case SHRPX_LOGF_SSL_SESSION_REUSED:
|
||||
if (!lgsp.tls_info) {
|
||||
std::tie(p, avail) = copy("-", avail, p);
|
||||
break;
|
||||
}
|
||||
std::tie(p, avail) =
|
||||
copy(lgsp.tls_info->session_reused ? "r" : ".", avail, p);
|
||||
break;
|
||||
case SHRPX_LOGF_NONE:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -119,6 +119,7 @@ enum LogFragmentType {
|
|||
SHRPX_LOGF_SSL_CIPHER,
|
||||
SHRPX_LOGF_SSL_PROTOCOL,
|
||||
SHRPX_LOGF_SSL_SESSION_ID,
|
||||
SHRPX_LOGF_SSL_SESSION_REUSED,
|
||||
};
|
||||
|
||||
struct LogFragment {
|
||||
|
|
|
@ -114,6 +114,7 @@ TLSSessionInfo *get_tls_session_info(TLSSessionInfo *tls_info, SSL *ssl) {
|
|||
tls_info->protocol = get_tls_protocol(ssl);
|
||||
tls_info->session_id = session->session_id;
|
||||
tls_info->session_id_length = session->session_id_length;
|
||||
tls_info->session_reused = SSL_session_reused(ssl);
|
||||
|
||||
return tls_info;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue