Updated Branches: refs/heads/master 275e254fc -> 36db28de2
TS-1988 cquuc and cquup can have no values When there is no remap phase, the unmapped URL does not get populated. This means that cquuc and cquup can have no value, so a "-" is logged. This happens, for example, with server intercept plugins that do not pass through a remap phase. This patch falls back on the original client URL in these situations. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/25598f2e Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/25598f2e Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/25598f2e Branch: refs/heads/master Commit: 25598f2e8e8bef8e60ab42e65143fc553f53c1f8 Parents: 275e254 Author: Leif Hedstrom <[email protected]> Authored: Thu Oct 10 15:49:40 2013 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Thu Oct 17 11:38:00 2013 -0600 ---------------------------------------------------------------------- proxy/logging/LogAccessHttp.cc | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/25598f2e/proxy/logging/LogAccessHttp.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index 7e72399..b2bfb58 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -313,13 +313,19 @@ LogAccessHttp::marshal_client_req_url_canon(char *buf) int LogAccessHttp::marshal_client_req_unmapped_url_canon(char *buf) { - - validate_unmapped_url(); - - int len = round_strlen(m_client_req_unmapped_url_canon_len + 1); // +1 for eos + int len = INK_MIN_ALIGN; if (buf) { - marshal_mem(buf, m_client_req_unmapped_url_canon_str, m_client_req_unmapped_url_canon_len, len); + validate_unmapped_url(); + if (0 == m_client_req_unmapped_url_canon_len) { + // If the unmapped URL isn't populated, we'll fall back to the original + // client URL. This helps for example server intercepts to continue to + // log the requests, even when there is no remap rule for it. + len = marshal_client_req_url_canon(buf); + } else { + len = round_strlen(m_client_req_unmapped_url_canon_len + 1); // +1 for eos + marshal_mem(buf, m_client_req_unmapped_url_canon_str, m_client_req_unmapped_url_canon_len, len); + } } return len; } @@ -330,15 +336,17 @@ LogAccessHttp::marshal_client_req_unmapped_url_canon(char *buf) int LogAccessHttp::marshal_client_req_unmapped_url_path(char *buf) { - int len; - - validate_unmapped_url(); - - validate_unmapped_url_path(); + int len = INK_MIN_ALIGN; - len = round_strlen(m_client_req_unmapped_url_path_len + 1); // +1 for eos if (buf) { - marshal_mem(buf, m_client_req_unmapped_url_path_str, m_client_req_unmapped_url_path_len, len); + validate_unmapped_url(); + validate_unmapped_url_path(); + if (0 == m_client_req_unmapped_url_path_len) { + len = marshal_client_req_url_path(buf); + } else { + len = round_strlen(m_client_req_unmapped_url_path_len + 1); // +1 for eos + marshal_mem(buf, m_client_req_unmapped_url_path_str, m_client_req_unmapped_url_path_len, len); + } } return len; } @@ -349,12 +357,13 @@ LogAccessHttp::marshal_client_req_unmapped_url_path(char *buf) int LogAccessHttp::marshal_client_req_unmapped_url_host(char *buf) { - validate_unmapped_url(); - validate_unmapped_url_path(); - - int len = round_strlen(m_client_req_unmapped_url_host_len + 1); // +1 for eos + int len = INK_MIN_ALIGN; if (buf) { + validate_unmapped_url(); + validate_unmapped_url_path(); + + len = round_strlen(m_client_req_unmapped_url_host_len + 1); // +1 for eos marshal_mem(buf, m_client_req_unmapped_url_host_str, m_client_req_unmapped_url_host_len, len); } return len;
