You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zy...@apache.org on 2012/03/07 09:25:15 UTC

git commit: TS-1002 log unmapped HOST when pristine_host_hdr disabled

Updated Branches:
  refs/heads/master 6a79f69f6 -> 8a06dc143


TS-1002 log unmapped HOST when pristine_host_hdr disabled

this will fix cquuc cquup, and introduce cquuh


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8a06dc14
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8a06dc14
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8a06dc14

Branch: refs/heads/master
Commit: 8a06dc143aa66e2da15993c9fe90e9c0f97846c4
Parents: 6a79f69
Author: Zhao Yongming <mi...@gmail.com>
Authored: Wed Mar 7 16:13:25 2012 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Wed Mar 7 16:20:49 2012 +0800

----------------------------------------------------------------------
 CHANGES                        |    3 ++
 proxy/logging/Log.cc           |    7 ++++++
 proxy/logging/LogAccess.cc     |    9 ++++++++
 proxy/logging/LogAccess.h      |    1 +
 proxy/logging/LogAccessHttp.cc |   37 +++++++++++++++++++++++++++-------
 proxy/logging/LogAccessHttp.h  |    3 ++
 6 files changed, 52 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 87691fa..4409811 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.3
+  *) [TS-1002] fix custom loggin with cquuc cquup, and introduce cquuh
+   to recode the client_req_unmapped_url_host.
+
   *) [TS-701] Remove mgmt/cli/script_configs.sh
 
   *) [TS-1124] Move regex_remap, header_filter and stats_over_http from

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 5d687f4..d779377 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -451,6 +451,13 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "cquup", field);
 
+  field = NEW(new LogField("client_req_unmapped_url_host", "cquuh",
+                           LogField::STRING,
+                           &LogAccess::marshal_client_req_unmapped_url_host,
+                           &LogAccess::unmarshal_str));
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "cquuh", field);
+
   field = NEW(new LogField("client_req_url_scheme", "cqus",
                            LogField::STRING,
                            &LogAccess::marshal_client_req_url_scheme,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/proxy/logging/LogAccess.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index d013a21..b8b521e 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -150,6 +150,15 @@ LogAccess::marshal_client_req_unmapped_url_path(char *buf)
   -------------------------------------------------------------------------*/
 
 int
+LogAccess::marshal_client_req_unmapped_url_host(char *buf)
+{
+  DEFAULT_STR_FIELD;
+}
+
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
+
+int
 LogAccess::marshal_client_req_url_path(char *buf)
 {
   DEFAULT_STR_FIELD;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/proxy/logging/LogAccess.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 5c0102f..1bff4bd 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -180,6 +180,7 @@ public:
   inkcoreapi virtual int marshal_client_req_url_canon(char *);  // STR
   inkcoreapi virtual int marshal_client_req_unmapped_url_canon(char *); // STR
   inkcoreapi virtual int marshal_client_req_unmapped_url_path(char *);  // STR
+  inkcoreapi virtual int marshal_client_req_unmapped_url_host(char *);  // STR
   inkcoreapi virtual int marshal_client_req_url_path(char *);   // STR
   inkcoreapi virtual int marshal_client_req_url_scheme(char *); // STR
   inkcoreapi virtual int marshal_client_req_http_version(char *);       // INT

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/proxy/logging/LogAccessHttp.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index a0e71c6..fc9ce26 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -53,6 +53,7 @@
 LogAccessHttp::LogAccessHttp(HttpSM * sm)
 :m_http_sm(sm), m_arena(), m_url(NULL), m_client_request(NULL), m_proxy_response(NULL), m_proxy_request(NULL), m_server_response(NULL), m_client_req_url_str(NULL), m_client_req_url_len(0), m_client_req_url_canon_str(NULL), m_client_req_url_canon_len(0), m_client_req_unmapped_url_canon_str(NULL), m_client_req_unmapped_url_canon_len(-1),      // undetermined
   m_client_req_unmapped_url_path_str(NULL), m_client_req_unmapped_url_path_len(-1),     // undetermined
+  m_client_req_unmapped_url_host_str(NULL), m_client_req_unmapped_url_host_len(-1),
   m_client_req_url_path_str(NULL),
 m_client_req_url_path_len(0), m_proxy_resp_content_type_str(NULL), m_proxy_resp_content_type_len(0)
 {
@@ -199,7 +200,7 @@ LogAccessHttp::validate_unmapped_url_path(void)
   int len;
   char *c;
 
-  if (m_client_req_unmapped_url_path_len < 0) {
+  if (m_client_req_unmapped_url_path_len < 0 && m_client_req_unmapped_url_host_len < 0) {
     // Use unmapped canonical URL as default
     m_client_req_unmapped_url_path_str = m_client_req_unmapped_url_canon_str;
     m_client_req_unmapped_url_path_len = m_client_req_unmapped_url_canon_len;
@@ -209,16 +210,16 @@ LogAccessHttp::validate_unmapped_url_path(void)
       if (c && (len = (int) (c - m_client_req_unmapped_url_path_str)) <= 4) {   // 4 - max schema size
         if (len + 2 <= m_client_req_unmapped_url_canon_len && c[1] == '/' && c[2] == '/') {
           len += 3;             // Skip "://"
-          m_client_req_unmapped_url_path_str = &m_client_req_unmapped_url_canon_str[len];
-          m_client_req_unmapped_url_path_len -= len;
+          m_client_req_unmapped_url_host_str = &m_client_req_unmapped_url_canon_str[len];
+          m_client_req_unmapped_url_host_len = m_client_req_unmapped_url_path_len - len;
           // Attempt to find first '/' in the path
-          if (m_client_req_unmapped_url_path_len > 0 &&
+          if (m_client_req_unmapped_url_host_len > 0 &&
               (c =
-               (char *) memchr((void *) m_client_req_unmapped_url_path_str, '/',
+               (char *) memchr((void *) m_client_req_unmapped_url_host_str, '/',
                                m_client_req_unmapped_url_path_len)) != 0) {
-            len = (int) (c - m_client_req_unmapped_url_path_str) + 1;
-            m_client_req_unmapped_url_path_str = &m_client_req_unmapped_url_path_str[len];
-            m_client_req_unmapped_url_path_len -= len;
+            m_client_req_unmapped_url_host_len = (int) (c - m_client_req_unmapped_url_host_str);
+            m_client_req_unmapped_url_path_str = &m_client_req_unmapped_url_host_str[m_client_req_unmapped_url_host_len];
+            m_client_req_unmapped_url_path_len = m_client_req_unmapped_url_path_len - len - m_client_req_unmapped_url_host_len;
           }
         }
       }
@@ -226,6 +227,7 @@ LogAccessHttp::validate_unmapped_url_path(void)
   }
 }
 
+
 /*-------------------------------------------------------------------------
   This is the method, url, and version all rolled into one.  Use the
   respective marshalling routines to do the job.
@@ -339,6 +341,25 @@ LogAccessHttp::marshal_client_req_unmapped_url_path(char *buf)
   return len;
 }
 
+/*-------------------------------------------------------------------------
+  -------------------------------------------------------------------------*/
+
+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
+
+  if (buf) {
+    marshal_mem(buf, m_client_req_unmapped_url_host_str, m_client_req_unmapped_url_host_len, len);
+  }
+  return len;
+}
+
 int
 LogAccessHttp::marshal_client_req_url_path(char *buf)
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8a06dc14/proxy/logging/LogAccessHttp.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
index ae36b11..952622a 100644
--- a/proxy/logging/LogAccessHttp.h
+++ b/proxy/logging/LogAccessHttp.h
@@ -64,6 +64,7 @@ public:
   virtual int marshal_client_req_url_canon(char *);     // STR
   virtual int marshal_client_req_unmapped_url_canon(char *);    // STR
   virtual int marshal_client_req_unmapped_url_path(char *);     // STR
+  virtual int marshal_client_req_unmapped_url_host(char *);     // STR
   virtual int marshal_client_req_url_path(char *);      // STR
   virtual int marshal_client_req_url_scheme(char *);    // STR
   virtual int marshal_client_req_http_version(char *);  // INT
@@ -144,6 +145,8 @@ private:
   int m_client_req_unmapped_url_canon_len;
   char *m_client_req_unmapped_url_path_str;
   int m_client_req_unmapped_url_path_len;
+  char *m_client_req_unmapped_url_host_str;
+  int m_client_req_unmapped_url_host_len;
   char *m_client_req_url_path_str;
   int m_client_req_url_path_len;
   char *m_proxy_resp_content_type_str;