From 1e5a599e45c9142e552799bf81ea076055f6dd64 Mon Sep 17 00:00:00 2001 From: Eric Schwartz Date: Tue, 8 Sep 2015 07:38:44 -0700 Subject: [PATCH] [TS-3648] Desire support for client TLS cipher in custom log format --- proxy/http/HttpSM.cc | 6 ++++-- proxy/logging/LogAccessHttp.cc | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index df369d8e0fb..6605b141f56 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -481,8 +481,10 @@ HttpSM::attach_client_session(HttpClientSession *client_vc, IOBufferReader *buff if (ssl_vc != NULL) { client_connection_is_ssl = true; client_ssl_reused = ssl_vc->getSSLSessionCacheHit(); - client_sec_protocol = ssl_vc->getSSLProtocol(); - client_cipher_suite = ssl_vc->getSSLCipherSuite(); + const char * protocol = ssl_vc->getSSLProtocol(); + client_sec_protocol = protocol ? protocol : "-"; + const char * cipher = ssl_vc->getSSLCipherSuite(); + client_cipher_suite = cipher ? cipher : "-"; } ink_release_assert(ua_session->get_half_close_flag() == false); diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index ba8b7dec542..8c7b525de3e 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -711,24 +711,26 @@ LogAccessHttp::marshal_client_finish_status_code(char *buf) int LogAccessHttp::marshal_client_security_protocol(char *buf) { - int round_len = INK_MIN_ALIGN; + const char *proto = m_http_sm->client_sec_protocol; + int round_len = LogAccess::strlen(proto); + if (buf) { - const char *proto = m_http_sm->client_sec_protocol; - round_len = LogAccess::strlen(proto); marshal_str(buf, proto, round_len); } + return round_len; } int LogAccessHttp::marshal_client_security_cipher_suite(char *buf) { - int round_len = INK_MIN_ALIGN; + const char *cipher = m_http_sm->client_cipher_suite; + int round_len = LogAccess::strlen(cipher); + if (buf) { - const char *cipher = m_http_sm->client_cipher_suite; - round_len = LogAccess::strlen(cipher); marshal_str(buf, cipher, round_len); } + return round_len; }