You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/12/14 22:51:10 UTC

[01/50] git commit: TS-2401: Remove unused TS_BUILD_SYSCONFIGDIR

Updated Branches:
  refs/heads/5.0.x c63666b13 -> 93e7027b4


TS-2401: Remove unused TS_BUILD_SYSCONFIGDIR


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

Branch: refs/heads/5.0.x
Commit: bdd7af5dcfcff16ebb07d62c9bdac2de5cf8a3bf
Parents: fa100cf
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 15:13:04 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:48 2013 -0800

----------------------------------------------------------------------
 lib/ts/ink_config.h.in | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bdd7af5d/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index ee1e029..0b69098 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -110,7 +110,6 @@
 #define TS_BUILD_BINDIR "@rel_bindir@"
 #define TS_BUILD_SBINDIR "@rel_sbindir@"
 #define TS_BUILD_SYSCONFDIR "@rel_sysconfdir@"
-#define TS_BUILD_SYSCONFIGDIR "@exp_sysconfdir@"
 #define TS_BUILD_DATADIR "@rel_datadir@"
 #define TS_BUILD_INCLUDEDIR "@rel_includedir@"
 #define TS_BUILD_LIBDIR "@rel_libdir@"


[38/50] git commit: TS-2426: add xdebug plugin Makefile.am

Posted by zw...@apache.org.
TS-2426: add xdebug plugin Makefile.am


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

Branch: refs/heads/5.0.x
Commit: 5cce7365fff855589a5107333871b213d3784ec4
Parents: 399e27c
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 10:07:07 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 10:07:07 2013 -0800

----------------------------------------------------------------------
 plugins/experimental/xdebug/Makefile.am | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5cce7365/plugins/experimental/xdebug/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/xdebug/Makefile.am b/plugins/experimental/xdebug/Makefile.am
new file mode 100644
index 0000000..452c210
--- /dev/null
+++ b/plugins/experimental/xdebug/Makefile.am
@@ -0,0 +1,22 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+include $(top_srcdir)/build/plugins.mk
+
+pkglib_LTLIBRARIES = xdebug.la
+xdebug_la_SOURCES = xdebug.cc
+xdebug_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
+


[28/50] git commit: Bump sphinx docs version to match autoconf

Posted by zw...@apache.org.
Bump sphinx docs version to match autoconf


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

Branch: refs/heads/5.0.x
Commit: b57a80952416ba7edba13d03b402e77c53733515
Parents: a2de1c0
Author: James Peach <jp...@apache.org>
Authored: Sat Dec 7 20:32:56 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Sat Dec 7 20:32:56 2013 -0800

----------------------------------------------------------------------
 doc/conf.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b57a8095/doc/conf.py
----------------------------------------------------------------------
diff --git a/doc/conf.py b/doc/conf.py
index 6b19426..43c8f1b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -69,9 +69,9 @@ copyright = u'2013, dev@trafficserver.apache.org'
 # update a reasonable version number here.
 #
 # The short X.Y version.
-version = '4.1'
+version = '4.2'
 # The full version, including alpha/beta/rc tags.
-release = '4.1.x'
+release = '4.2.x'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


[07/50] git commit: TS-2401: Remove system_config_directory

Posted by zw...@apache.org.
TS-2401: Remove system_config_directory

Remove all the places the global system_config_directory is used,
replacing it with Layout::get()->sysconfdir where appropriate.


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

Branch: refs/heads/5.0.x
Commit: 67306a71da65f135ff85c2f4d9b966122fa5590a
Parents: f438ab4
Author: James Peach <jp...@apache.org>
Authored: Mon Dec 2 14:48:49 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 example/app-template/app-template.cc |  7 ---
 lib/records/I_RecCore.h              | 11 +++-
 lib/records/I_RecDefs.h              |  3 -
 lib/records/RecCore.cc               | 34 ++++++++++++
 mgmt/FileManager.cc                  | 92 +++++--------------------------
 mgmt/FileManager.h                   |  1 -
 mgmt/LocalManager.cc                 | 18 ++----
 mgmt/LocalManager.h                  |  4 +-
 mgmt/Main.cc                         | 18 ++----
 mgmt/Main.h                          |  1 -
 mgmt/Rollback.cc                     | 34 +++---------
 mgmt/Rollback.h                      |  1 -
 mgmt/cluster/VMap.cc                 | 13 ++---
 mgmt/web2/WebIntrMain.cc             |  4 +-
 proxy/ControlMatcher.cc              | 13 ++---
 proxy/ControlMatcher.h               |  5 +-
 proxy/ICPConfig.cc                   | 13 ++---
 proxy/IPAllow.cc                     | 13 ++---
 proxy/IPAllow.h                      |  1 -
 proxy/InkAPI.cc                      |  3 +-
 proxy/Main.cc                        | 35 +++---------
 proxy/Plugin.cc                      | 32 +----------
 proxy/Plugin.h                       |  3 +-
 proxy/Prefetch.cc                    | 15 ++---
 proxy/Update.cc                      | 10 ++--
 proxy/http/HttpBodyFactory.cc        | 27 ++++-----
 proxy/http/HttpBodyFactory.h         |  1 -
 proxy/logging/LogConfig.cc           | 30 ++++------
 proxy/logging/LogStandalone.cc       |  4 --
 proxy/sac.cc                         |  8 +--
 30 files changed, 151 insertions(+), 303 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index af23b2b..234bf77 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -53,8 +53,6 @@ int system_num_of_processors  = ink_number_of_processors();
 int system_num_of_net_threads = DEFAULT_NUMBER_OF_THREADS;
 int system_num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
 
-char system_config_directory[PATH_NAME_MAX + 1];
-
 //int system_remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
 //Diags *diags = NULL;
@@ -154,9 +152,6 @@ int main(int argc, char * argv[])
     _exit(0);
   }
 
-  // Get TS directories
-  ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory));
-
   if (chdir(Layout::get()->prefix) < 0) {
     fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno));
     fprintf(stderr," please set correct path in env variable TS_ROOT \n");
@@ -226,8 +221,6 @@ int main(int argc, char * argv[])
   // initialize logging (after event and net processor)
   //Log::init(system_remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT);
 
-  //plugin_init(system_config_directory); // plugin.config
-
   // Create accept continuation
   MyAccept *a = new MyAccept;
   a->accept_port = tsapp_port;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index 86f6595..44b0922 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -46,9 +46,18 @@ void RecConfigFileInit(void);
 int RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_version);
 
 // Return a copy of the system's local state directory, taking proxy.config.local_state_dir into account. The
-// caller MUST releease the result with ats_free().
+// caller MUST release the result with ats_free().
 char * RecConfigReadRuntimeDir();
 
+// Return a copy of the system's snapshot directory, taking proxy.config.snapshot_dir into account. The caller
+// MUST release the result with ats_free().
+char * RecConfigReadSnapshotDir();
+
+// Return a copy of a configuration file that is relative to sysconfdir. The relative path to the configuration
+// file is specified in the configuration variable named by "file_variable". If the configuration variable has no
+// value, NULL is returned. The caller MUST release the result with ats_free().
+char * RecConfigReadConfigPath(const char * file_variable);
+
 // Test whether the named configuration value is overridden by an environment variable. Return either
 // the overridden value, or the original value. Caller MUST NOT free the result.
 const char * RecConfigOverrideFromEnvironment(const char * name, const char * value);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index 928a5ac..5a9c121 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -175,7 +175,4 @@ typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData *
 #define REC_VAR_NAME_DELIMITOR '.'
 #define REC_VAR_NAME_WILDCARD  '*'
 
-// System Defaults
-extern char system_config_directory[PATH_NAME_MAX + 1];
-
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 50485fa..d76cb90 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1071,6 +1071,40 @@ RecConfigReadRuntimeDir()
 }
 
 //-------------------------------------------------------------------------
+// RecConfigReadSnapshotDir.
+//-------------------------------------------------------------------------
+char *
+RecConfigReadSnapshotDir()
+{
+  char buf[PATH_NAME_MAX + 1];
+
+  buf[0] = '\0';
+  RecGetRecordString("proxy.config.snapshot_dir", buf, PATH_NAME_MAX);
+  if (strlen(buf) > 0) {
+    return Layout::get()->relative_to(Layout::get()->sysconfdir, buf);
+  } else {
+    return Layout::get()->relative_to(Layout::get()->sysconfdir, "snapshots");
+  }
+}
+
+//-------------------------------------------------------------------------
+// RecConfigReadConfigPath
+//-------------------------------------------------------------------------
+char *
+RecConfigReadConfigPath(const char * file_variable)
+{
+  char buf[PATH_NAME_MAX + 1];
+
+  buf[0] = '\0';
+  RecGetRecordString(file_variable, buf, PATH_NAME_MAX);
+  if (strlen(buf) > 0) {
+    return Layout::get()->relative_to(Layout::get()->sysconfdir, buf);
+  }
+
+  return NULL;
+}
+
+//-------------------------------------------------------------------------
 // REC_SignalManager (TS)
 //-------------------------------------------------------------------------
 #if defined (REC_BUILD_MGMT)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/FileManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/FileManager.cc b/mgmt/FileManager.cc
index 33cafe7..8480ede 100644
--- a/mgmt/FileManager.cc
+++ b/mgmt/FileManager.cc
@@ -32,10 +32,6 @@
 #include "ExpandingArray.h"
 #include "MgmtSocket.h"
 
-
-
-static const char snapDir[] = "snapshots";
-
 #define DIR_MODE S_IRWXU
 #define FILE_MODE S_IRWXU
 
@@ -56,51 +52,24 @@ const char *SnapshotStrings[] = { "Request Successful\n",
 
 FileManager::FileManager()
 {
-  char configTmp[PATH_NAME_MAX + 1];
-  int pathLen;
-
   bindings = ink_hash_table_create(InkHashTableKeyType_String);
-
   ink_assert(bindings != NULL);
 
   ink_mutex_init(&accessLock, "File Manager Mutex");
   ink_mutex_init(&cbListLock, "File Changed Callback Mutex");
 
-  if (varStrFromName("proxy.config.config_dir", configTmp, sizeof(configTmp)) == false) {
-    mgmt_fatal(stderr, 0,
-               "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n");
-  }
-  if (configTmp[0] != '/') {
-    // Make it TS_ROOT relative
-    Layout::get()->relative(configTmp, sizeof(configTmp), configTmp);
-  }
-  if (access(configTmp, R_OK) == -1) {
-    ink_strlcpy(configTmp, system_config_directory,sizeof(configTmp));
-    if (access(configTmp, R_OK) == -1) {
-        mgmt_elog(0, "[FileManager::FileManager] unable to access() directory '%s': %d, %s\n",
-                mgmt_path, errno, strerror(errno));
-        mgmt_elog(0, "[FileManager::FileManager] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
-        _exit(1);
-    }
-  }
-  // Set up the path to the snap shot dir
-  pathLen = strlen(configTmp) + strlen(snapDir) + 3;
-  const size_t snapshotDir_size = pathLen + 1;
-  snapshotDir = new char[snapshotDir_size];
-  ink_filepath_make(snapshotDir, snapshotDir_size, configTmp, snapDir);
-
-  // Set up info for MultiFile
-  managedDir = snapshotDir;
-  dirDescript = "snapshot";
-
-  // Check to see if the directory already exists, if not create
-  //  it
+  xptr<char> snapshotDir(RecConfigReadSnapshotDir());
+
+  // Check to see if the directory already exists, if not create it.
   if (access(snapshotDir, F_OK) == -1) {
     if (mkdir(snapshotDir, DIR_MODE) < 0) {
       // Failed to create the snapshot directory
-      mgmt_fatal(stderr, 0, "[FileManager::FileManager] Failed to create the snapshot directory %s: %s\n", snapshotDir, strerror(errno));
+      mgmt_fatal(stderr, 0, "[FileManager::FileManager] Failed to create the snapshot directory %s: %s\n", (const char *)snapshotDir, strerror(errno));
     }
   }
+
+  this->managedDir = snapshotDir.release();
+  this->dirDescript = "snapshot";
 }
 
 // FileManager::~FileManager
@@ -117,11 +86,12 @@ FileManager::~FileManager()
   InkHashTableEntry *entry;
   InkHashTableIteratorState iterator_state;
 
-  // Let other operations finish and do not start any
-  //   new ones
+  // Let other operations finish and do not start any new ones
   ink_mutex_acquire(&accessLock);
 
-  delete[]snapshotDir;
+  ats_free(this->managedDir);
+  this->managedDir = NULL;
+  this->dirDescript = NULL;
 
   for (cb = cblist.pop(); cb != NULL; cb = cblist.pop()) {
     delete cb;
@@ -688,45 +658,13 @@ FileManager::copyFile(Rollback * rb, const char *snapPath)
 SnapResult
 FileManager::WalkSnaps(ExpandingArray * snapList)
 {
-
   MFresult r;
-  // These aren't used.
-  //char altSnapshotDir[256];
-  //InkHashTableValue snapDirLookup;
-  //fileBinding* snapBind;
-  //InkHashTableEntry *entry;
-  //InkHashTableIteratorState iterator_state;
-  //char *filePath;
-  bool found;
-  char config_dir[256];
-  char *snapshot_dir;
 
-  ink_mutex_acquire(&accessLock);
-  snapshot_dir = (char *) REC_readString("proxy.config.snapshot_dir", &found);
-  ink_assert(found);
-  //config_dir = lmgmt->record_data->readString("proxy.config.config_dir", &found);
-  //ink_assert(found);
-
-  if (varStrFromName("proxy.config.config_dir", config_dir, 256) == false) {
-    mgmt_fatal(stderr, 0,
-               "[FileManager::FileManager] Unable to find configuration directory from proxy.config.config_dir\n");
-  }
-
-  if (snapshot_dir == NULL) {
-    const size_t snapshot_dir_size = strlen("snapshots");
-    snapshot_dir = new char[snapshot_dir_size];
-    ink_assert(snapshot_dir);
-    snprintf(snapshot_dir, snapshot_dir_size, "%s", "snapshots");
-    RecSetRecordString("proxy.config.snapshot_dir", snapshot_dir);
-  }
-  //if(strncmp(snapshot_dir, config_dir, strlen(config_dir)))
-  if (snapshot_dir[0] != '/')
-    managedDir = newPathString(config_dir, snapshot_dir);
-  else
-    managedDir = snapshot_dir;
-  //else
-  //managedDir = snapshot_dir;
+  // The original code reset this->managedDir from proxy.config.snapshot_dir at this point. There doesn't appear to be
+  // any need for that, since managedDir is always set in the constructor and should not be changed.
+  ink_release_assert(this->managedDir != NULL);
 
+  ink_mutex_acquire(&accessLock);
 
   r = WalkFiles(snapList);
   //lmgmt->record_data ->setString("proxy.config.snapshot_dir", managedDir);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/FileManager.h
----------------------------------------------------------------------
diff --git a/mgmt/FileManager.h b/mgmt/FileManager.h
index 0d618b0..1824d5a 100644
--- a/mgmt/FileManager.h
+++ b/mgmt/FileManager.h
@@ -134,7 +134,6 @@ private:
     DLL<callbackListable> cblist;
   InkHashTable *bindings;
   //InkHashTable* g_snapshot_directory_ht;
-  char *snapshotDir;
   SnapResult copyFile(Rollback * rb, const char *snapPath);
   SnapResult readFile(const char *filePath, textBuffer * contents);
   void abortRestore(const char *abortTo);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 4572b57..21d05e6 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -200,7 +200,7 @@ LocalManager::processRunning()
   }
 }
 
-LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
+LocalManager::LocalManager(bool proxy_on)
   : BaseManager(), run_proxy(proxy_on)
 {
   bool found;
@@ -238,18 +238,10 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
   // Get the default IP binding values.
   RecHttpLoadIp("proxy.local.incoming_ip_to_bind", m_inbound_ip4, m_inbound_ip6);
 
-  config_path = REC_readString("proxy.config.config_dir", &found);
-  char *absolute_config_path = Layout::get()->relative(config_path);
-  ats_free(config_path);
-  if (access(absolute_config_path, R_OK) == -1) {
-    config_path = ats_strdup(system_config_directory);
-    if (access(config_path, R_OK) == -1) {
-        mgmt_elog(0, "[LocalManager::LocalManager] unable to access() directory '%s': %d, %s\n",
-                config_path, errno, strerror(errno));
-        mgmt_fatal(0, "[LocalManager::LocalManager] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
-    }
-  } else {
-    config_path = absolute_config_path;
+  if (access(Layout::get()->sysconfdir, R_OK) == -1) {
+    mgmt_elog(0, "[LocalManager::LocalManager] unable to access() directory '%s': %d, %s\n",
+	Layout::get()->sysconfdir, errno, strerror(errno));
+    mgmt_fatal(0, "[LocalManager::LocalManager] please set the 'TS_ROOT' environment variable\n");
   }
 
 #if TS_HAS_WCCP

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/LocalManager.h
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index 8c60978..8370a02 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -50,14 +50,13 @@
 class LocalManager: public BaseManager
 {
 public:
-  LocalManager(char *mpath, bool proxy_on);
+  LocalManager(bool proxy_on);
 
   ~LocalManager()
   {
     delete alarm_keeper;
     delete virt_map;
     delete ccom;
-    ats_free(config_path);
     ats_free(bin_path);
     ats_free(absolute_proxy_binary);
     ats_free(proxy_name);
@@ -125,7 +124,6 @@ public:
   int process_server_timeout_msecs;
 
   char pserver_path[PATH_NAME_MAX];
-  char *config_path;
   char *bin_path;
   char *absolute_proxy_binary;
   char *proxy_name;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index c33f564..0219e68 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -64,6 +64,8 @@
 extern "C" int getpwnam_r(const char *name, struct passwd *result, char *buffer, size_t buflen, struct passwd **resptr);
 #endif
 
+static void extractConfigInfo(char *mgmt_path, const char *recs_conf, char *userName, int *fds_throttle);
+
 LocalManager *lmgmt = NULL;
 FileManager *configFiles;
 
@@ -77,9 +79,6 @@ static char debug_tags[1024] = "";
 static char action_tags[1024] = "";
 static bool proxy_on = true;
 
-// TODO: Check if really need those
-char system_config_directory[PATH_NAME_MAX + 1];
-
 char mgmt_path[PATH_NAME_MAX + 1];
 
 // By default, set the current directory as base
@@ -267,18 +266,13 @@ static void
 init_dirs()
 {
   xptr<char> rundir(RecConfigReadRuntimeDir());
-  char buf[PATH_NAME_MAX + 1];
 
-  REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX);
-  Layout::get()->relative(system_config_directory, PATH_NAME_MAX, buf);
-  if (access(system_config_directory, R_OK) == -1) {
-    mgmt_elog(0, "unable to access() config dir '%s': %d, %s\n", system_config_directory, errno, strerror(errno));
-    mgmt_elog(0, "please set config path via 'proxy.config.config_dir' \n");
+  if (access(Layout::get()->sysconfdir, R_OK) == -1) {
+    mgmt_elog(0, "unable to access() config dir '%s': %d, %s\n", Layout::get()->sysconfdir, errno, strerror(errno));
+    mgmt_elog(0, "please set the 'TS_ROOT' environment variable\n");
     _exit(1);
   }
 
-  ink_strlcpy(mgmt_path, system_config_directory, sizeof(mgmt_path));
-
   if (access(rundir, R_OK) == -1) {
     mgmt_elog(0, "unable to access() local state dir '%s': %d, %s\n", (const char *)rundir, errno, strerror(errno));
     mgmt_elog(0, "please set 'proxy.config.local_state_dir'\n");
@@ -562,7 +556,7 @@ main(int argc, char **argv)
   Init_Errata_Logging();
 #endif
   ts_host_res_global_init();
-  lmgmt = new LocalManager(mgmt_path, proxy_on);
+  lmgmt = new LocalManager(proxy_on);
   RecLocalInitMessage();
   lmgmt->initAlarm();
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Main.h
----------------------------------------------------------------------
diff --git a/mgmt/Main.h b/mgmt/Main.h
index 12b9059..b401257 100644
--- a/mgmt/Main.h
+++ b/mgmt/Main.h
@@ -37,7 +37,6 @@
 void MgmtShutdown(int status);
 void fileUpdated(char *fname, bool incVersion);
 void runAsUser(char *userName);
-void extractConfigInfo(char *mgmt_path, const char *recs_conf, char *userName, int *fds_throttle);
 void printUsage(void);
 
 extern FileManager *configFiles;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Rollback.cc
----------------------------------------------------------------------
diff --git a/mgmt/Rollback.cc b/mgmt/Rollback.cc
index 0a4c961..6c219e3 100644
--- a/mgmt/Rollback.cc
+++ b/mgmt/Rollback.cc
@@ -30,6 +30,7 @@
 #include "ExpandingArray.h"
 #include "MgmtSocket.h"
 #include "ink_cap.h"
+#include "I_Layout.h"
 
 #define MAX_VERSION_DIGITS 11
 #define DEFAULT_BACKUPS 2
@@ -45,14 +46,11 @@ const char *RollbackStrings[] = { "Rollback Ok",
 Rollback::Rollback(const char *baseFileName, bool root_access_needed_)
   : root_access_needed(root_access_needed_)
 {
-  char configTmp[PATH_NAME_MAX + 1];
   version_t highestSeen;        // the highest backup version
   ExpandingArray existVer(25, true);    // Exsisting versions
   struct stat fileInfo;
   MgmtInt numBak;
   char *alarmMsg;
-  struct stat s;
-  int err;
 
   // To Test, Read/Write access to the file
   int testFD;                   // For open test
@@ -70,20 +68,13 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_)
   fileName = new char[fileNameLen + 1];
   ink_strlcpy(fileName, baseFileName, fileNameLen + 1);
 
-
-  // Get the configuration directory - SHOULD BE CENTRALIZED SOMEWHERE
   // TODO: Use the runtime directory for storing mutable data
   // XXX: Sysconfdir should be imutable!!!
-  //
-  if (varStrFromName("proxy.config.config_dir", configTmp, PATH_NAME_MAX) == false) {
-    mgmt_log(stderr, "[Rollback::Rollback] Unable to find configuration directory from proxy.config.config_dir\n");
-    ink_assert(0);
-  }
 
-  if ((err = stat(system_config_directory, &s)) < 0) {
-    mgmt_elog(0, "[Rollback::Rollback] unable to stat() directory '%s': %d %d, %s\n",
-              system_config_directory, err, errno, strerror(errno));
-    mgmt_elog(0, "[Rollback::Rollback] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+  if (access(Layout::get()->sysconfdir, F_OK) < 0) {
+    mgmt_elog(0, "[Rollback::Rollback] unable to access() directory '%s': %d, %s\n",
+              Layout::get()->sysconfdir, errno, strerror(errno));
+    mgmt_elog(0, "[Rollback::Rollback] please set the 'TS_ROOT' environment variable\n");
     _exit(1);
   }
 
@@ -96,12 +87,6 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_)
   } else {
     numberBackups = DEFAULT_BACKUPS;
   }
-  // TODO: Use strdup/free instead C++ new
-  //
-  int configDirLen = strlen(system_config_directory) + 1;
-  configDir = new char[configDirLen];
-  ink_strlcpy(configDir, system_config_directory, configDirLen);
-
 
   ink_mutex_init(&fileAccessLock, "RollBack Mutex");
 
@@ -227,7 +212,6 @@ Rollback::Rollback(const char *baseFileName, bool root_access_needed_)
 Rollback::~Rollback()
 {
   delete[]fileName;
-  delete[]configDir;
 }
 
 
@@ -240,11 +224,11 @@ Rollback::createPathStr(version_t version)
 {
 
   char *buffer;
-  int bufSize = strlen(configDir) + fileNameLen + MAX_VERSION_DIGITS + 1;
+  int bufSize = strlen(Layout::get()->sysconfdir) + fileNameLen + MAX_VERSION_DIGITS + 1;
 
   buffer = new char[bufSize];
 
-  ink_filepath_make(buffer, bufSize, configDir, fileName);
+  Layout::get()->relative_to(buffer, bufSize, Layout::get()->sysconfdir, fileName);
 
   if (version != ACTIVE_VERSION) {
     size_t pos = strlen(buffer);
@@ -727,11 +711,11 @@ Rollback::findVersions_ml(ExpandingArray * listNames)
   struct dirent *dirEntrySpace;
   struct dirent *entryPtr;
 
-  dir = opendir(configDir);
+  dir = opendir(Layout::get()->sysconfdir);
 
   if (dir == NULL) {
     mgmt_log(stderr, "[Rollback::findVersions] Unable to open configuration directory: %s: %s\n",
-             configDir, strerror(errno));
+             Layout::get()->sysconfdir, strerror(errno));
     return INVALID_VERSION;
   }
   // The fun of Solaris - readdir_r requires a buffer passed into it

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/Rollback.h
----------------------------------------------------------------------
diff --git a/mgmt/Rollback.h b/mgmt/Rollback.h
index c033161..e3025a6 100644
--- a/mgmt/Rollback.h
+++ b/mgmt/Rollback.h
@@ -207,7 +207,6 @@ private:
   int statFile(version_t version, struct stat *buf);
   char *createPathStr(version_t version);
   RollBackCodes internalUpdate(textBuffer * buf, version_t newVersion, bool notifyChange = true, bool incVersion = true);
-  char *configDir;
   ink_mutex fileAccessLock;
   char *fileName;
   size_t fileNameLen;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/cluster/VMap.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/VMap.cc b/mgmt/cluster/VMap.cc
index 5539e6f..43cba20 100644
--- a/mgmt/cluster/VMap.cc
+++ b/mgmt/cluster/VMap.cc
@@ -35,6 +35,7 @@
 #include "VMap.h"
 #include "MgmtUtils.h"
 #include "P_RecLocal.h"
+#include "I_Layout.h"
 
 // for linux and freebsd
 #ifndef C_ISUID
@@ -303,19 +304,17 @@ VMap::lt_runGambit()
  * vaddr file.
  */
 void
-VMap::lt_readAListFile(char *data)
+VMap::lt_readAListFile(char * data)
 {
   int tmp_num_addrs = 0;
-  char buf[1024], fname[1024];
+  char buf[1024];
   char tmp_addr[1024], tmp_interface[1024];
   FILE *fin;
   char tmp_id[1024];
+  xptr<char> vaddr_path(Layout::get()->relative_to(Layout::get()->sysconfdir, data));
 
-  if (!data)
-    return;
-  snprintf(fname, sizeof(fname), "%s/%s", lmgmt->config_path, data);
-  if (!(fin = fopen(fname, "r"))) {
-    mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", fname);
+  if (!(fin = fopen(vaddr_path, "r"))) {
+    mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", (const char *)vaddr_path);
     return;
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/mgmt/web2/WebIntrMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc
index c3a6732..57a2066 100644
--- a/mgmt/web2/WebIntrMain.cc
+++ b/mgmt/web2/WebIntrMain.cc
@@ -415,11 +415,11 @@ webIntr_main(void *)
 
     if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
       ats_free(autoconfContext.docRoot);
-      autoconfContext.docRoot = ats_strdup(system_config_directory);
+      autoconfContext.docRoot = ats_strdup(Layout::get()->sysconfdir);
       if ((err = stat(autoconfContext.docRoot, &s)) < 0) {
         mgmt_elog(0, "[WebIntrMain] unable to stat() directory '%s': %d %d, %s\n",
                 autoconfContext.docRoot, err, errno, strerror(errno));
-        mgmt_elog(0, "[WebIntrMain] please set config path via command line '-path <path>' or 'proxy.config.config_dir' \n");
+        mgmt_elog(0, "[WebIntrMain] please set the 'TS_ROOT' environment variable\n");
         mgmt_fatal(stderr, 0, "[WebIntrMain] No Client AutoConf Root\n");
       }
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ControlMatcher.cc
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc
index 6680d69..7828e7e 100644
--- a/proxy/ControlMatcher.cc
+++ b/proxy/ControlMatcher.cc
@@ -694,8 +694,6 @@ template<class Data, class Result>
 ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *name, const matcher_tags * tags,
                                              int flags_in)
 {
-  char *config_file = NULL;
-
   flags = flags_in;
   ink_assert(flags & (ALLOW_HOST_TABLE | ALLOW_REGEX_TABLE | ALLOW_URL_TABLE | ALLOW_IP_TABLE));
 
@@ -703,16 +701,14 @@ ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *n
   ink_assert(config_tags != NULL);
 
   matcher_name = name;
-  config_file_var = ats_strdup(file_var);
   config_file_path[0] = '\0';
 
-  REC_ReadConfigStringAlloc(config_file, config_file_var);
-
   if (!(flags & DONT_BUILD_TABLE)) {
-    ink_release_assert(config_file != NULL);
-    ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file);
+    xptr<char> config_path(RecConfigReadConfigPath(file_var));
+
+    ink_release_assert(config_path);
+    ink_strlcpy(config_file_path, config_path, sizeof(config_file_path));
   }
-  ats_free(config_file);
 
   reMatch = NULL;
   urlMatch = NULL;
@@ -729,7 +725,6 @@ ControlMatcher<Data, Result>::ControlMatcher(const char *file_var, const char *n
 
 template<class Data, class Result> ControlMatcher<Data, Result>::~ControlMatcher()
 {
-  ats_free(config_file_var);
 
   delete reMatch;
   delete urlMatch;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ControlMatcher.h
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
index c6f1c1b..c78db65 100644
--- a/proxy/ControlMatcher.h
+++ b/proxy/ControlMatcher.h
@@ -32,8 +32,8 @@
  *
  *     The control matcher module provides the ability to lookup arbitrary
  *  information specific to a URL and IP address.  The outside
- *  world only sees the ControlMatcher class which parses the revelvant
- *  configuration file and builds the lookups table
+ *  world only sees the ControlMatcher class which parses the relevant
+ *  configuration file and builds the lookup table
  *
  *     Four types of matched are supported: hostname, domain name, ip address
  *  and URL regex.  For these four types, three lookup tables are used.  Regex and
@@ -277,7 +277,6 @@ public:
   int BuildTableFromString(char *str);
   void Match(RequestData * rdata, Result * result);
   void Print();
-  char *config_file_var;        // temporary: until config is integerated
 
   int getEntryCount() { return m_numEntries; }
   HostMatcher<Data, Result> *getHostMatcher() { return hostMatch; }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/ICPConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index 3e19557..b5192d2 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -38,6 +38,7 @@
 #include "ICPProcessor.h"
 #include "ICPlog.h"
 #include "BaseManager.h"
+#include "I_Layout.h"
 
 //--------------------------------------------------------------------------
 //  Each ICP peer is described in "icp.config" with the
@@ -542,14 +543,10 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu
   //
   // Build pathname to "icp.config" and open file
   //
-  ink_assert(filename);
-  char ConfigFilePath[PATH_NAME_MAX];
-  if (filename) {
-    ink_strlcpy(ConfigFilePath, system_config_directory, sizeof(ConfigFilePath));
-    ink_strlcat(ConfigFilePath, "/", sizeof(ConfigFilePath));
-    ink_strlcat(ConfigFilePath, filename, sizeof(ConfigFilePath));
-  }
-  int fd = open(ConfigFilePath, O_RDONLY);
+  ink_release_assert(filename != NULL);
+
+  xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename));
+  int fd = open(config_path, O_RDONLY);
   if (fd < 0) {
     Warning("read icp.config, open failed");
     REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, open failed");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/IPAllow.cc
----------------------------------------------------------------------
diff --git a/proxy/IPAllow.cc b/proxy/IPAllow.cc
index 2cd1d77..07c9eee 100644
--- a/proxy/IPAllow.cc
+++ b/proxy/IPAllow.cc
@@ -104,20 +104,15 @@ IpAllow::IpAllow(
   const char *config_var,
   const char *name,
   const char *action_val
-) : config_file_var(config_var),
-    module_name(name),
+) : module_name(name),
     action(action_val)
 {
+  xptr<char> config_path(RecConfigReadConfigPath(config_var));
 
-  char *config_file;
-
-  config_file_var = ats_strdup(config_var);
   config_file_path[0] = '\0';
+  ink_release_assert(config_path);
 
-  REC_ReadConfigStringAlloc(config_file, (char *) config_file_var);
-  ink_release_assert(config_file != NULL);
-  ink_filepath_make(config_file_path, sizeof(config_file_path), system_config_directory, config_file);
-  ats_free(config_file);
+  ink_strlcpy(config_file_path, config_path, sizeof(config_file_path));
 }
 
 IpAllow::~IpAllow()

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/IPAllow.h
----------------------------------------------------------------------
diff --git a/proxy/IPAllow.h b/proxy/IPAllow.h
index 76ecdf4..2c2d232 100644
--- a/proxy/IPAllow.h
+++ b/proxy/IPAllow.h
@@ -98,7 +98,6 @@ private:
 
   int BuildTable();
 
-  const char *config_file_var;
   char config_file_path[PATH_NAME_MAX];
   const char *module_name;
   const char *action;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 1b4ce13..1e8ecdf 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -1711,7 +1711,7 @@ TSInstallDirGet(void)
 const char *
 TSConfigDirGet(void)
 {
-  return system_config_directory;
+  return Layout::get()->sysconfdir;
 }
 
 const char *
@@ -1719,6 +1719,7 @@ TSTrafficServerVersionGet(void)
 {
   return traffic_server_version;
 }
+
 int TSTrafficServerVersionGetMajor() { return ts_major_version; }
 int TSTrafficServerVersionGetMinor() { return ts_minor_version; }
 int TSTrafficServerVersionGetPatch() { return ts_patch_version; }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 2f3e19e..bc7c2d5 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -144,8 +144,6 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST;
 static char command_string[512] = "";
 int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
-char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
-
 static char error_tags[1024] = "";
 static char action_tags[1024] = "";
 static int show_statistics = 0;
@@ -274,29 +272,15 @@ check_lockfile()
 }
 
 static void
-init_dirs(void)
+check_config_directories(void)
 {
   xptr<char> rundir(RecConfigReadRuntimeDir());
 
-  char buf[PATH_NAME_MAX + 1];
-
-  ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, PATH_NAME_MAX);
-
-  /*
-   * XXX: There is not much sense in the following code
-   * The purpose of proxy.config.foo_dir should
-   * be checked BEFORE checking default foo directory.
-   * Otherwise one cannot change the config dir to something else
-   */
-  if (access(system_config_directory, R_OK) == -1) {
-    REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX);
-    Layout::get()->relative(system_config_directory, PATH_NAME_MAX, buf);
-    if (access(system_config_directory, R_OK) == -1) {
-      fprintf(stderr,"unable to access() config dir '%s': %d, %s\n",
-              system_config_directory, errno, strerror(errno));
-      fprintf(stderr, "please set config path via 'proxy.config.config_dir' \n");
-      _exit(1);
-    }
+  if (access(Layout::get()->sysconfdir, R_OK) == -1) {
+    fprintf(stderr,"unable to access() config dir '%s': %d, %s\n",
+            Layout::get()->sysconfdir, errno, strerror(errno));
+    fprintf(stderr, "please set the 'TS_ROOT' environment variable\n");
+    _exit(1);
   }
 
   if (access(rundir, R_OK | W_OK) == -1) {
@@ -327,15 +311,14 @@ initialize_process_manager()
     LibRecordsConfigInit();
     RecordsConfigOverrideFromEnvironment();
   }
-  //
+
   // Start up manager
-  //
   pmgmt = NEW(new ProcessManager(remote_management_flag));
 
   pmgmt->start();
   RecProcessInitMessage(remote_management_flag ? RECM_CLIENT : RECM_STAND_ALONE);
   pmgmt->reconfigure();
-  init_dirs();// setup directories
+  check_config_directories();
 
   //
   // Define version info records
@@ -1531,7 +1514,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
     Log::init(remote_management_flag ? 0 : Log::NO_REMOTE_MANAGEMENT);
 
     // Init plugins as soon as logging is ready.
-    plugin_init(system_config_directory);        // plugin.config
+    plugin_init();        // plugin.config
     pmgmt->registerPluginCallbacks(global_config_cbs);
 
     cacheProcessor.set_after_init_callback(&CB_After_Cache_Init);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Plugin.cc
----------------------------------------------------------------------
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index 5b2b19e..10ff423 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -221,36 +221,8 @@ not_found:
   return NULL;
 }
 
-
-int
-plugins_exist(const char *config_dir)
-{
-  char path[PATH_NAME_MAX + 1];
-  char line[1024], *p;
-  int fd;
-  int plugin_count = 0;
-
-  ink_filepath_make(path, sizeof(path), config_dir, "plugin.config");
-  fd = open(path, O_RDONLY);
-  if (fd < 0) {
-    Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno));
-    return 0;
-  }
-  while (ink_file_fd_readline(fd, sizeof(line) - 1, line) > 0) {
-    p = line;
-    // strip leading white space and test for comment or blank line
-    while (*p && ParseRules::is_wslfcr(*p))
-      ++p;
-    if ((*p == '\0') || (*p == '#'))
-      continue;
-    plugin_count++;
-  }
-  close(fd);
-  return plugin_count;
-}
-
 void
-plugin_init(const char *config_dir)
+plugin_init(void)
 {
   char path[PATH_NAME_MAX + 1];
   char line[1024], *p;
@@ -267,7 +239,7 @@ plugin_init(const char *config_dir)
     INIT_ONCE = false;
   }
 
-  ink_filepath_make(path, sizeof(path), config_dir, "plugin.config");
+  Layout::get()->relative_to(path, sizeof(path), Layout::get()->sysconfdir, "plugin.config");
   fd = open(path, O_RDONLY);
   if (fd < 0) {
     Warning("unable to open plugin config file '%s': %d, %s", path, errno, strerror(errno));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Plugin.h
----------------------------------------------------------------------
diff --git a/proxy/Plugin.h b/proxy/Plugin.h
index 4173a05..4c1ad09 100644
--- a/proxy/Plugin.h
+++ b/proxy/Plugin.h
@@ -56,7 +56,6 @@ struct PluginRegInfo
 extern DLL<PluginRegInfo> plugin_reg_list;
 extern PluginRegInfo *plugin_reg_current;
 
-void plugin_init(const char *config_dir);
-int plugins_exist(const char *config_dir);
+void plugin_init(void);
 
 #endif /* __PLUGIN_H__ */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Prefetch.cc
----------------------------------------------------------------------
diff --git a/proxy/Prefetch.cc b/proxy/Prefetch.cc
index 69f2489..182e4c3 100644
--- a/proxy/Prefetch.cc
+++ b/proxy/Prefetch.cc
@@ -26,7 +26,6 @@
 #include "Prefetch.h"
 #include "HdrUtils.h"
 #include "HttpCompat.h"
-#include "I_Layout.h"
 #include <records/I_RecHttp.h>
 #include <ts/IpMapConf.h>
 
@@ -1906,8 +1905,7 @@ config_read_proto(PrefetchBlastData &blast, const char *str)
 int
 PrefetchConfiguration::readConfiguration()
 {
-  char *conf_file_name;
-  char conf_path[PATH_NAME_MAX + 1];
+  xptr<char> conf_path;
   int fd = -1;
 
   local_http_server_port = stuffer_port = 0;
@@ -1944,24 +1942,21 @@ PrefetchConfiguration::readConfiguration()
   //pre_parse_hook = 0;
   //embedded_url_hook = 0;
 
-  conf_file_name = TS_ConfigReadString("proxy.config.prefetch.config_file");
-
-  if (conf_file_name == NULL) {
+  conf_path = RecConfigReadConfigPath("proxy.config.prefetch.config_file");
+  if (!conf_path) {
     Warning("PrefetchProcessor: No prefetch configuration file specified. Prefetch disabled\n");
     goto Lerror;
   }
-  Layout::relative_to(conf_path, sizeof(conf_path), system_config_directory, conf_file_name);
-  ats_free(conf_file_name);
 
   fd = open(conf_path, O_RDONLY);
   if (fd < 0) {
-    Error("PrefetchProcessor: Error, could not open '%s' disabling Prefetch\n", conf_path);
+    Error("PrefetchProcessor: Error, could not open '%s' disabling Prefetch\n", (const char *)conf_path);
     goto Lerror;
   }
 
   char *temp_str;
   if ((temp_str = Load_IpMap_From_File(&ip_map, fd, "prefetch_children")) != 0) {
-    Error("PrefetchProcessor: Error in reading ip_range from %s: %.256s\n", conf_path, temp_str);
+    Error("PrefetchProcessor: Error in reading ip_range from %s: %.256s\n", (const char *)conf_path, temp_str);
     ats_free(temp_str);
     goto Lerror;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/Update.cc
----------------------------------------------------------------------
diff --git a/proxy/Update.cc b/proxy/Update.cc
index 56e2367..cabfe62 100644
--- a/proxy/Update.cc
+++ b/proxy/Update.cc
@@ -32,7 +32,7 @@
 #include "URL.h"
 #include "HdrUtils.h"
 #include <records/I_RecHttp.h>
-//#include "MixtAPIInternal.h"
+#include "I_Layout.h"
 
 RecRawStatBlock *update_rsb;
 
@@ -875,17 +875,15 @@ UpdateConfigList *
 UpdateConfigManager::BuildUpdateList()
 {
   // Build pathname to "update.config" and open file
+  xptr<char> config_path;
 
-  char ConfigFilePath[PATH_NAME_MAX];
   if (_filename) {
-    ink_strlcpy(ConfigFilePath, system_config_directory, sizeof(ConfigFilePath));
-    ink_strlcat(ConfigFilePath, "/", sizeof(ConfigFilePath));
-    ink_strlcat(ConfigFilePath, _filename, sizeof(ConfigFilePath));
+    config_path = Layout::get()->relative_to(Layout::get()->sysconfdir, _filename);
   } else {
     return (UpdateConfigList *) NULL;
   }
 
-  int fd = open(ConfigFilePath, O_RDONLY);
+  int fd = open(config_path, O_RDONLY);
   if (fd < 0) {
     Warning("read update.config, open failed");
     SignalWarning(MGMT_SIGNAL_CONFIG_ERROR, "read update.config, open failed");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/http/HttpBodyFactory.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc
index ca0e7f1..632d499 100644
--- a/proxy/http/HttpBodyFactory.cc
+++ b/proxy/http/HttpBodyFactory.cc
@@ -39,6 +39,7 @@
 #include <logging/LogAccess.h>
 #include <logging/LogAccessHttp.h>
 #include "HttpCompat.h"
+#include "I_Layout.h"
 
 //////////////////////////////////////////////////////////////////////
 // The HttpBodyFactory creates HTTP response page bodies, supported //
@@ -258,11 +259,9 @@ HttpBodyFactory::reconfigure()
 //#endif
 {
   RecInt e;
-  RecString s;
+  RecString s = NULL;
   bool all_found;
   int rec_err;
-  struct stat st;
-  int err;
 
   lock();
   sanity_check();
@@ -296,27 +295,26 @@ HttpBodyFactory::reconfigure()
   all_found = all_found && (rec_err == REC_ERR_OKAY);
   Debug("body_factory", "response_suppression_mode = %d (found = %" PRId64")", response_suppression_mode, e);
 
+  xptr<char> directory_of_template_sets;
+
   rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s);
   all_found = all_found && (rec_err == REC_ERR_OKAY);
   if (rec_err == REC_ERR_OKAY) {
-    ats_free(directory_of_template_sets);
-    directory_of_template_sets = s;
-    if ((err = stat(directory_of_template_sets, &st)) < 0) {
-      if ((err = stat(system_config_directory, &st)) < 0) {
-        Warning("Unable to stat() directory '%s': %d %d, %s", system_config_directory, err, errno, strerror(errno));
-        Warning(" Please set 'proxy.config.body_factory.template_sets_dir' ");
-      } else {
-        ats_free(directory_of_template_sets);
-        directory_of_template_sets = ats_strdup(system_config_directory);
-      }
+    directory_of_template_sets = Layout::get()->relative(s);
+    if (access(directory_of_template_sets, R_OK) < 0) {
+      Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno));
+      Warning(" Please set 'proxy.config.body_factory.template_sets_dir' ");
     }
+
   }
 
-  Debug("body_factory", "directory_of_template_sets = '%s' (found = %" PRId64")", directory_of_template_sets, e);
+  Debug("body_factory", "directory_of_template_sets = '%s' (found = %s)", (const char *)directory_of_template_sets, s);
+  ats_free(s);
 
   if (!all_found) {
     Warning("config changed, but can't fetch all proxy.config.body_factory values");
   }
+
   /////////////////////////////////////////////
   // clear out previous template hash tables //
   /////////////////////////////////////////////
@@ -353,7 +351,6 @@ HttpBodyFactory::HttpBodyFactory()
   ink_mutex_init(&mutex, "HttpBodyFactory::lock");
 
   table_of_sets = NULL;
-  directory_of_template_sets = NULL;
   enable_customizations = 0;
   enable_logging = true;
   callbacks_established = false;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/http/HttpBodyFactory.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpBodyFactory.h b/proxy/http/HttpBodyFactory.h
index b13ac85..4124fcc 100644
--- a/proxy/http/HttpBodyFactory.h
+++ b/proxy/http/HttpBodyFactory.h
@@ -227,7 +227,6 @@ private:
   /////////////////////////////////////
   int enable_customizations;    // 0:no custom,1:custom,2:language-targeted
   bool enable_logging;          // the user wants body factory logging
-  char *directory_of_template_sets;     // root directory for template sets
   int response_suppression_mode;        // when to suppress responses
 
   ////////////////////

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 6cb8e68..5810e8f 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -1624,29 +1624,25 @@ static char xml_config_buffer[] = "<LogFilter> \
 void
 LogConfig::read_xml_log_config(int from_memory)
 {
-  char config_path[PATH_NAME_MAX];
+  xptr<char> config_path;
 
-  if (from_memory) {
-    snprintf(config_path, PATH_NAME_MAX, "%s", "from_memory");
-    Debug("log", "Reading from memory %s", config_path);
-  } else {
+  if (!from_memory) {
     if (xml_config_file == NULL) {
       Note("No log config file to read");
       return;
     }
-    snprintf(config_path, PATH_NAME_MAX, "%s/%s", system_config_directory, xml_config_file);
-  }
 
+    config_path = Layout::get()->relative_to(Layout::get()->sysconfdir, xml_config_file);
+  }
 
-  Debug("log-config", "Reading log config file %s", config_path);
-  Debug("xml", "%s is an XML-based config file", config_path);
-
-  InkXmlConfigFile log_config(config_path);
+  InkXmlConfigFile log_config(config_path ? (const char *)config_path : "memory://builtin");
 
   if (!from_memory) {
+    Debug("log-config", "Reading log config file %s", (const char *)config_path);
+    Debug("xml", "%s is an XML-based config file", (const char *)config_path);
 
     if (log_config.parse() < 0) {
-      Note("Error parsing log config file %s; ensure that it is XML-based", config_path);
+      Note("Error parsing log config file %s; ensure that it is XML-based", (const char *)config_path);
       return;
     }
 
@@ -2231,18 +2227,16 @@ LogConfig::read_xml_log_config(int from_memory)
 char **
 LogConfig::read_log_hosts_file(size_t * num_hosts)
 {
-  char config_path[PATH_NAME_MAX];
+  xptr<char> config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, hosts_config_file));
   char line[LOG_MAX_FORMAT_LINE];
   char **hosts = NULL;
 
-  snprintf(config_path, PATH_NAME_MAX, "%s/%s", system_config_directory, hosts_config_file);
-
-  Debug("log-config", "Reading log hosts from %s", config_path);
+  Debug("log-config", "Reading log hosts from %s", (const char *)config_path);
 
   size_t nhosts = 0;
   int fd = open(config_path, O_RDONLY);
   if (fd < 0) {
-    Warning("Traffic Server can't open %s for reading log hosts " "for splitting: %s.", config_path, strerror(errno));
+    Warning("Traffic Server can't open %s for reading log hosts " "for splitting: %s.", (const char *)config_path, strerror(errno));
   } else {
     //
     // First, count the number of hosts in the file
@@ -2261,7 +2255,7 @@ LogConfig::read_log_hosts_file(size_t * num_hosts)
     //
     if (nhosts) {
       if (lseek(fd, 0, SEEK_SET) != 0) {
-        Warning("lseek failed on file %s: %s", config_path, strerror(errno));
+        Warning("lseek failed on file %s: %s", (const char *)config_path, strerror(errno));
         nhosts = 0;
       } else {
         hosts = NEW(new char *[nhosts]);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index e731851..5d79f80 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -56,8 +56,6 @@ int remote_management_flag = 0;
 int auto_clear_hostdb_flag = 0;
 char proxy_name[MAXDNAME + 1] = "unknown";
 
-char system_config_directory[PATH_NAME_MAX + 1] = "";
-
 char error_tags[1024] = "";
 char action_tags[1024] = "";
 char command_string[512] = "";
@@ -116,8 +114,6 @@ initialize_process_manager()
 
   pmgmt->reconfigure();
 
-  REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
-
   //
   // Define version info records
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/67306a71/proxy/sac.cc
----------------------------------------------------------------------
diff --git a/proxy/sac.cc b/proxy/sac.cc
index e150507..a9e4a9b 100644
--- a/proxy/sac.cc
+++ b/proxy/sac.cc
@@ -46,21 +46,16 @@
 #include "DiagsConfig.h"
 #include "I_Machine.h"
 
-int auto_clear_cache_flag = 0;
-
 // sac-specific command-line flags
 //
-int version_flag = 0;
+static int version_flag = 0;
 
 // command-line argument descriptions
 //
-static char configDirectoryType[8] = "S1024";
 
 ArgumentDescription argument_descriptions[] = {
 
   {"version", 'V', "Print Version Id", "T", &version_flag, NULL, NULL},
-  {"config_dir", 'c', "Config Directory", configDirectoryType,
-   &system_config_directory, NULL, NULL},
 #ifdef DEBUG
   {"error_tags", 'T', "Colon-Separated Debug Tags", "S1023", &error_tags,
    NULL, NULL},
@@ -86,7 +81,6 @@ main(int /* argc ATS_UNUSED */, char *argv[])
   Layout::create();
   // take care of command-line arguments
   //
-  snprintf(configDirectoryType, sizeof(configDirectoryType), "S%d", PATH_NAME_MAX - 1);
   process_args(argument_descriptions, countof(argument_descriptions), argv);
 
   // check for the version number request


[05/50] git commit: TS-2401: Add RecConfigReadLogDir() to wrap proxy.config.log.logfile_dir access

Posted by zw...@apache.org.
TS-2401: Add RecConfigReadLogDir() to wrap proxy.config.log.logfile_dir access


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

Branch: refs/heads/5.0.x
Commit: a1162d8368a3f6a3401a31983ac90181f5a11782
Parents: b6288c4
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 3 13:25:11 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 lib/records/I_RecCore.h     |  4 ++++
 lib/records/RecCore.cc      | 17 +++++++++++++++++
 proxy/InkAPITest.cc         |  5 ++---
 proxy/logging/LogConfig.cc  | 12 ++----------
 proxy/shared/DiagsConfig.cc |  9 +--------
 5 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1162d83/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index 8462752..39d2e9d 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -53,6 +53,10 @@ char * RecConfigReadRuntimeDir();
 // MUST release the result with ats_free().
 char * RecConfigReadSnapshotDir();
 
+// Return a copy of the system's log directory, taking proxy.config.log.logfile_dir into account. The caller
+// MUST release the result with ats_free().
+char * RecConfigReadLogDir();
+
 // Return a copy of a configuration file that is relative to sysconfdir. The relative path to the configuration
 // file is specified in the configuration variable named by "file_variable". If the configuration variable has no
 // value, NULL is returned. The caller MUST release the result with ats_free().

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1162d83/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 6c17cc9..96cddfc 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1071,6 +1071,23 @@ RecConfigReadRuntimeDir()
 }
 
 //-------------------------------------------------------------------------
+// RecConfigReadLogDir
+//-------------------------------------------------------------------------
+char *
+RecConfigReadLogDir()
+{
+  char buf[PATH_NAME_MAX + 1];
+
+  buf[0] = '\0';
+  RecGetRecordString("proxy.config.log.logfile_dir", buf, PATH_NAME_MAX);
+  if (strlen(buf) > 0) {
+    return Layout::get()->relative(buf);
+  } else {
+    return ats_strdup(Layout::get()->logdir);
+  }
+}
+
+//-------------------------------------------------------------------------
 // RecConfigReadSnapshotDir.
 //-------------------------------------------------------------------------
 char *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1162d83/proxy/InkAPITest.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 3e0ce3a..8f97a88 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -5340,10 +5340,9 @@ REGRESSION_TEST(SDK_API_TSTextLog) (RegressionTest * test, int /* atype ATS_UNUS
 
   /* Generate a random log file name, so if we run the test several times, we won't use the
      same log file name. */
-  char *tmp = REC_ConfigReadString("proxy.config.log.logfile_dir");
+  xptr<char> tmp(RecConfigReadLogDir());
   snprintf(logname, sizeof(logname), "RegressionTestLog%d.log", (int) getpid());
-  snprintf(fullpath_logname, sizeof(fullpath_logname), "%s/%s", tmp, logname);
-  // ats_free(tmp);
+  snprintf(fullpath_logname, sizeof(fullpath_logname), "%s/%s", (const char *)tmp, logname);
 
   unlink(fullpath_logname);
   retVal = TSTextLogObjectCreate(logname, TS_LOG_MODE_ADD_TIMESTAMP, &log);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1162d83/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 5810e8f..133ea21 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -240,16 +240,8 @@ LogConfig::read_configuration_variables()
     hostname = ptr;
   }
 
-  ptr = REC_ConfigReadString("proxy.config.log.logfile_dir");
-  if (ptr != NULL) {
-    ats_free(logfile_dir);
-    // Make it relative from Layout
-    logfile_dir = Layout::get()->relative(ptr);
-    ats_free(ptr);
-  } else {
-    ats_free(logfile_dir);
-    logfile_dir = ats_strdup(Layout::get()->logdir);
-  }
+  ats_free(logfile_dir);
+  logfile_dir = RecConfigReadLogDir();
 
   if (access(logfile_dir, R_OK | W_OK | X_OK) == -1) {
     // Try 'system_root_dir/var/log/trafficserver' directory

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1162d83/proxy/shared/DiagsConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc
index 27ec46b..3cb6a3d 100644
--- a/proxy/shared/DiagsConfig.cc
+++ b/proxy/shared/DiagsConfig.cc
@@ -309,14 +309,7 @@ DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
   // Open the diagnostics log. If proxy.config.log.logfile_dir is set use that, otherwise fall
   // back to the configured log directory.
 
-  diags_logpath[0] = '\0';
-  REC_ReadConfigString(diags_logpath, "proxy.config.log.logfile_dir", PATH_NAME_MAX);
-  if (strlen(diags_logpath) > 0) {
-    logpath = Layout::get()->relative(diags_logpath);
-  } else {
-    logpath = ats_strdup(Layout::get()->logdir);
-  }
-
+  logpath = RecConfigReadLogDir();
   if (access(logpath, W_OK | R_OK) == -1) {
     fprintf(stderr, "unable to access log directory '%s': %d, %s\n",
             (const char *)logpath, errno, strerror(errno));


[36/50] git commit: TS-2426: add the xdebug plugin

Posted by zw...@apache.org.
TS-2426: add the xdebug plugin

The xdebug plugin scans X-Debug header values and emits the requested
debug information. The plugin is named after the X- prefix of the
headers that is scans and emits.

The values we scan for are names of debug headers. The first header
to be supported is X-Cache-Key, which report the cache lookup URL
used buy the request. the second header supported is the Via header,
which causes a verbose Via header to be emitted for the request.


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

Branch: refs/heads/5.0.x
Commit: 14667c65ff72d6af5da9bec62c41548076093091
Parents: 5e256d2
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 3 15:03:36 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 09:26:51 2013 -0800

----------------------------------------------------------------------
 CHANGES                               |   3 +
 configure.ac                          |   1 +
 plugins/experimental/Makefile.am      |  23 +--
 plugins/experimental/xdebug/xdebug.cc | 217 +++++++++++++++++++++++++++++
 4 files changed, 234 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14667c65/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 49488e9..30afc6c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+
+  *) [TS-2426] Add a new plugin, xdebug, for cache debugging using HTTP headers.
+
   *) [TS-2077] Remove pipeline configurations, they were no-op's anyways. We
    still support pipelining (we always do), it's just not treated specially
    (or optimized).

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14667c65/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index fd41a1b..c16f89f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1935,6 +1935,7 @@ AC_CONFIG_FILES([
   plugins/experimental/tcp_info/Makefile
   plugins/experimental/healthchecks/Makefile
   plugins/experimental/remap_stats/Makefile
+  plugins/experimental/xdebug/Makefile
   plugins/gzip/Makefile
   plugins/libloader/Makefile
   plugins/header_filter/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14667c65/plugins/experimental/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/Makefile.am b/plugins/experimental/Makefile.am
index b0e4d98..3d5a453 100644
--- a/plugins/experimental/Makefile.am
+++ b/plugins/experimental/Makefile.am
@@ -15,19 +15,22 @@
 #  limitations under the License.
 
 if BUILD_EXPERIMENTAL_PLUGINS
+
 SUBDIRS = \
- lua \
- ts_lua \
+ authproxy \
  buffer_upload \
- esi \
- rfc5861 \
- tcp_info \
- custom_redirect \
- metalink \
- spdy \
  channel_stats \
- authproxy \
+ custom_redirect \
+ esi \
  geoip_acl \
  healthchecks \
- remap_stats
+ lua \
+ metalink \
+ remap_stats \
+ rfc5861 \
+ spdy \
+ tcp_info \
+ ts_lua \
+ xdebug
+
 endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14667c65/plugins/experimental/xdebug/xdebug.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/xdebug/xdebug.cc b/plugins/experimental/xdebug/xdebug.cc
new file mode 100644
index 0000000..e33ffa3
--- /dev/null
+++ b/plugins/experimental/xdebug/xdebug.cc
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ts/ts.h>
+#include <stdlib.h>
+#include <strings.h>
+
+// The name of the debug request header. This should probably be configurable.
+#define X_DEBUG_HEADER "X-Debug"
+
+#define XHEADER_X_CACHE_KEY   0x0004u
+
+static int XArgIndex = 0;
+static TSCont XInjectHeadersCont = NULL;
+
+// Return the length of a string literal.
+template <int N> unsigned
+lengthof(const char (&str)[N]) {
+  return N - 1;
+}
+
+static TSMLoc
+FindOrMakeHdrField(TSMBuffer buffer, TSMLoc hdr, const char * name, unsigned len)
+{
+  TSMLoc field;
+
+  field = TSMimeHdrFieldFind(buffer, hdr, name, len);
+  if (field == TS_NULL_MLOC) {
+      if (TSMimeHdrFieldCreateNamed(buffer, hdr, name, len, &field) == TS_SUCCESS) {
+          TSReleaseAssert(TSMimeHdrFieldAppend(buffer, hdr, field) == TS_SUCCESS);
+      }
+  }
+
+  return field;
+}
+
+static void
+InjectCacheKeyHeader(TSHttpTxn txn, TSMBuffer buffer, TSMLoc hdr)
+{
+  TSMLoc url = TS_NULL_MLOC;
+  TSMLoc dst = TS_NULL_MLOC;
+
+  struct { char * ptr; int len; } strval = { NULL, 0 };
+
+  TSDebug("xdebug", "attempting to inject X-Cache-Key header");
+
+  if (TSUrlCreate(buffer, &url) != TS_SUCCESS) {
+    goto done;
+  }
+
+  if (TSHttpTxnCacheLookupUrlGet(txn, buffer, url) != TS_SUCCESS) {
+    goto done;
+  }
+
+  strval.ptr = TSUrlStringGet(buffer, url, &strval.len);
+  if (strval.ptr == NULL || strval.len == 0) {
+    goto done;
+  }
+
+  // Create a new response header field.
+  dst = FindOrMakeHdrField(buffer, hdr, "X-Cache-Key", lengthof("X-Cache-Key"));
+  if (dst == TS_NULL_MLOC) {
+    goto done;
+  }
+
+  // Now copy the cache lookup URL into the response header.
+  TSReleaseAssert(
+    TSMimeHdrFieldValueStringInsert(buffer, hdr, dst, 0 /* idx */, strval.ptr, strval.len) == TS_SUCCESS
+  );
+
+done:
+  if (dst != TS_NULL_MLOC) {
+    TSHandleMLocRelease(buffer, hdr, dst);
+  }
+
+  if (url != TS_NULL_MLOC) {
+    TSHandleMLocRelease(buffer, TS_NULL_MLOC, url);
+  }
+
+  TSfree(strval.ptr);
+}
+
+static int
+XInjectResponseHeaders(TSCont contp, TSEvent event, void * edata)
+{
+  TSHttpTxn   txn = (TSHttpTxn)edata;
+  intptr_t    xheaders = 0;
+  TSMBuffer   buffer;
+  TSMLoc      hdr;
+
+  TSReleaseAssert(event == TS_EVENT_HTTP_SEND_RESPONSE_HDR);
+
+  xheaders = (intptr_t)TSHttpTxnArgGet(txn, XArgIndex);
+  if (xheaders == 0) {
+    goto done;
+  }
+
+  if (TSHttpTxnClientRespGet(txn, &buffer, &hdr) == TS_ERROR) {
+    goto done;
+  }
+
+  if (xheaders & XHEADER_X_CACHE_KEY) {
+    InjectCacheKeyHeader(txn, buffer, hdr);
+  }
+
+done:
+  TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
+  return TS_EVENT_NONE;
+}
+
+// Scan the client request headers and determine which debug headers they
+// want in the response.
+static int
+XScanRequestHeaders(TSCont contp, TSEvent event, void * edata)
+{
+  TSHttpTxn   txn = (TSHttpTxn)edata;
+  intptr_t    xheaders = 0;
+  TSMLoc      field, next;
+  TSMBuffer   buffer;
+  TSMLoc      hdr;
+
+  TSReleaseAssert(event == TS_EVENT_HTTP_READ_REQUEST_HDR);
+
+  if (TSHttpTxnClientReqGet(txn, &buffer, &hdr) == TS_ERROR) {
+    goto done;
+  }
+
+  TSDebug("xdebug", "scanning for %s header values", X_DEBUG_HEADER);
+
+  // Walk the X-Debug header values and determine what to inject into the response.
+  field = TSMimeHdrFieldFind(buffer, hdr, X_DEBUG_HEADER, lengthof(X_DEBUG_HEADER));
+  while (field != TS_NULL_MLOC) {
+    int count = TSMimeHdrFieldValuesCount(buffer, hdr, field);
+
+    for (int i = 0; i < count; ++i) {
+      const char * value;
+      int vsize;
+
+      value = TSMimeHdrFieldValueStringGet(buffer, hdr, field, i, &vsize);
+      if (value == NULL || vsize == 0) {
+        continue;
+      }
+
+      if (strncasecmp("x-cache-key", value, vsize) == 0) {
+        xheaders |= XHEADER_X_CACHE_KEY;
+      } else if (strncasecmp("via", value, vsize) == 0) {
+        // If the client requests the Via header, enable verbose Via debugging for this transaction.
+        TSHttpTxnConfigIntSet(txn, TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR, 3);
+      } else {
+        TSDebug("xdebug", "ignoring unrecognized debug tag '%.*s'", vsize, value);
+      }
+    }
+
+    // Get the next duplicate.
+    next = TSMimeHdrFieldNextDup(buffer, hdr, field);
+
+    // Destroy the current field that we have. We don't want this to go through and potentially confuse the origin.
+    TSMimeHdrFieldRemove(buffer, hdr, field);
+    TSMimeHdrFieldDestroy(buffer, hdr, field);
+
+    // Now release our reference.
+    TSHandleMLocRelease(buffer, hdr, field);
+
+    // And go to the next field.
+    field = next;
+  }
+
+  if (xheaders) {
+    TSHttpTxnHookAdd(txn, TS_HTTP_SEND_RESPONSE_HDR_HOOK, XInjectHeadersCont);
+    TSHttpTxnArgSet(txn, XArgIndex, (void *)xheaders);
+  }
+
+done:
+  TSHttpTxnReenable(txn, TS_EVENT_HTTP_CONTINUE);
+  return TS_EVENT_NONE;
+}
+
+void
+TSPluginInit(int argc, const char *argv[])
+{
+  TSPluginRegistrationInfo info;
+
+  info.plugin_name = (char *)"xdebug";
+  info.vendor_name = (char *)"Apache Software Foundation";
+  info.support_email = (char *)"dev@trafficserver.apache.org";
+
+  if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
+    TSError("xdebug plugin registration failed");
+  }
+
+  TSReleaseAssert(
+    TSHttpArgIndexReserve("xdebug", "xdebug header requests" , &XArgIndex) == TS_SUCCESS
+  );
+
+  TSReleaseAssert(
+    XInjectHeadersCont = TSContCreate(XInjectResponseHeaders, NULL)
+  );
+
+  TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(XScanRequestHeaders, NULL));
+}
+
+// vim: set ts=2 sw=2 et :


[27/50] git commit: add TS-2386

Posted by zw...@apache.org.
add TS-2386


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

Branch: refs/heads/5.0.x
Commit: a2de1c05436e90605c2805584252cc428994515c
Parents: 707a5e7
Author: Zhao Yongming <mi...@gmail.com>
Authored: Sat Dec 7 15:49:13 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 15:49:13 2013 +0800

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2de1c05/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 2e1e7b6..965d50d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2386] clean up unused files and codes -- round 4.2
+
   *) [TS-548] remove Initialize.cc Initialize.h
 
   *) [TS-2082] remove STANDALONE_IOCORE FIXME_NONMODULAR and NON_MODULAR defines


[08/50] git commit: TS-2401: Remove global system_runtime_dir

Posted by zw...@apache.org.
TS-2401: Remove global system_runtime_dir

Introduce RecConfigReadRuntimeDir() to centralize overriding
Layout::runtimedir with proxy.config.local_state_dir. Use this to
replace all the instances of system_runtime_dir.


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

Branch: refs/heads/5.0.x
Commit: f438ab45e6c467a6e4fbb595c0547a06e91715d3
Parents: 88f5176
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 21:24:28 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc       | 16 +++++++++-
 example/app-template/app-template.cc |  2 --
 iocore/hostdb/HostDB.cc              | 31 +++++++++++--------
 iocore/hostdb/MultiCache.cc          |  6 ++--
 lib/records/I_RecCore.h              |  4 +++
 lib/records/I_RecDefs.h              |  2 --
 lib/records/RecConfigParse.cc        |  1 +
 lib/records/RecCore.cc               | 16 ++++++++++
 mgmt/LocalManager.cc                 |  5 +++-
 mgmt/Main.cc                         |  8 ++---
 mgmt/ProcessManager.cc               |  4 ++-
 mgmt/web2/WebIntrMain.cc             |  5 ++--
 proxy/Main.cc                        | 49 +++++++++++++------------------
 proxy/StatSystem.cc                  | 20 ++++---------
 proxy/logging/LogStandalone.cc       |  1 -
 15 files changed, 97 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 7a258b8..564f070 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -542,6 +542,20 @@ ConfigIntFatalError:
   exit(1);
 }
 
+static const char *
+config_read_runtime_dir()
+{
+  char state_dir[PATH_NAME_MAX + 1];
+
+  state_dir[0] = '\0';
+  config_read_string("proxy.config.local_state_dir", state_dir, sizeof(state_dir), true);
+  if (strlen(state_dir) > 0) {
+    return Layout::get()->relative(state_dir);
+  } else {
+    return ats_strdup(Layout::get()->runtimedir);
+  }
+}
+
 static void
 config_reload_records()
 {
@@ -1700,7 +1714,7 @@ init_config_dir()
   cop_log_trace("Entering init_config_dir()\n");
 
   root_dir = Layout::get()->prefix;
-  runtime_dir = Layout::get()->runtimedir;
+  runtime_dir = config_read_runtime_dir();
   config_dir = Layout::get()->sysconfdir;
 
   if (chdir(root_dir) < 0) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index 5f8cb6d..af23b2b 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -53,7 +53,6 @@ int system_num_of_processors  = ink_number_of_processors();
 int system_num_of_net_threads = DEFAULT_NUMBER_OF_THREADS;
 int system_num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
 
-char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
 
 //int system_remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
@@ -157,7 +156,6 @@ int main(int argc, char * argv[])
 
   // Get TS directories
   ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory));
-  ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, sizeof(system_runtime_dir));
 
   if (chdir(Layout::get()->prefix) < 0) {
     fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0ffd5bc..e0fe928 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -380,6 +380,8 @@ HostDBCache::start(int flags)
   bool reconfigure = ((flags & PROCESSOR_RECONFIGURE) ? true : false);
   bool fix = ((flags & PROCESSOR_FIX) ? true : false);
 
+  storage_path[0] = '\0';
+
   // Read configuration
   // Command line overrides manager configuration.
   //
@@ -390,20 +392,22 @@ HostDBCache::start(int flags)
   REC_ReadConfigString(storage_path, "proxy.config.hostdb.storage_path", PATH_NAME_MAX);
   REC_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
 
-  if (storage_path[0] != '/') {
-    Layout::relative_to(storage_path, PATH_NAME_MAX, Layout::get()->prefix, storage_path);
+  // If proxy.config.hostdb.storage_path is not set, use the local state dir. If it is set to
+  // a relative path, make it relative to the prefix.
+  if (storage_path[0] == '\0') {
+    xptr<char> rundir(RecConfigReadRuntimeDir());
+    ink_strlcpy(storage_path, rundir, sizeof(storage_path));
+  } else if (storage_path[0] != '/') {
+    Layout::relative_to(storage_path, sizeof(storage_path), Layout::get()->prefix, storage_path);
   }
 
   Debug("hostdb", "Storage path is %s", storage_path);
 
-  // XXX: Should this be W_OK?
-  if (access(storage_path, R_OK) == -1) {
-    ink_strlcpy(storage_path, system_runtime_dir, sizeof(storage_path));
-    if (access(storage_path, R_OK) == -1) {
-      Warning("Unable to access() directory '%s': %d, %s", storage_path, errno, strerror(errno));
-      Warning(" Please set 'proxy.config.hostdb.storage_path' or 'proxy.config.local_state_dir' ");
-    }
+  if (access(storage_path, W_OK | R_OK) == -1) {
+    Warning("Unable to access() directory '%s': %d, %s", storage_path, errno, strerror(errno));
+    Warning("Please set 'proxy.config.hostdb.storage_path' or 'proxy.config.local_state_dir'");
   }
+
   hostDBStore = NEW(new Store);
   hostDBSpan = NEW(new Span);
   hostDBSpan->init(storage_path, storage_size);
@@ -411,12 +415,13 @@ HostDBCache::start(int flags)
 
   Debug("hostdb", "Opening %s, size=%d", hostdb_filename, hostdb_size);
   if (open(hostDBStore, "hostdb.config", hostdb_filename, hostdb_size, reconfigure, fix, false /* slient */ ) < 0) {
+    xptr<char> rundir(RecConfigReadRuntimeDir());
+    xptr<char> config(Layout::relative_to(rundir, "hostdb.config"));
+
     Note("reconfiguring host database");
 
-    char p[PATH_NAME_MAX + 1];
-    Layout::relative_to(p, PATH_NAME_MAX, system_runtime_dir, "hostdb.config");
-    if (unlink(p) < 0)
-      Debug("hostdb", "unable to unlink %s", p);
+    if (unlink(config) < 0)
+      Debug("hostdb", "unable to unlink %s", (const char *)config);
 
     delete hostDBStore;
     hostDBStore = NEW(new Store);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index bd0fdb0..b153d75 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -501,9 +501,10 @@ int
 MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, int *pi, int *pbuck)
 {
   int scratch;
+  xptr<char> rundir(RecConfigReadRuntimeDir());
   char p[PATH_NAME_MAX + 1], buf[256];
 
-  Layout::relative_to(p, sizeof(p), system_runtime_dir, config_filename);
+  Layout::relative_to(p, sizeof(p), rundir, config_filename);
 
   int fd =::open(p, O_RDONLY);
   if (fd < 0)
@@ -537,10 +538,11 @@ MultiCacheBase::read_config(const char *config_filename, Store & s, char *fn, in
 int
 MultiCacheBase::write_config(const char *config_filename, int nominal_size, int abuckets)
 {
+  xptr<char> rundir(RecConfigReadRuntimeDir());
   char p[PATH_NAME_MAX + 1], buf[256];
   int fd, retcode = -1;
 
-  Layout::relative_to(p, sizeof(p), system_runtime_dir, config_filename);
+  Layout::relative_to(p, sizeof(p), rundir, config_filename);
 
   // XXX: Shouldn't that be 0664?
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index dda8f44..86f6595 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -45,6 +45,10 @@ typedef void (*RecConfigEntryCallback)(RecT rec_type, RecDataT data_type, const
 void RecConfigFileInit(void);
 int RecConfigFileParse(const char * path, RecConfigEntryCallback handler, bool inc_version);
 
+// Return a copy of the system's local state directory, taking proxy.config.local_state_dir into account. The
+// caller MUST releease the result with ats_free().
+char * RecConfigReadRuntimeDir();
+
 // Test whether the named configuration value is overridden by an environment variable. Return either
 // the overridden value, or the original value. Caller MUST NOT free the result.
 const char * RecConfigOverrideFromEnvironment(const char * name, const char * value);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index 302b3c9..928a5ac 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -175,9 +175,7 @@ typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData *
 #define REC_VAR_NAME_DELIMITOR '.'
 #define REC_VAR_NAME_WILDCARD  '*'
 
-
 // System Defaults
-extern char system_runtime_dir[PATH_NAME_MAX + 1];
 extern char system_config_directory[PATH_NAME_MAX + 1];
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/RecConfigParse.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc
index 0ab0726..21319b4 100644
--- a/lib/records/RecConfigParse.cc
+++ b/lib/records/RecConfigParse.cc
@@ -30,6 +30,7 @@
 #include "P_RecUtils.h"
 #include "P_RecMessage.h"
 #include "P_RecCore.h"
+#include "I_Layout.h"
 
 const char     *g_rec_config_fpath = NULL;
 LLQ            *g_rec_config_contents_llq = NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 0aee4bd..50485fa 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1053,6 +1053,22 @@ REC_readString(const char *name, bool * found, bool lock)
   return _tmp;
 }
 
+//-------------------------------------------------------------------------
+// RecConfigReadRuntimeDir
+//-------------------------------------------------------------------------
+char *
+RecConfigReadRuntimeDir()
+{
+  char buf[PATH_NAME_MAX + 1];
+
+  buf[0] = '\0';
+  RecGetRecordString("proxy.config.local_state_dir", buf, PATH_NAME_MAX);
+  if (strlen(buf) > 0) {
+    return Layout::get()->relative(buf);
+  } else {
+    return ats_strdup(Layout::get()->runtimedir);
+  }
+}
 
 //-------------------------------------------------------------------------
 // REC_SignalManager (TS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 12adb34..4572b57 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -204,6 +204,8 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
   : BaseManager(), run_proxy(proxy_on)
 {
   bool found;
+  xptr<char> rundir(RecConfigReadRuntimeDir());
+
 #ifdef MGMT_USE_SYSLOG
   syslog_facility = 0;
 #endif
@@ -221,7 +223,8 @@ LocalManager::LocalManager(char * /* mpath ATS_UNUSED */, bool proxy_on)
     mgmt_log("Bad or missing proxy.config.lm.sem_id value; using default id %d\n", MGMT_SEMID_DEFAULT);
     mgmt_sync_key = MGMT_SEMID_DEFAULT;
   }
-  ink_strlcpy(pserver_path, system_runtime_dir, sizeof(pserver_path));
+
+  ink_strlcpy(pserver_path, rundir, sizeof(pserver_path));
 
   virt_map = NULL;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index c8e1a33..c33f564 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -78,7 +78,6 @@ static char action_tags[1024] = "";
 static bool proxy_on = true;
 
 // TODO: Check if really need those
-char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
 
 char mgmt_path[PATH_NAME_MAX + 1];
@@ -267,6 +266,7 @@ setup_coredump()
 static void
 init_dirs()
 {
+  xptr<char> rundir(RecConfigReadRuntimeDir());
   char buf[PATH_NAME_MAX + 1];
 
   REC_ReadConfigString(buf, "proxy.config.config_dir", PATH_NAME_MAX);
@@ -279,10 +279,8 @@ init_dirs()
 
   ink_strlcpy(mgmt_path, system_config_directory, sizeof(mgmt_path));
 
-  REC_ReadConfigString(buf, "proxy.config.local_state_dir", PATH_NAME_MAX);
-  Layout::get()->relative(system_runtime_dir, PATH_NAME_MAX, buf);
-  if (access(system_runtime_dir, R_OK) == -1) {
-    mgmt_elog(0, "unable to access() local state dir '%s': %d, %s\n", system_runtime_dir, errno, strerror(errno));
+  if (access(rundir, R_OK) == -1) {
+    mgmt_elog(0, "unable to access() local state dir '%s': %d, %s\n", (const char *)rundir, errno, strerror(errno));
     mgmt_elog(0, "please set 'proxy.config.local_state_dir'\n");
     _exit(1);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/ProcessManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc
index 6e69f96..35bbae6 100644
--- a/mgmt/ProcessManager.cc
+++ b/mgmt/ProcessManager.cc
@@ -69,7 +69,9 @@ startProcessManager(void *arg)
 ProcessManager::ProcessManager(bool rlm):
 BaseManager(), require_lm(rlm), mgmt_sync_key(0), local_manager_sockfd(0), cbtable(NULL)
 {
-  ink_strlcpy(pserver_path, Layout::get()->runtimedir, sizeof(pserver_path));
+  xptr<char> rundir(RecConfigReadRuntimeDir());
+
+  ink_strlcpy(pserver_path, rundir, sizeof(pserver_path));
   mgmt_signal_queue = create_queue();
 
   // Set temp. process/manager timeout. Will be reconfigure later.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/mgmt/web2/WebIntrMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/web2/WebIntrMain.cc b/mgmt/web2/WebIntrMain.cc
index ff29c97..c3a6732 100644
--- a/mgmt/web2/WebIntrMain.cc
+++ b/mgmt/web2/WebIntrMain.cc
@@ -432,11 +432,12 @@ webIntr_main(void *)
   // set up socket paths;
   char api_sock_path[1024];
   char event_sock_path[1024];
+  xptr<char> rundir(RecConfigReadRuntimeDir());
 
   bzero(api_sock_path, 1024);
   bzero(event_sock_path, 1024);
-  snprintf(api_sock_path, sizeof(api_sock_path), "%s/mgmtapisocket", system_runtime_dir);
-  snprintf(event_sock_path, sizeof(event_sock_path), "%s/eventapisocket", system_runtime_dir);
+  snprintf(api_sock_path, sizeof(api_sock_path), "%s/mgmtapisocket", (const char *)rundir);
+  snprintf(event_sock_path, sizeof(event_sock_path), "%s/eventapisocket", (const char *)rundir);
 
   // INKqa12562: MgmtAPI sockets should be created with 775 permission
   mode_t oldmask = umask(S_IWOTH);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index ec75cef..2f3e19e 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -144,7 +144,6 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST;
 static char command_string[512] = "";
 int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
-char system_runtime_dir[PATH_NAME_MAX + 1];  // Layout->runtimedir
 char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
 
 static char error_tags[1024] = "";
@@ -247,24 +246,19 @@ init_system()
 static void
 check_lockfile()
 {
-  char *lockfile = NULL;
+  xptr<char> rundir(RecConfigReadRuntimeDir());
+  xptr<char> lockfile;
   pid_t holding_pid;
   int err;
 
-  if (access(Layout::get()->runtimedir, R_OK | W_OK) == -1) {
-    fprintf(stderr,"unable to access() dir'%s': %d, %s\n",
-            Layout::get()->runtimedir, errno, strerror(errno));
-    fprintf(stderr," please set correct path in env variable TS_ROOT \n");
-    _exit(1);
-  }
-  lockfile = Layout::relative_to(Layout::get()->runtimedir, SERVER_LOCK);
+  lockfile = Layout::relative_to(rundir, SERVER_LOCK);
 
   Lockfile server_lockfile(lockfile);
   err = server_lockfile.Get(&holding_pid);
 
   if (err != 1) {
     char *reason = strerror(-err);
-    fprintf(stderr, "WARNING: Can't acquire lockfile '%s'", lockfile);
+    fprintf(stderr, "WARNING: Can't acquire lockfile '%s'", (const char *)lockfile);
 
     if ((err == 0) && (holding_pid != -1)) {
       fprintf(stderr, " (Lock file held by process ID %ld)\n", (long)holding_pid);
@@ -277,16 +271,16 @@ check_lockfile()
     }
     _exit(1);
   }
-  ats_free(lockfile);
 }
 
 static void
 init_dirs(void)
 {
+  xptr<char> rundir(RecConfigReadRuntimeDir());
+
   char buf[PATH_NAME_MAX + 1];
 
   ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, PATH_NAME_MAX);
-  ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, PATH_NAME_MAX);
 
   /*
    * XXX: There is not much sense in the following code
@@ -305,15 +299,11 @@ init_dirs(void)
     }
   }
 
-  if (access(system_runtime_dir, R_OK | W_OK) == -1) {
-    REC_ReadConfigString(buf, "proxy.config.local_state_dir", PATH_NAME_MAX);
-    Layout::get()->relative(system_runtime_dir, PATH_NAME_MAX, buf);
-    if (access(system_runtime_dir, R_OK | W_OK) == -1) {
-      fprintf(stderr,"unable to access() local state dir '%s': %d, %s\n",
-              system_runtime_dir, errno, strerror(errno));
-      fprintf(stderr,"please set 'proxy.config.local_state_dir'\n");
-      _exit(1);
-    }
+  if (access(rundir, R_OK | W_OK) == -1) {
+    fprintf(stderr,"unable to access() local state dir '%s': %d, %s\n",
+            (const char *)rundir, errno, strerror(errno));
+    fprintf(stderr,"please set 'proxy.config.local_state_dir'\n");
+    _exit(1);
   }
 
 }
@@ -553,12 +543,13 @@ cmd_clear(char *cmd)
   //bool c_adb = !strcmp(cmd, "clear_authdb");
   bool c_cache = !strcmp(cmd, "clear_cache");
 
-  char p[PATH_NAME_MAX];
   if (c_all || c_hdb) {
-    Note("Clearing Configuration");
-    Layout::relative_to(p, sizeof(p), system_runtime_dir, "hostdb.config");
-    if (unlink(p) < 0)
-      Note("unable to unlink %s", p);
+    xptr<char> rundir(RecConfigReadRuntimeDir());
+    xptr<char> config(Layout::relative_to(rundir, "hostdb.config"));
+
+    Note("Clearing HostDB Configuration");
+    if (unlink(config) < 0)
+      Note("unable to unlink %s", (const char *)config);
   }
 
   if (c_all || c_cache) {
@@ -569,6 +560,7 @@ cmd_clear(char *cmd)
       return CMD_FAILED;
     }
   }
+
   if (c_hdb || c_all) {
     Note("Clearing Host Database");
     if (hostDBProcessor.cache()->start(PROCESSOR_RECONFIGURE) < 0) {
@@ -1288,8 +1280,6 @@ main(int /* argc ATS_UNUSED */, char **argv)
     fprintf(stderr, "%s\n", appVersionInfo.FullVersionInfoStr);
     _exit(0);
   }
-  // Ensure only one copy of traffic server is running
-  check_lockfile();
 
   // Set stdout/stdin to be unbuffered
   setbuf(stdout, NULL);
@@ -1321,6 +1311,9 @@ main(int /* argc ATS_UNUSED */, char **argv)
   // Local process manager
   initialize_process_manager();
 
+  // Ensure only one copy of traffic server is running
+  check_lockfile();
+
   // Set the core limit for the process
   init_core_size();
   init_system();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/StatSystem.cc
----------------------------------------------------------------------
diff --git a/proxy/StatSystem.cc b/proxy/StatSystem.cc
index bdde869..87647eb 100644
--- a/proxy/StatSystem.cc
+++ b/proxy/StatSystem.cc
@@ -474,24 +474,14 @@ initialize_all_global_stats()
 {
   int istat, i;
   char snap_file[PATH_NAME_MAX + 1];
-  char local_state_dir[PATH_NAME_MAX + 1];
+  xptr<char> rundir(RecConfigReadRuntimeDir());
 
-  // Jira TS-21
-  REC_ReadConfigString(local_state_dir, "proxy.config.local_state_dir", PATH_NAME_MAX);
-  if (local_state_dir[0] != '/') {
-    // Not an absolute path
-    Layout::get()->relative(local_state_dir, sizeof(local_state_dir), local_state_dir);
-  }
-  if (access(local_state_dir, R_OK | W_OK) == -1) {
-    ink_strlcpy(local_state_dir, system_runtime_dir, sizeof(local_state_dir));
-    if (access(local_state_dir, R_OK | W_OK) == -1) {
-      Warning("Unable to access() local state directory '%s': %d, %s", local_state_dir, errno, strerror(errno));
-      Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");
-    }
+  if (access(rundir, R_OK | W_OK) == -1) {
+    Warning("Unable to access() local state directory '%s': %d, %s", (const char *)rundir, errno, strerror(errno));
+    Warning(" Please set 'proxy.config.local_state_dir' to allow statistics collection");
   }
   REC_ReadConfigString(snap_file, "proxy.config.stats.snap_file", PATH_NAME_MAX);
-  Layout::relative_to(snap_filename, sizeof(snap_filename),
-                      local_state_dir, snap_file);
+  Layout::relative_to(snap_filename, sizeof(snap_filename), (const char *)rundir, snap_file);
   Debug("stats", "stat snap filename %s", snap_filename);
 
   statPagesManager.register_http("stat", stat_callback);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f438ab45/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 5bf3b6f..e731851 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -57,7 +57,6 @@ int auto_clear_hostdb_flag = 0;
 char proxy_name[MAXDNAME + 1] = "unknown";
 
 char system_config_directory[PATH_NAME_MAX + 1] = "";
-char system_runtime_dir[PATH_NAME_MAX + 1] = "";
 
 char error_tags[1024] = "";
 char action_tags[1024] = "";


[12/50] git commit: TS-1146: RFC 5077 TLS session tickets

Posted by zw...@apache.org.
TS-1146: RFC 5077 TLS session tickets

For supporting RFC 5077 TLS Session tickets across a ATS cluster,
all the machines need to have the same server ticket. Add
ssl_multicert.config support for specifying a common session ticket
key.


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

Branch: refs/heads/5.0.x
Commit: 8dbf06bf30f618aac4c1fc5c87afe7aa38569d33
Parents: 16882d8
Author: Wei Sun <su...@yahoo-inc.com>
Authored: Fri Dec 6 10:18:39 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 6 10:20:35 2013 -0800

----------------------------------------------------------------------
 CHANGES                                         |   3 +
 .../configuration/ssl_multicert.config.en.rst   |  57 +++++--
 iocore/net/P_SSLUtils.h                         |   3 +
 iocore/net/SSLCertLookup.cc                     |   2 +-
 iocore/net/SSLUtils.cc                          | 164 ++++++++++++++++++-
 iocore/net/test_certlookup.cc                   |   9 +
 6 files changed, 221 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 309edcf..429ac04 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-1146] Add RFC 5077 TLS session ticket support.
+   Author: Wei Sun <su...@yahoo-inc.com>
+
   *) [TS-2401] Use Layout instead of global install path directories.
 
   *) [TS-2420] Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule those

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/doc/reference/configuration/ssl_multicert.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/ssl_multicert.config.en.rst b/doc/reference/configuration/ssl_multicert.config.en.rst
index 9098fc7..39fda6f 100644
--- a/doc/reference/configuration/ssl_multicert.config.en.rst
+++ b/doc/reference/configuration/ssl_multicert.config.en.rst
@@ -5,9 +5,9 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
- 
+
    http://www.apache.org/licenses/LICENSE-2.0
- 
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -46,8 +46,8 @@ Each :file:`ssl_multicert.config` line consists of a sequence of
 `key=value` fields that specify how Traffic Server should use a
 particular SSL certificate.
 
-ssl_cert_name=PATH
-  The name of the file containing the TLS certificate. `PATH` is
+ssl_cert_name=FILENAME
+  The name of the file containing the TLS certificate. `FILENAME` is
   located relative to the directory specified by the
   :ts:cv:`proxy.config.ssl.server.cert.path` configuration variable.
   This is the only field that is required to be present.
@@ -55,26 +55,45 @@ ssl_cert_name=PATH
 dest_ip=ADDRESS
   The IP (v4 or v6) address that the certificate should be presented
   on. This is now only used as a fallback in the case that the TLS
-  SubjectNameIndication extension is not supported. If `ADDRESS`
-  is `*`, the corresponding certificate will be used as the global
+  SubjectNameIndication extension is not supported. If `ADDRESS` is
+  `*`, the corresponding certificate will be used as the global
   default fallback if no other match can be made.  The address may
   contain a port specifier, in which case the corresponding certificate
   will only match for connections accepted on the specified port.
   IPv6 addresses must be enclosed by square brackets if they have
   a port, eg, [::1]:80.
 
-ssl_key_name=PATH
+ssl_key_name=FILENAME
   The name of the file containing the private key for this certificate.
   If the key is contained in the certificate file, this field can
-  be omitted, otherwise `PATH` is resolved relative to the
+  be omitted, otherwise `FILENAME` is resolved relative to the
   :ts:cv:`proxy.config.ssl.server.private_key.path` configuration variable.
 
 ssl_ca_name=FILENAME
   If the certificate is issued by an authority that is not in the
   system CA bundle, additional certificates may be needed to validate
-  the certificate chain. `PATH` is resolved relative to the
+  the certificate chain. `FILENAME` is resolved relative to the
   :ts:cv:`proxy.config.ssl.CA.cert.path` configuration variable.
 
+ssl_ticket_enabled=1|0
+  Enable :rfc:`5077` stateless TLS session tickets. To support this,
+  OpenSSL should be upgraded to version 0.9.8f or higher. This
+  option must be set to `0` to disable session ticket support.
+
+ticket_key_name=FILENAME
+  The name of session ticket key file which contains a secret for
+  encrypting and decrypting TLS session tickets. If `FILENAME` is
+  not an absolute path, it is resolved relative to the
+  :ts:cv:`proxy.config.ssl.server.cert.path` configuration variable.
+  This option has no effect if session tickets are disabled by the
+  ``ssl_ticket_enabled`` option.  The contents of the key file should
+  be 48 random bytes.
+
+  Session ticket support is enabled by default. If neither of the
+  ``ssl_ticket_enabled`` and ``ticket_key_name`` options are
+  specified, and internal session tiucket key is generated. This
+  key will be different each time Traffic Server is started.
+
 Certificate Selection
 =====================
 
@@ -98,7 +117,6 @@ take precedence over a specification that does not contain a port
 number. A specific certificate subject will take precedence over a
 wildcard certificate.
 
-
 Examples
 ========
 
@@ -123,6 +141,21 @@ for all requests to port 8443 on IP address 111.11.11.1. The
 
 ::
 
-     dest_ip=111.11.11.1:8443 ssl_cert_name=server.pem ssl_key_name=serverKey.pem
-     ssl_cert_name=general.pem
+     dest_ip=111.11.11.1:8443 ssl_cert_name=server.pem ssl_key_name=serverKey.pem ssl_cert_name=general.pem
+
+The following example configures Traffic Server to use the SSL
+certificate ``server.pem`` for all requests to the IP address
+111.11.11.1. Session tickets are enabled with a persistent ticket
+key.
+
+::
+
+    dest_ip=111.11.11.1 ssl_cert_name=server.pem ssl_ticket_enabled=1 ticket_key_name=ticket.key
+
+The following example configures Traffic Server to use the SSL
+certificate ``server.pem`` and disable sessiont ticket for all
+requests to the IP address 111.11.11.1.
+
+::
 
+    dest_ip=111.11.11.1 ssl_cert_name=server.pem ssl_ticket_enabled=0

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/iocore/net/P_SSLUtils.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLUtils.h b/iocore/net/P_SSLUtils.h
index 4f1ec96..289ff99 100644
--- a/iocore/net/P_SSLUtils.h
+++ b/iocore/net/P_SSLUtils.h
@@ -53,6 +53,9 @@ SSL_CTX * SSLInitClientContext(const SSLConfigParams * param);
 // Initialize the SSL library.
 void SSLInitializeLibrary();
 
+// Release SSL_CTX and the associated data
+void SSLReleaseContext(SSL_CTX* ctx);
+
 // Log an SSL error.
 #define SSLError(fmt, ...) SSLDiagnostic(DiagsMakeLocation(), false, fmt, ##__VA_ARGS__)
 // Log a SSL diagnostic using the "ssl" diagnostic tag.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/iocore/net/SSLCertLookup.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index 5715cdf..fe14369 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -206,7 +206,7 @@ SSLContextStorage::SSLContextStorage()
 SSLContextStorage::~SSLContextStorage()
 {
   for (unsigned i = 0; i < this->references.count(); ++i) {
-    SSL_CTX_free(this->references[i]);
+    SSLReleaseContext(this->references[i]);
   }
 
   ink_hash_table_destroy(this->hostnames);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 020c16b..a958b4a 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -29,6 +29,8 @@
 #include <openssl/pem.h>
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
+#include <openssl/rand.h>
+#include <openssl/evp.h>
 
 #if HAVE_OPENSSL_TS_H
 #include <openssl/ts.h>
@@ -43,6 +45,16 @@
 #define SSL_CERT_TAG          "ssl_cert_name"
 #define SSL_PRIVATE_KEY_TAG   "ssl_key_name"
 #define SSL_CA_TAG            "ssl_ca_name"
+#define SSL_SESSION_TICKET_ENABLED "ssl_ticket_enabled"
+#define SSL_SESSION_TICKET_KEY_FILE_TAG "ticket_key_name"
+
+#ifndef evp_md_func
+#ifdef OPENSSL_NO_SHA256
+    #define evp_md_func EVP_sha1()
+#else
+    #define evp_md_func EVP_sha256()
+#endif
+#endif
 
 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) // openssl returns a const SSL_METHOD
 typedef const SSL_METHOD * ink_ssl_method_t;
@@ -50,8 +62,17 @@ typedef const SSL_METHOD * ink_ssl_method_t;
 typedef SSL_METHOD * ink_ssl_method_t;
 #endif
 
+struct ssl_ticket_key_t
+{
+    unsigned char key_name[16];
+    unsigned char hmac_secret[16];
+    unsigned char aes_key[16];
+};
+
 static ProxyMutex ** sslMutexArray;
 static bool open_ssl_initialized = false;
+static int ssl_callback_session_ticket(SSL *, unsigned char *, unsigned char *, EVP_CIPHER_CTX *, HMAC_CTX *, int);
+static int ssl_session_ticket_index = 0;
 
 struct ats_file_bio
 {
@@ -208,6 +229,50 @@ ssl_context_enable_ecdh(SSL_CTX * ctx)
   return ctx;
 }
 
+static SSL_CTX *
+ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
+{
+  xptr<char>          ticket_key_data;
+  int                 ticket_key_len;
+  ssl_ticket_key_t *  ticket_key = NULL;
+
+  ticket_key_data = readIntoBuffer(ticket_key_path, __func__, &ticket_key_len);
+  if (!ticket_key_data) {
+      Error("failed to read SSL session ticket key from %s", (const char *)ticket_key_path);
+      goto fail;
+  }
+
+  if (ticket_key_len < 48) {
+      Error("SSL session ticket key from %s is too short (48 bytes are required)", (const char *)ticket_key_path);
+      goto fail;
+  }
+
+  ticket_key = NEW(new ssl_ticket_key_t());
+  memcpy(ticket_key->key_name, (const char *)ticket_key_data, 16);
+  memcpy(ticket_key->hmac_secret, (const char *)ticket_key_data + 16, 16);
+  memcpy(ticket_key->aes_key, (const char *)ticket_key_data + 32, 16);
+
+  // Setting the callback can only fail if OpenSSL does not recognize the
+  // SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB constant. we set the callback first
+  // so that we don't leave a ticket_key pointer attached if it fails.
+  if (SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket) == 0) {
+      Error("failed to set session ticket callback");
+      goto fail;
+  }
+
+  if (SSL_CTX_set_ex_data(ctx, ssl_session_ticket_index, ticket_key) == 0) {
+      Error ("failed to set session ticket data to ctx");
+      goto fail;
+  }
+
+  SSL_CTX_clear_options(ctx, SSL_OP_NO_TICKET);
+  return ctx;
+
+fail:
+  delete ticket_key;
+  return ctx;
+}
+
 void
 SSLInitializeLibrary()
 {
@@ -227,6 +292,12 @@ SSLInitializeLibrary()
     CRYPTO_set_id_callback(SSL_pthreads_thread_id);
   }
 
+  int iRet = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
+  if (iRet == -1) {
+    SSLError("failed to create session ticket index");
+  }
+  ssl_session_ticket_index = (iRet == -1 ? 0 : iRet);
+
   open_ssl_initialized = true;
 }
 
@@ -577,10 +648,13 @@ ssl_store_ssl_context(
     xptr<char>& addr,
     xptr<char>& cert,
     xptr<char>& ca,
-    xptr<char>& key)
+    xptr<char>& key,
+    const int session_ticket_enabled,
+    xptr<char>& ticket_key_filename)
 {
   SSL_CTX *   ctx;
   xptr<char>  certpath;
+  xptr<char>  session_key_path;
 
   ctx = ssl_context_enable_sni(SSLInitServerContext(params, cert, ca, key), lookup);
   if (!ctx) {
@@ -610,10 +684,23 @@ ssl_store_ssl_context(
     }
   }
 
+  // Session tickets are enabled by default. Disable if explicitly requested.
+  if (session_ticket_enabled == 0) {
+      SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
+      Debug("ssl", "ssl session ticket is disabled");
+  }
+
+  // Load the session ticket key if session tickets are not disabled and we have key name.
+  if (session_ticket_enabled != 0 && ticket_key_filename) {
+    xptr<char> ticket_key_path(Layout::relative_to(params->serverCertPathOnly, ticket_key_filename));
+    ssl_context_enable_tickets(ctx, ticket_key_path);
+  }
+
   // Insert additional mappings. Note that this maps multiple keys to the same value, so when
   // this code is updated to reconfigure the SSL certificates, it will need some sort of
   // refcounting or alternate way of avoiding double frees.
   ssl_index_certificate(lookup, ctx, certpath);
+
   return true;
 }
 
@@ -623,7 +710,9 @@ ssl_extract_certificate(
     xptr<char>& addr,   // IPv[64] address to match
     xptr<char>& cert,   // certificate
     xptr<char>& ca,     // CA public certificate
-    xptr<char>& key)    // Private key
+    xptr<char>& key,    // Private key
+    int&  session_ticket_enabled,  // session ticket enabled
+    xptr<char>& ticket_key_filename) // session key file. [key_name (16Byte) + HMAC_secret (16Byte) + AES_key (16Byte)]
 {
   for (int i = 0; i < MATCHER_MAX_TOKENS; ++i) {
     const char * label;
@@ -651,6 +740,14 @@ ssl_extract_certificate(
     if (strcasecmp(label, SSL_PRIVATE_KEY_TAG) == 0) {
       key = ats_strdup(value);
     }
+
+    if (strcasecmp(label, SSL_SESSION_TICKET_ENABLED) == 0) {
+      session_ticket_enabled = atoi(value);
+    }
+
+    if (strcasecmp(label, SSL_SESSION_TICKET_KEY_FILE_TAG) == 0) {
+      ticket_key_filename = ats_strdup(value);
+    }
   }
 
   if (!cert) {
@@ -705,6 +802,8 @@ SSLParseCertificateConfiguration(
       xptr<char> cert;
       xptr<char> ca;
       xptr<char> key;
+      int session_ticket_enabled = -1;
+      xptr<char> ticket_key_filename;
       const char * errPtr;
 
       errPtr = parseConfigLine(line, &line_info, &sslCertTags);
@@ -714,8 +813,8 @@ SSLParseCertificateConfiguration(
                      __func__, params->configFilePath, line_num, errPtr);
         REC_SignalError(errBuf, alarmAlready);
       } else {
-        if (ssl_extract_certificate(&line_info, addr, cert, ca, key)) {
-          if (!ssl_store_ssl_context(params, lookup, addr, cert, ca, key)) {
+        if (ssl_extract_certificate(&line_info, addr, cert, ca, key, session_ticket_enabled, ticket_key_filename)) {
+          if (!ssl_store_ssl_context(params, lookup, addr, cert, ca, key, session_ticket_enabled, ticket_key_filename)) {
             Error("failed to load SSL certificate specification from %s line %u",
                 params->configFilePath, line_num);
           }
@@ -741,3 +840,60 @@ SSLParseCertificateConfiguration(
 
   return true;
 }
+
+/*
+ * RFC 5077. Create session ticket to resume SSL session without requiring session-specific state at the TLS server.
+ * Specifically, it distributes the encrypted session-state information to the client in the form of a ticket and
+ * a mechanism to present the ticket back to the server.
+ * */
+int ssl_callback_session_ticket(SSL *ssl,
+                               unsigned char *keyname,
+                               unsigned char *iv,
+                               EVP_CIPHER_CTX *cipher_ctx,
+                               HMAC_CTX *hctx,
+                               int enc)
+{
+    ssl_ticket_key_t* ssl_ticket_key = (ssl_ticket_key_t*) SSL_CTX_get_ex_data(SSL_get_SSL_CTX(ssl), ssl_session_ticket_index);
+    if (NULL == ssl_ticket_key) {
+        Error("ssl ticket key is null.");
+        return -1;
+    }
+
+    if (enc == 1) {
+        memcpy(keyname, ssl_ticket_key->key_name, 16);
+        RAND_pseudo_bytes(iv, EVP_MAX_IV_LENGTH);
+        EVP_EncryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL,
+                           ssl_ticket_key->aes_key, iv);
+        HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
+        Note("create ticket for a new session");
+
+        return 0;
+    } else if (enc == 0) {
+        if (memcmp(keyname, ssl_ticket_key->key_name, 16)) {
+            Error("keyname is not consistent.");
+            return 0;
+        }
+
+        EVP_DecryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL,
+                           ssl_ticket_key->aes_key, iv);
+        HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
+
+        Note("verify the ticket for an existing session." );
+        return 1;
+    }
+
+    return -1;
+}
+
+void
+SSLReleaseContext(SSL_CTX * ctx)
+{
+   ssl_ticket_key_t * ssl_ticket_key = (ssl_ticket_key_t*)SSL_CTX_get_ex_data(ctx, ssl_session_ticket_index);
+
+   // Free the ticket if this is the last reference.
+   if (ctx->references == 1 && ssl_ticket_key) {
+       delete ssl_ticket_key;
+   }
+
+   SSL_CTX_free(ctx);
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbf06bf/iocore/net/test_certlookup.cc
----------------------------------------------------------------------
diff --git a/iocore/net/test_certlookup.cc b/iocore/net/test_certlookup.cc
index 9327258..e0ba053 100644
--- a/iocore/net/test_certlookup.cc
+++ b/iocore/net/test_certlookup.cc
@@ -175,6 +175,15 @@ load_hostnames_csv(const char * fname, SSLCertLookup& lookup)
   return count;
 }
 
+// This stub version of SSLReleaseContext saves us from having to drag in a lot
+// of binary dependencies. We don't have session tickets in this test environment
+// so it's safe to do this; just a bit ugly.
+void
+SSLReleaseContext(SSL_CTX * ctx)
+{
+   SSL_CTX_free(ctx);
+}
+
 int main(int argc, const char ** argv)
 {
   res_track_memory = 1;


[15/50] git commit: TS-1146: consistently apply 2char indentation

Posted by zw...@apache.org.
TS-1146: consistently apply 2char indentation


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

Branch: refs/heads/5.0.x
Commit: 0850f4c3a833a76779be65b769fc0e239e6fc93f
Parents: eaaf889
Author: James Peach <jp...@apache.org>
Authored: Fri Dec 6 14:38:40 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 6 14:39:10 2013 -0800

----------------------------------------------------------------------
 iocore/net/SSLUtils.cc | 141 ++++++++++++++++++++++----------------------
 1 file changed, 71 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0850f4c3/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index a958b4a..ce1d383 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -50,9 +50,9 @@
 
 #ifndef evp_md_func
 #ifdef OPENSSL_NO_SHA256
-    #define evp_md_func EVP_sha1()
+#define evp_md_func EVP_sha1()
 #else
-    #define evp_md_func EVP_sha256()
+#define evp_md_func EVP_sha256()
 #endif
 #endif
 
@@ -64,9 +64,9 @@ typedef SSL_METHOD * ink_ssl_method_t;
 
 struct ssl_ticket_key_t
 {
-    unsigned char key_name[16];
-    unsigned char hmac_secret[16];
-    unsigned char aes_key[16];
+  unsigned char key_name[16];
+  unsigned char hmac_secret[16];
+  unsigned char aes_key[16];
 };
 
 static ProxyMutex ** sslMutexArray;
@@ -76,24 +76,24 @@ static int ssl_session_ticket_index = 0;
 
 struct ats_file_bio
 {
-    ats_file_bio(const char * path, const char * mode)
-      : bio(BIO_new_file(path, mode)) {
-    }
+  ats_file_bio(const char * path, const char * mode)
+    : bio(BIO_new_file(path, mode)) {
+  }
 
-    ~ats_file_bio() {
-        (void)BIO_set_close(bio, BIO_CLOSE);
-        BIO_free(bio);
-    }
+  ~ats_file_bio() {
+    (void)BIO_set_close(bio, BIO_CLOSE);
+    BIO_free(bio);
+  }
 
-    operator bool() const {
-        return bio != NULL;
-    }
+  operator bool() const {
+    return bio != NULL;
+  }
 
-    BIO * bio;
+  BIO * bio;
 
 private:
-    ats_file_bio(const ats_file_bio&);
-    ats_file_bio& operator=(const ats_file_bio&);
+  ats_file_bio(const ats_file_bio&);
+  ats_file_bio& operator=(const ats_file_bio&);
 };
 
 static unsigned long
@@ -238,13 +238,13 @@ ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
 
   ticket_key_data = readIntoBuffer(ticket_key_path, __func__, &ticket_key_len);
   if (!ticket_key_data) {
-      Error("failed to read SSL session ticket key from %s", (const char *)ticket_key_path);
-      goto fail;
+    Error("failed to read SSL session ticket key from %s", (const char *)ticket_key_path);
+    goto fail;
   }
 
   if (ticket_key_len < 48) {
-      Error("SSL session ticket key from %s is too short (48 bytes are required)", (const char *)ticket_key_path);
-      goto fail;
+    Error("SSL session ticket key from %s is too short (48 bytes are required)", (const char *)ticket_key_path);
+    goto fail;
   }
 
   ticket_key = NEW(new ssl_ticket_key_t());
@@ -256,13 +256,13 @@ ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
   // SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB constant. we set the callback first
   // so that we don't leave a ticket_key pointer attached if it fails.
   if (SSL_CTX_set_tlsext_ticket_key_cb(ctx, ssl_callback_session_ticket) == 0) {
-      Error("failed to set session ticket callback");
-      goto fail;
+    Error("failed to set session ticket callback");
+    goto fail;
   }
 
   if (SSL_CTX_set_ex_data(ctx, ssl_session_ticket_index, ticket_key) == 0) {
-      Error ("failed to set session ticket data to ctx");
-      goto fail;
+    Error ("failed to set session ticket data to ctx");
+    goto fail;
   }
 
   SSL_CTX_clear_options(ctx, SSL_OP_NO_TICKET);
@@ -581,12 +581,12 @@ fail:
 static char *
 asn1_strdup(ASN1_STRING * s)
 {
-    // Make sure we have an 8-bit encoding.
-    ink_assert(ASN1_STRING_type(s) == V_ASN1_IA5STRING ||
-      ASN1_STRING_type(s) == V_ASN1_UTF8STRING ||
-      ASN1_STRING_type(s) == V_ASN1_PRINTABLESTRING);
+  // Make sure we have an 8-bit encoding.
+  ink_assert(ASN1_STRING_type(s) == V_ASN1_IA5STRING ||
+    ASN1_STRING_type(s) == V_ASN1_UTF8STRING ||
+    ASN1_STRING_type(s) == V_ASN1_PRINTABLESTRING);
 
-    return ats_strndup((const char *)ASN1_STRING_data(s), ASN1_STRING_length(s));
+  return ats_strndup((const char *)ASN1_STRING_data(s), ASN1_STRING_length(s));
 }
 
 // Given a certificate and it's corresponding SSL_CTX context, insert hash
@@ -686,8 +686,8 @@ ssl_store_ssl_context(
 
   // Session tickets are enabled by default. Disable if explicitly requested.
   if (session_ticket_enabled == 0) {
-      SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
-      Debug("ssl", "ssl session ticket is disabled");
+    SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
+    Debug("ssl", "ssl session ticket is disabled");
   }
 
   // Load the session ticket key if session tickets are not disabled and we have key name.
@@ -846,54 +846,55 @@ SSLParseCertificateConfiguration(
  * Specifically, it distributes the encrypted session-state information to the client in the form of a ticket and
  * a mechanism to present the ticket back to the server.
  * */
-int ssl_callback_session_ticket(SSL *ssl,
-                               unsigned char *keyname,
-                               unsigned char *iv,
-                               EVP_CIPHER_CTX *cipher_ctx,
-                               HMAC_CTX *hctx,
-                               int enc)
+static int
+ssl_callback_session_ticket(
+    SSL * ssl,
+    unsigned char * keyname,
+    unsigned char * iv,
+    EVP_CIPHER_CTX * cipher_ctx,
+    HMAC_CTX * hctx,
+    int enc)
 {
-    ssl_ticket_key_t* ssl_ticket_key = (ssl_ticket_key_t*) SSL_CTX_get_ex_data(SSL_get_SSL_CTX(ssl), ssl_session_ticket_index);
-    if (NULL == ssl_ticket_key) {
-        Error("ssl ticket key is null.");
-        return -1;
-    }
+  ssl_ticket_key_t* ssl_ticket_key = (ssl_ticket_key_t*) SSL_CTX_get_ex_data(SSL_get_SSL_CTX(ssl), ssl_session_ticket_index);
 
-    if (enc == 1) {
-        memcpy(keyname, ssl_ticket_key->key_name, 16);
-        RAND_pseudo_bytes(iv, EVP_MAX_IV_LENGTH);
-        EVP_EncryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL,
-                           ssl_ticket_key->aes_key, iv);
-        HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
-        Note("create ticket for a new session");
-
-        return 0;
-    } else if (enc == 0) {
-        if (memcmp(keyname, ssl_ticket_key->key_name, 16)) {
-            Error("keyname is not consistent.");
-            return 0;
-        }
+  if (NULL == ssl_ticket_key) {
+    Error("ssl ticket key is null.");
+    return -1;
+  }
 
-        EVP_DecryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL,
-                           ssl_ticket_key->aes_key, iv);
-        HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
+  if (enc == 1) {
+    memcpy(keyname, ssl_ticket_key->key_name, 16);
+    RAND_pseudo_bytes(iv, EVP_MAX_IV_LENGTH);
+    EVP_EncryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL, ssl_ticket_key->aes_key, iv);
+    HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
+    Note("create ticket for a new session");
 
-        Note("verify the ticket for an existing session." );
-        return 1;
+    return 0;
+  } else if (enc == 0) {
+    if (memcmp(keyname, ssl_ticket_key->key_name, 16)) {
+      Error("keyname is not consistent.");
+      return 0;
     }
 
-    return -1;
+    EVP_DecryptInit_ex(cipher_ctx, EVP_aes_128_cbc(), NULL, ssl_ticket_key->aes_key, iv);
+    HMAC_Init_ex(hctx, ssl_ticket_key->hmac_secret, 16, evp_md_func, NULL);
+
+    Note("verify the ticket for an existing session." );
+    return 1;
+  }
+
+  return -1;
 }
 
 void
 SSLReleaseContext(SSL_CTX * ctx)
 {
-   ssl_ticket_key_t * ssl_ticket_key = (ssl_ticket_key_t*)SSL_CTX_get_ex_data(ctx, ssl_session_ticket_index);
+  ssl_ticket_key_t * ssl_ticket_key = (ssl_ticket_key_t *)SSL_CTX_get_ex_data(ctx, ssl_session_ticket_index);
 
-   // Free the ticket if this is the last reference.
-   if (ctx->references == 1 && ssl_ticket_key) {
-       delete ssl_ticket_key;
-   }
+  // Free the ticket if this is the last reference.
+  if (ctx->references == 1 && ssl_ticket_key) {
+     delete ssl_ticket_key;
+  }
 
-   SSL_CTX_free(ctx);
+  SSL_CTX_free(ctx);
 }


[17/50] git commit: TS-1146: additional autoconf tests to support older OpenSSL

Posted by zw...@apache.org.
TS-1146: additional autoconf tests to support older OpenSSL


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

Branch: refs/heads/5.0.x
Commit: 358e92603dd0527122d3142f0a74a9d7280e595f
Parents: 6dabbd7
Author: James Peach <jp...@apache.org>
Authored: Fri Dec 6 15:26:22 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 6 15:27:31 2013 -0800

----------------------------------------------------------------------
 build/crypto.m4        | 35 +++++++++++++++++++++++++++++++++++
 configure.ac           |  4 ++++
 iocore/net/SSLUtils.cc | 24 ++++++++++++++++++++++--
 lib/ts/ink_config.h.in |  1 +
 4 files changed, 62 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/358e9260/build/crypto.m4
----------------------------------------------------------------------
diff --git a/build/crypto.m4 b/build/crypto.m4
index 998e147..0b8db8f 100644
--- a/build/crypto.m4
+++ b/build/crypto.m4
@@ -139,6 +139,41 @@ AC_DEFUN([TS_CHECK_CRYPTO_NEXTPROTONEG], [
   AC_SUBST(use_tls_npn)
 ])
 
+AC_DEFUN([TS_CHECK_CRYPTO_TICKETS], [
+  _tickets_saved_LIBS=$LIBS
+  enable_tls_tickets=yes
+
+  TS_ADDTO(LIBS, [$LIBSSL])
+  AC_CHECK_HEADERS(openssl/tls1.h openssl/ssl.h openssl/ts.h openssl/hmac.h openssl/evp.h)
+  AC_MSG_CHECKING([for SSL_CTX_set_tlsext_ticket_key_cb])
+  AC_COMPILE_IFELSE(
+  [
+    AC_LANG_PROGRAM([[
+#if HAVE_OPENSSL_SSL_H
+#include <openssl/ssl.h>
+#endif
+#if HAVE_OPENSSL_TLS1_H
+#include <openssl/tls1.h>
+#endif
+      ]],
+      [[SSL_CTX_set_tlsext_ticket_key_cb(NULL, NULL);]])
+  ],
+  [
+    AC_MSG_RESULT([yes])
+  ],
+  [
+    AC_MSG_RESULT([no])
+    enable_tls_tickets=no
+  ])
+
+  LIBS=$_tickets_saved_LIBS
+
+  AC_MSG_CHECKING(whether to enable TLS session ticket support)
+  AC_MSG_RESULT([$enable_tls_tickets])
+  TS_ARG_ENABLE_VAR([use], [tls-tickets])
+  AC_SUBST(use_tls_tickets)
+])
+
 AC_DEFUN([TS_CHECK_CRYPTO_SNI], [
   _sni_saved_LIBS=$LIBS
   enable_tls_sni=yes

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/358e9260/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index dde8c40..c06c173 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1131,6 +1131,10 @@ TS_CHECK_CRYPTO_EC_KEYS
 TS_CHECK_CRYPTO_SNI
 
 #
+# Check for RFC5077 TLS session ticket support.
+TS_CHECK_CRYPTO_TICKETS
+
+#
 # Check for zlib presence and usability
 TS_CHECK_ZLIB
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/358e9260/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index ce1d383..f7b5f4b 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -30,7 +30,14 @@
 #include <openssl/x509.h>
 #include <openssl/asn1.h>
 #include <openssl/rand.h>
+
+#if HAVE_OPENSSL_EVP_H
 #include <openssl/evp.h>
+#endif
+
+#if HAVE_OPENSSL_HMAC_H
+#include <openssl/hmac.h>
+#endif
 
 #if HAVE_OPENSSL_TS_H
 #include <openssl/ts.h>
@@ -62,6 +69,7 @@ typedef const SSL_METHOD * ink_ssl_method_t;
 typedef SSL_METHOD * ink_ssl_method_t;
 #endif
 
+#if TS_USE_TLS_TICKETS
 struct ssl_ticket_key_t
 {
   unsigned char key_name[16];
@@ -69,10 +77,12 @@ struct ssl_ticket_key_t
   unsigned char aes_key[16];
 };
 
-static ProxyMutex ** sslMutexArray;
-static bool open_ssl_initialized = false;
 static int ssl_callback_session_ticket(SSL *, unsigned char *, unsigned char *, EVP_CIPHER_CTX *, HMAC_CTX *, int);
 static int ssl_session_ticket_index = 0;
+#endif /* TS_USE_TLS_TICKETS */
+
+static ProxyMutex ** sslMutexArray;
+static bool open_ssl_initialized = false;
 
 struct ats_file_bio
 {
@@ -232,6 +242,7 @@ ssl_context_enable_ecdh(SSL_CTX * ctx)
 static SSL_CTX *
 ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
 {
+#if TS_USE_TLS_TICKETS
   xptr<char>          ticket_key_data;
   int                 ticket_key_len;
   ssl_ticket_key_t *  ticket_key = NULL;
@@ -271,6 +282,11 @@ ssl_context_enable_tickets(SSL_CTX * ctx, const char * ticket_key_path)
 fail:
   delete ticket_key;
   return ctx;
+
+#else /* TS_USE_TLS_TICKETS */
+  (void)ticket_key_path;
+  return ctx;
+#endif /* TS_USE_TLS_TICKETS */
 }
 
 void
@@ -684,11 +700,13 @@ ssl_store_ssl_context(
     }
   }
 
+#if defined(SSL_OP_NO_TICKET)
   // Session tickets are enabled by default. Disable if explicitly requested.
   if (session_ticket_enabled == 0) {
     SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
     Debug("ssl", "ssl session ticket is disabled");
   }
+#endif
 
   // Load the session ticket key if session tickets are not disabled and we have key name.
   if (session_ticket_enabled != 0 && ticket_key_filename) {
@@ -841,6 +859,7 @@ SSLParseCertificateConfiguration(
   return true;
 }
 
+#if TS_USE_TLS_TICKETS
 /*
  * RFC 5077. Create session ticket to resume SSL session without requiring session-specific state at the TLS server.
  * Specifically, it distributes the encrypted session-state information to the client in the form of a ticket and
@@ -885,6 +904,7 @@ ssl_callback_session_ticket(
 
   return -1;
 }
+#endif /* TS_USE_TLS_TICKETS */
 
 void
 SSLReleaseContext(SSL_CTX * ctx)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/358e9260/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 0b69098..026e431 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -68,6 +68,7 @@
 #define TS_USE_TLS_NPN                 @use_tls_npn@
 #define TS_USE_TLS_SNI                 @use_tls_sni@
 #define TS_USE_TLS_ECKEY               @use_tls_eckey@
+#define TS_USE_TLS_TICKETS             @use_tls_tickets@
 #define TS_USE_LINUX_NATIVE_AIO        @use_linux_native_aio@
 #define TS_USE_COP_DEBUG               @use_cop_debug@
 #define TS_USE_INTERIM_CACHE           @has_interim_cache@


[50/50] git commit: Fix merge conflict

Posted by zw...@apache.org.
Fix merge conflict


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

Branch: refs/heads/5.0.x
Commit: 93e7027b4a3240f7bc956e353efd0c8b429ccfd3
Parents: d6a7a9c
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Dec 14 14:46:19 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Dec 14 14:46:19 2013 -0700

----------------------------------------------------------------------
 CHANGES | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/93e7027b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f9672d9..c6dfb60 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,8 @@ Changes with Apache Traffic Server 5.0.0
    compatibility, so all cluster nodes should be upgraded simultaneously.
 
 
+Changes with Apache Traffic Server 4.2.0
+
   *) [TS-2251] Simplify LogBuffer reference counting.
 
   *) [TS-2190] Remove cache.log from the cachurl plugin.
@@ -92,11 +94,7 @@ Changes with Apache Traffic Server 5.0.0
 
   *) [TS-2348] Rename tstop to traffic_top.
 
-<<<<<<< HEAD
-Changes with Apache Traffic Server 4.2.0
-=======
   *) [TS-2384] Fix regression in key-lookup code between 4.0.x and 4.1.x
->>>>>>> master
 
   *) [TS-2340] Fix TextLogObject log rolling.
    Author: bettydramit <b1...@gmail.com>


[13/50] git commit: Merge branch 'master' of https://github.com/SaveTheRbtz/trafficserver

Posted by zw...@apache.org.
Merge branch 'master' of https://github.com/SaveTheRbtz/trafficserver


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

Branch: refs/heads/5.0.x
Commit: eaaf88959d27b46cfa3c4a17d31a934836198fee
Parents: 8dbf06b 6f6f05c
Author: Brian Geffon <br...@apache.org>
Authored: Fri Dec 6 11:07:46 2013 -0800
Committer: Brian Geffon <br...@apache.org>
Committed: Fri Dec 6 11:07:46 2013 -0800

----------------------------------------------------------------------
 plugins/header_rewrite/conditions.cc | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------



[26/50] git commit: TS-548: remove Initialize.cc Initialize.h

Posted by zw...@apache.org.
TS-548: remove Initialize.cc Initialize.h


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

Branch: refs/heads/5.0.x
Commit: 707a5e7cfcbcbc7cd972eca75f6453fc21a8c03a
Parents: 0b3367a
Author: Zhao Yongming <mi...@gmail.com>
Authored: Sat Dec 7 15:34:51 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 15:35:25 2013 +0800

----------------------------------------------------------------------
 CHANGES             |   2 +
 proxy/Initialize.cc | 304 -----------------------------------------------
 proxy/Initialize.h  |  57 ---------
 3 files changed, 2 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/707a5e7c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index be9c8c7..2e1e7b6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-548] remove Initialize.cc Initialize.h
+
   *) [TS-2082] remove STANDALONE_IOCORE FIXME_NONMODULAR and NON_MODULAR defines
 
   *) [TS-312] Add option to always share keep-alive connections to the origin server

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/707a5e7c/proxy/Initialize.cc
----------------------------------------------------------------------
diff --git a/proxy/Initialize.cc b/proxy/Initialize.cc
deleted file mode 100644
index 54026ba..0000000
--- a/proxy/Initialize.cc
+++ /dev/null
@@ -1,304 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
-
-   Initialize.cc --
-   Created On      : Fri Feb  5 18:22:05 1999
-
-   Description:
- ****************************************************************************/
-#include "libts.h"
-
-#include "Diags.h"
-#include "I_EventSystem.h"
-#include "I_Net.h"
-#include "I_Layout.h"
-#include "I_Version.h"
-
-#include "Initialize.h" // TODO: move to I_Initialize.h ???
-#include "ink_sys_control.h"
-
-extern char* admin_user;
-
-//
-// Initialize operating system related information/services
-//
-void
-init_system_settings(void)
-{
-  // Delimit file Descriptors
-  fds_limit = ink_max_out_rlimit(RLIMIT_NOFILE, true, false);
-
-  ink_max_out_rlimit(RLIMIT_STACK,true,true);
-  ink_max_out_rlimit(RLIMIT_DATA,true,true);
-  ink_max_out_rlimit(RLIMIT_FSIZE, true, false);
-#ifdef RLIMIT_RSS
-  ink_max_out_rlimit(RLIMIT_RSS,true,true);
-#endif
-}
-
-#if defined(linux)
-#include <sys/prctl.h>
-#endif
-
-static int
-set_core_size(const char */* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data, void */* opaque_token ATS_UNUSED */)
-{
-
-  RecInt size = data.rec_int;
-  struct rlimit lim;
-  bool failed = false;
-
-  if (getrlimit(RLIMIT_CORE, &lim) < 0) {
-    failed = true;
-  } else {
-    if (size < 0) {
-      lim.rlim_cur = lim.rlim_max;
-    } else {
-      lim.rlim_cur = (rlim_t) size;
-    }
-    if (setrlimit(RLIMIT_CORE, &lim) < 0) {
-      failed = true;
-    }
-#if defined(linux)
-#ifndef PR_SET_DUMPABLE
-#define PR_SET_DUMPABLE 4
-#endif
-    if (size != 0)
-      prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
-#endif
-  }
-
-  if (failed == true) {
-    Warning("Failed to set Core Limit : %s", strerror(errno));
-  }
-  return 0;
-}
-
-void
-init_system_core_size(void)
-{
-  bool found;
-  RecInt coreSize;
-  found = (RecGetRecordInt("proxy.config.core_limit", &coreSize) == REC_ERR_OKAY);
-  if (found == false) {
-    Warning("Unable to determine core limit");
-  } else {
-    RecData rec_temp;
-    rec_temp.rec_int = coreSize;
-    set_core_size(NULL, RECD_INT, rec_temp, NULL);
-    found = (REC_RegisterConfigUpdateFunc("proxy.config.core_limit", set_core_size, NULL) == REC_ERR_OKAY);
-    ink_assert(found);
-  }
-}
-
-
-int system_syslog_facility = LOG_DAEMON;
-
-//   Reads the syslog configuration variable
-//     and sets the global integer for the
-//     facility and calls open log with the
-//     new facility
-void
-init_system_syslog_log_configure(void)
-{
-  char *facility_str = NULL;
-  int facility;
-
-  REC_ReadConfigStringAlloc(facility_str, "proxy.config.syslog_facility");
-
-  if (facility_str == NULL || (facility = facility_string_to_int(facility_str)) < 0) {
-    syslog(LOG_WARNING, "Bad or missing syslog facility.  " "Defaulting to LOG_DAEMON");
-  } else {
-    system_syslog_facility = facility;
-    closelog();
-    openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, facility);
-  }
-}
-
-
-void
-init_system_adjust_num_of_net_threads(void)
-{
-  float autoconfig_scale = 1.0;
-  int nth_auto_config = 1;
-  int num_of_threads_tmp = 1;
-
-  REC_ReadConfigInteger(nth_auto_config, "proxy.config.exec_thread.autoconfig");
-  if (!nth_auto_config) {
-    REC_ReadConfigInteger(num_of_threads_tmp, "proxy.config.exec_thread.limit");
-    if (num_of_threads_tmp <= 0)
-      num_of_threads_tmp = 1;
-    else if (num_of_threads_tmp > MAX_NUMBER_OF_THREADS)
-      num_of_threads_tmp = MAX_NUMBER_OF_THREADS;
-    system_num_of_net_threads = num_of_threads_tmp;
-    if (is_debug_tag_set("threads")) {
-      fprintf(stderr, "# net threads Auto config - disabled - use config file settings\n");
-    }
-  } else {                      /* autoconfig is enabled */
-    num_of_threads_tmp = system_num_of_net_threads;
-    REC_ReadConfigFloat(autoconfig_scale, "proxy.config.exec_thread.autoconfig.scale");
-    num_of_threads_tmp = (int) ((float) num_of_threads_tmp * autoconfig_scale);
-    if (num_of_threads_tmp) {
-      system_num_of_net_threads = num_of_threads_tmp;
-    }
-    if (unlikely(num_of_threads_tmp > MAX_NUMBER_OF_THREADS)) {
-      num_of_threads_tmp = MAX_NUMBER_OF_THREADS;
-    }
-    if (is_debug_tag_set("threads")) {
-      fprintf(stderr, "# net threads Auto config - enabled\n");
-      fprintf(stderr, "# autoconfig scale: %f\n", autoconfig_scale);
-      fprintf(stderr, "# scaled number of net threads: %d\n", num_of_threads_tmp);
-    }
-  }
-
-  if (is_debug_tag_set("threads")) {
-    fprintf(stderr, "# number of net threads: %d\n", system_num_of_net_threads);
-  }
-  if (unlikely(system_num_of_net_threads <= 0)) {      /* impossible case -just for protection */
-    Warning("Number of Net Threads should be greater than 0");
-    system_num_of_net_threads = 1;
-  }
-}
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//      void reconfigure_diags()
-//
-//      This function extracts the current diags configuration settings from
-//      records.config, and rebuilds the Diags data structures.
-//
-//////////////////////////////////////////////////////////////////////////////
-void
-init_system_reconfigure_diags(void)
-{
-  int i;
-  DiagsConfigState c;
-
-  // initial value set to 0 or 1 based on command line tags
-  c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
-  c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
-
-  c.enabled[DiagsTagType_Debug] = 1;
-  c.enabled[DiagsTagType_Action] = 1;
-  diags->show_location = 1;
-
-  // read output routing values
-  for (i = 0; i < DiagsLevel_Count; i++) {
-
-    c.outputs[i].to_stdout = 0;
-    c.outputs[i].to_stderr = 1;
-    c.outputs[i].to_syslog = 1;
-    c.outputs[i].to_diagslog = 1;
-  }
-
-  //////////////////////////////
-  // clear out old tag tables //
-  //////////////////////////////
-  diags->deactivate_all(DiagsTagType_Debug);
-  diags->deactivate_all(DiagsTagType_Action);
-
-  //////////////////////////////////////////////////////////////////////
-  //                     add new tag tables
-  //////////////////////////////////////////////////////////////////////
-  if (diags->base_debug_tags)
-    diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
-  if (diags->base_action_tags)
-    diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
-
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
-#if !defined(__GNUC__) && !defined(hpux)
-  diags->config = c;
-#else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
-#endif
-
-}
-
-void
-chown_file_to_user(const char *file, const char *user)
-{
-  struct passwd *pwd = NULL;
-
-  if (user && *user) {
-    if (*user == '#') {
-      int uid = atoi(user + 1);
-      if (uid == -1) {
-        // XXX: Can this call hapen after setuid?
-        uid = (int)geteuid();
-      }
-      pwd = getpwuid((uid_t)uid);
-    } else {
-      pwd = getpwnam(user);
-    }
-    if (pwd) {
-      if (chown(file, pwd->pw_uid, pwd->pw_gid) < 0) {
-          diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "cop couldn't chown the  file: '%s' [%d] %s\n",
-         file, errno, strerror(errno)
-       );
-      }
-    } else {
-        diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "can't get passwd entry for the admin user '%s' - [%d] %s\n", user, errno, strerror(errno));
-    }
-  } else {
-      diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__, "Admin user was the empty string.\n");
-  }
-}
-
-void
-init_system_diags(char *bdt, char *bat)
-{
-  FILE *diags_log_fp = NULL;
-  char diags_logpath[PATH_NAME_MAX + 1];
-
-  ink_filepath_make(diags_logpath, sizeof(diags_logpath),
-                    Layout::get()->logdir, DIAGS_LOG_FILE);
-
-  diags_log_fp = fopen(diags_logpath, "w");
-  if (diags_log_fp) {
-    int status;
-    chown_file_to_user(diags_logpath, admin_user);
-    status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
-    if (status != 0) {
-      fclose(diags_log_fp);
-      diags_log_fp = NULL;
-    }
-  }
-
-  diags = NEW(new Diags(bdt, bat, diags_log_fp));
-  if (diags_log_fp == NULL) {
-    SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
-
-    diags->print(NULL, DL_Warning, __FILE__, __FUNCTION__, __LINE__,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
-  } else {
-    diags->print(NULL, DL_Status, "STATUS", NULL, 0, "opened %s", diags_logpath);
-  }
-
-  init_system_reconfigure_diags();
-}
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/707a5e7c/proxy/Initialize.h
----------------------------------------------------------------------
diff --git a/proxy/Initialize.h b/proxy/Initialize.h
deleted file mode 100644
index 556f251..0000000
--- a/proxy/Initialize.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-/****************************************************************************
-
-   Initialize.h --
-   Created On      : Mon Feb  8 15:14:57 1999
-
-   Description:
-
-
-
- ****************************************************************************/
-#if !defined (_Initialize_h_)
-#define _Initialize_h_
-
-#define MAX_NUMBER_OF_THREADS  1024
-#define DIAGS_LOG_FILE         "diags.log"
-
-extern Diags *diags;
-extern int fds_limit; // TODO: rename
-extern int system_num_of_net_threads;
-extern int system_syslog_facility;
-
-void init_system_settings(void);
-void init_system_dirs(void);
-void init_system_core_size(void);
-void init_system_syslog_log_configure(void);
-//void init_system_logging();
-void init_system_reconfigure_diags(void);
-void init_system_diags(char *bdt, char *bat);
-void chown_file_to_user(const char *file, const char *user);
-void init_system_adjust_num_of_net_threads(void);
-
-//void initialize_standalone();
-
-#endif


[42/50] git commit: TS-2424: document diagnostic logging configuration

Posted by zw...@apache.org.
TS-2424: document diagnostic logging configuration


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

Branch: refs/heads/5.0.x
Commit: 536fb8e018c5556e5e12ce42f4c5011b84fdcf2e
Parents: 4b94cdf
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 11:21:42 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 11:25:41 2013 -0800

----------------------------------------------------------------------
 .../configuration/records.config.en.rst         | 53 ++++++++++++++++----
 .../unable-to-debug-tags.en.rst                 |  4 +-
 2 files changed, 45 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/536fb8e0/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index bbe1a4d..9d9cb39 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -1796,14 +1796,20 @@ server, refer to `logs_xml.config <logs_xml.config>`_.
 Diagnostic Logging Configuration
 ================================
 
-.. ts:cv:: CONFIG proxy.config.diags.output.status STRING
-
-.. ts:cv:: CONFIG proxy.config.diags.output.warning STRING
-
-.. ts:cv:: CONFIG proxy.config.diags.output.emergency STRING
-
-   control where Traffic Server should log diagnostic output. Messages at diagnostic level can be directed to any combination of diagnostic
-   destinations. Valid diagnostic message destinations are:::
+.. ts:cv:: CONFIG proxy.config.diags.output.diag STRING E
+.. ts:cv:: CONFIG proxy.config.diags.output.debug STRING E
+.. ts:cv:: CONFIG proxy.config.diags.output.status STRING L
+.. ts:cv:: CONFIG proxy.config.diags.output.note STRING L
+.. ts:cv:: CONFIG proxy.config.diags.output.warning STRING L
+.. ts:cv:: CONFIG proxy.config.diags.output.error STRING SL
+.. ts:cv:: CONFIG proxy.config.diags.output.fatal STRING SL
+.. ts:cv:: CONFIG proxy.config.diags.output.alert STRING L
+.. ts:cv:: CONFIG proxy.config.diags.output.emergency STRING SL
+
+   The diagnosic output configuration variables control where Traffic
+   Server should log diagnostic output. Messages at each diagnostic level
+   can be directed to any combination of diagnostic destinations.
+   Valid diagnostic message destinations are:
 
    * 'O' = Log to standard output
    * 'E' = Log to standard error
@@ -1812,9 +1818,36 @@ Diagnostic Logging Configuration
 
 .. topic:: Example
 
-   To log debug diagnostics to both syslog and diags.log:::
+   To log debug diagnostics to both syslog and `diags.log`::
+
+        CONFIG proxy.config.diags.output.debug STRING SL
+
+.. ts:cv:: CONFIG proxy.config.diags.show_location INT 0
+
+   Annotates diagnostic messages with the source code location.
+
+.. ts:cv:: CONFIG proxy.config.diags.debug.enabled INT 0
+
+   Enables logging for diagnostic messages whose log level is `diag` or `debug`.
+
+.. ts:cv:: CONFIG proxy.config.diags.debug.tags STRING NULL
+
+   Each Traffic Server `diag` and `debug` level message is annotated
+   with a subsytem tag. This configuration contains a regular
+   expression that filters the messages based on the tag. Some
+   commonly used debug tags are::
+
+============  =====================================================
+Tag           Subsytem usage
+============  =====================================================
+ssl           TLS termination and certificate processing
+dns           DNS query resolution
+http_hdrs     Logs the headers for HTTP requests and responses
+============  =====================================================
 
-        proxy.config.diags.output.debug STRING SL
+  Traffic Server plugins will typically log debug messages using
+  the :func:`TSDebug` API, passing the plugin name as the debug
+  tag.
 
 Reverse Proxy
 =============

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/536fb8e0/doc/sdk/troubleshooting-tips/unable-to-debug-tags.en.rst
----------------------------------------------------------------------
diff --git a/doc/sdk/troubleshooting-tips/unable-to-debug-tags.en.rst b/doc/sdk/troubleshooting-tips/unable-to-debug-tags.en.rst
index 5ed5877..745712a 100644
--- a/doc/sdk/troubleshooting-tips/unable-to-debug-tags.en.rst
+++ b/doc/sdk/troubleshooting-tips/unable-to-debug-tags.en.rst
@@ -43,8 +43,8 @@ Set the following variables in :file:`records.config` (in the Traffic Server
 ::
 
        :::text
-       proxy.config.diags.debug.enabled INT 1
-       proxy.config.diags.debug.tags STRING debug-tag-name
+       CONFIG proxy.config.diags.debug.enabled INT 1
+       CONFIG proxy.config.diags.debug.tags STRING debug-tag-name
 
 In this case, debug output goes to ``traffic.out``.
 


[22/50] git commit: TS-2082: remove STANDALONE_IOCORE defines

Posted by zw...@apache.org.
TS-2082: remove STANDALONE_IOCORE defines


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

Branch: refs/heads/5.0.x
Commit: 51ce9aec5fe8edb129c4cf1df29accdac35c5222
Parents: d6ab748
Author: Zhao Yongming <mi...@gmail.com>
Authored: Thu Nov 7 17:22:18 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 14:29:31 2013 +0800

----------------------------------------------------------------------
 Makefile.am                    |  6 ++----
 configure.ac                   | 27 +++------------------------
 iocore/Makefile.am             |  7 +------
 iocore/aio/Makefile.am         |  1 -
 iocore/cache/Makefile.am       | 15 ---------------
 iocore/cluster/Makefile.am     |  2 --
 iocore/dns/DNS.cc              |  2 --
 iocore/dns/Makefile.am         | 13 -------------
 iocore/eventsystem/Makefile.am |  1 -
 iocore/hostdb/Makefile.am      | 13 -------------
 iocore/net/Makefile.am         | 12 ------------
 iocore/net/UnixNetProcessor.cc |  2 --
 iocore/utils/Makefile.am       |  2 --
 lib/ts/ink_config.h.in         |  6 +-----
 proxy/Makefile.am              | 14 --------------
 15 files changed, 7 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 0ececb4..0ad9b06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,11 +28,9 @@ export CCACHE_BASEDIR
 
 # proxy/api/ts has to be built first, since so much of libraries and "core
 # depends on the generates ts/ts.h include file.
-if STANDALONE_IOCORE
-SUBDIRS =  proxy/api/ts iocore lib proxy/hdrs proxy/shared mgmt proxy plugins cmd tools example
-else
+
 SUBDIRS =  proxy/api/ts iocore lib proxy/hdrs proxy/shared mgmt proxy rc doc plugins cmd tools example
-endif
+
 
 DIST_BUILD_USER=`id -nu`
 DIST_BUILD_USER_GROUP=`id -ng`

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index c06c173..fd41a1b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,30 +228,9 @@ AC_MSG_RESULT([$enable_micro])
 AS_IF([test "x$enable_micro" = "xyes"], [is_micro_build=1], [is_micro_build=0])
 AC_SUBST(is_micro_build)
 
-#
-# Standalone iocore
-#
-AC_MSG_CHECKING([whether to build a standalone iocore])
-AC_ARG_ENABLE([standalone-iocore],
-  [AS_HELP_STRING([--enable-standalone-iocore],[build just standalone iocore])],
-  [],
-  [enable_standalone_iocore=no]
-)
-AC_MSG_RESULT([$enable_standalone_iocore])
-TS_ARG_ENABLE_VAR([has],[standalone-iocore])
-AC_SUBST(has_standalone_iocore)
-AS_IF([test 0 -ne $has_standalone_iocore],
-  [AC_SUBST([IOCORE_MODULARIZED_DEFS],[""])
-   AC_SUBST([ink_with_modules_def],["-DREC_BUILD_STAND_ALONE"])
-   AC_SUBST([ink_with_modules_local],[""])
-   AC_SUBST([ink_with_modules_process],[""])
-  ],
-  [AC_SUBST([ink_with_modules_def],["-DREC_BUILD_MGMT"])
-   AC_SUBST([ink_with_modules_local],["-DLOCAL_MANAGER"])
-   AC_SUBST([ink_with_modules_process],["-DPROCESS_MANAGER"])
-  ]
-)
-AM_CONDITIONAL([STANDALONE_IOCORE], [test 0 -ne $has_standalone_iocore])
+AC_SUBST([ink_with_modules_def],["-DREC_BUILD_MGMT"])
+AC_SUBST([ink_with_modules_local],["-DLOCAL_MANAGER"])
+AC_SUBST([ink_with_modules_process],["-DPROCESS_MANAGER"])
 
 #
 # Force some static linkage (for testing / development only)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/Makefile.am b/iocore/Makefile.am
index 5178b56..cb597b6 100644
--- a/iocore/Makefile.am
+++ b/iocore/Makefile.am
@@ -16,9 +16,4 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-if STANDALONE_IOCORE
-SUBDIRS = eventsystem net aio dns hostdb utils cache
-else
-SUBDIRS = eventsystem net aio dns hostdb utils cache cluster 
-endif
-
+SUBDIRS = eventsystem net aio dns hostdb utils cache cluster

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/aio/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am
index a19b04d..d270520 100644
--- a/iocore/aio/Makefile.am
+++ b/iocore/aio/Makefile.am
@@ -22,7 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts
 
-DEFS += @IOCORE_MODULARIZED_DEFS@
 TESTS = test_AIO.sample
 
 noinst_LIBRARIES = libinkaio.a

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/cache/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index c4faaa1..1ef08a6 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -16,17 +16,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-if STANDALONE_IOCORE
-AM_CPPFLAGS = \
-  $(iocore_include_dirs) \
-  -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/lib \
-  -I$(top_srcdir)/lib/records \
-  -I$(top_srcdir)/lib/ts
-
-ADD_SRC =
-else
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
@@ -48,10 +37,6 @@ if BUILD_TESTS
   ADD_SRC += CacheTest.cc P_CacheTest.h 
 endif
 
-endif
-
-DEFS += @IOCORE_MODULARIZED_DEFS@
-
 noinst_LIBRARIES = libinkcache.a
 
 libinkcache_a_SOURCES = \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/cluster/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/cluster/Makefile.am b/iocore/cluster/Makefile.am
index 1ffe089..7a09cf7 100644
--- a/iocore/cluster/Makefile.am
+++ b/iocore/cluster/Makefile.am
@@ -30,8 +30,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt/preparse \
   -I$(top_srcdir)/mgmt/utils
 
-DEFS += @IOCORE_MODULARIZED_DEFS@
-
 noinst_LIBRARIES = libinkcluster.a
 
 libinkcluster_a_SOURCES = \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index ba24a8c..0a7d7cf 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -194,12 +194,10 @@ DNSProcessor::start(int, size_t stacksize) {
 
   dns_failover_try_period = dns_timeout + 1;    // Modify the "default" accordingly
 
-#ifndef STANDALONE_IOCORE
   if (SplitDNSConfig::gsplit_dns_enabled) {
     //reconfigure after threads start
     SplitDNSConfig::reconfigure();
   }
-#endif
 
   // Setup the default DNSHandler, it's used both by normal DNS, and SplitDNS (for PTR lookups etc.)
   dns_init();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/dns/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/dns/Makefile.am b/iocore/dns/Makefile.am
index 3d5e59f..5a002fd 100644
--- a/iocore/dns/Makefile.am
+++ b/iocore/dns/Makefile.am
@@ -16,16 +16,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-if STANDALONE_IOCORE
-AM_CPPFLAGS = \
-  $(iocore_include_dirs) \
-  -I. \
-  -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/lib \
-  -I$(top_srcdir)/lib/records \
-  -I$(top_srcdir)/lib/ts
-else
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
@@ -37,9 +27,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/mgmt/preparse
-endif
-
-DEFS += @IOCORE_MODULARIZED_DEFS@
 
 noinst_LIBRARIES = libinkdns.a
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/eventsystem/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index c75f5f5..7d43def 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -21,7 +21,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/records \
   -I$(top_srcdir)/lib/ts
 
-DEFS += @IOCORE_MODULARIZED_DEFS@
 TESTS = $(check_PROGRAMS)
 
 noinst_LIBRARIES = libinkevent.a

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/hostdb/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am
index 90381d7..1ad06f7 100644
--- a/iocore/hostdb/Makefile.am
+++ b/iocore/hostdb/Makefile.am
@@ -16,15 +16,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-if STANDALONE_IOCORE
-AM_CPPFLAGS = \
-  $(iocore_include_dirs) \
-  -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/lib \
-  -I$(top_srcdir)/lib/records \
-  -I$(top_srcdir)/lib/ts
-else
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
@@ -36,10 +27,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/utils \
   -I$(top_srcdir)/mgmt/preparse
-endif
-
-
-DEFS += @IOCORE_MODULARIZED_DEFS@
 
 EXTRA_DIST = I_HostDB.h
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/net/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index b19c36b..b3e1d52 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -16,15 +16,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-if STANDALONE_IOCORE
-AM_CPPFLAGS = \
-  $(iocore_include_dirs) \
-  -I$(top_srcdir)/mgmt \
-  -I$(top_srcdir)/mgmt/utils \
-  -I$(top_srcdir)/lib \
-  -I$(top_srcdir)/lib/records \
-  -I$(top_srcdir)/lib/ts
-else
 AM_CPPFLAGS = \
   $(iocore_include_dirs) \
   -I$(top_srcdir)/lib \
@@ -36,10 +27,7 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/mgmt \
   -I$(top_srcdir)/mgmt/preparse \
   -I$(top_srcdir)/mgmt/utils
-endif
-
 
-DEFS += @IOCORE_MODULARIZED_DEFS@
 TESTS = $(check_PROGRAMS)
 
 check_PROGRAMS = test_certlookup

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index 5ff4087..b3b121c 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -406,10 +406,8 @@ UnixNetProcessor::start(int, size_t)
   netthreads = eventProcessor.eventthread[etype];
   for (int i = 0; i < n_netthreads; ++i) {
     initialize_thread_for_net(netthreads[i]);
-#ifndef STANDALONE_IOCORE
     extern void initialize_thread_for_http_sessions(EThread *thread, int thread_index);
     initialize_thread_for_http_sessions(netthreads[i], i);
-#endif
   }
 
   RecData d;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/iocore/utils/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/utils/Makefile.am b/iocore/utils/Makefile.am
index 4d6fcac..da46aa0 100644
--- a/iocore/utils/Makefile.am
+++ b/iocore/utils/Makefile.am
@@ -22,8 +22,6 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/ts \
   -I$(top_srcdir)/iocore/eventsystem
 
-DEFS += @IOCORE_MODULARIZED_DEFS@
-
 noinst_LIBRARIES = libinkutils.a
 
 libinkutils_a_SOURCES = \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 026e431..3a31c9f 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -81,7 +81,6 @@
 #define TS_HAS_128BIT_CAS              @has_128bit_cas@
 
 /* API */
-#define TS_HAS_STANDALONE_IOCORE       @has_standalone_iocore@
 #define TS_HAS_TESTS                   @has_tests@
 #define TS_HAS_WCCP                    @has_wccp@
 
@@ -92,14 +91,11 @@
 
 # define TS_MAX_API_STATS               @max_api_stats@
 
-#if TS_HAS_STANDALONE_IOCORE
-# define STANDALONE_IOCORE              1
-#else
+
 # define FIXME_NONMODULAR               1
 # define SPLIT_DNS                      1
 # define NON_MODULAR                    1
 # define HTTP_CACHE                     1
-#endif
 
 /* Defaults for user / group */
 #define TS_PKGSYSUSER                   "@pkgsysuser@"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51ce9aec/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 98bad98..04d72c8 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -17,10 +17,6 @@
 #  limitations under the License.
 
 # Note that hdrs is targeted from ../Makefile.am
-if STANDALONE_IOCORE
-noinst_LIBRARIES = libTrafficServerStandalone.a
-bin_PROGRAMS =
-else
 SUBDIRS = congest http logging config
 noinst_LIBRARIES =
 bin_PROGRAMS = \
@@ -28,7 +24,6 @@ bin_PROGRAMS = \
   traffic_logcat \
   traffic_logstats \
   traffic_sac
-endif
 
 noinst_PROGRAMS = \
   test_xml_parser
@@ -57,8 +52,6 @@ noinst_HEADERS = \
   ConfigParse.h \
   Show.h
 
-EXTRA_LIBRARIES	= \
-  libTrafficServerStandalone.a
 
 if STATIC_LIBTS
    which_libts = $(top_builddir)/lib/ts/.libs/libtsutil.a
@@ -260,13 +253,6 @@ if BUILD_TESTS
   traffic_sac_SOURCES += RegressionSM.cc
 endif
 
-libTrafficServerStandalone_a_SOURCES = \
-  signals.cc \
-  EventName.cc \
-  StatPages.cc \
-  StatSystem.cc \
-  AbstractBuffer.cc \
-  Initialize.cc
 
 test_xml_parser_SOURCES = test_xml_parser.cc
 test_xml_parser_LDADD = \


[48/50] git commit: [TS-1449] Update Doc to match actual default

Posted by zw...@apache.org.
[TS-1449] Update Doc to match actual default


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

Branch: refs/heads/5.0.x
Commit: 3388fd8cca6a22b3217ee361fdd0b83459500fce
Parents: 7244c89
Author: Miles Libbey <ml...@apache.org>
Authored: Thu Dec 12 14:51:16 2013 -0800
Committer: Miles Libbey <ml...@apache.org>
Committed: Thu Dec 12 14:51:16 2013 -0800

----------------------------------------------------------------------
 doc/reference/configuration/records.config.en.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3388fd8c/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index 9d9cb39..1f45a7a 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -1525,7 +1525,7 @@ Logging Configuration
 
    The maximum amount of time before data in the buffer is flushed to disk.
 
-.. ts:cv:: CONFIG proxy.config.log.max_space_mb_for_logs INT 2000
+.. ts:cv:: CONFIG proxy.config.log.max_space_mb_for_logs INT 2500
    :metric: megabytes
    :reloadable:
 


[46/50] git commit: TS-2190: fix the -Werror build

Posted by zw...@apache.org.
TS-2190: fix the -Werror build


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

Branch: refs/heads/5.0.x
Commit: a302c86ee226cb354339ee42f044a459333a2376
Parents: 1410994
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 21:00:39 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Dec 11 20:08:54 2013 -0800

----------------------------------------------------------------------
 ci/regression               | 1 +
 plugins/cacheurl/cacheurl.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a302c86e/ci/regression
----------------------------------------------------------------------
diff --git a/ci/regression b/ci/regression
index 495b380..0728498 100755
--- a/ci/regression
+++ b/ci/regression
@@ -87,6 +87,7 @@ configure() {
     $SRCROOT/configure \
       --prefix=$DSTROOT \
       --enable-debug \
+      --enable-werror \
       --enable-experimental-plugins \
       $(extras) \
       CC="$CC" \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a302c86e/plugins/cacheurl/cacheurl.c
----------------------------------------------------------------------
diff --git a/plugins/cacheurl/cacheurl.c b/plugins/cacheurl/cacheurl.c
index 3b3e98d..455dba3 100644
--- a/plugins/cacheurl/cacheurl.c
+++ b/plugins/cacheurl/cacheurl.c
@@ -355,7 +355,6 @@ static void initialization_error(char *msg) {
 
 TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuf,
     int errbuf_size) {
-    TSReturnCode error;
     if (!api_info) {
         strncpy(errbuf, "[tsremap_init] Invalid TSRemapInterface argument",
                 errbuf_size - 1);
@@ -416,7 +415,6 @@ TSRemapStatus TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri ATS
 
 void TSPluginInit(int argc, const char *argv[]) {
     TSPluginRegistrationInfo info;
-    TSReturnCode error;
     TSCont contp;
     pr_list *prl;
 


[20/50] git commit: udpated release notes

Posted by zw...@apache.org.
udpated release notes


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

Branch: refs/heads/5.0.x
Commit: 960c3f8f48f92280fff9495e2cfda752d3d7e4af
Parents: 1bcff78
Author: Bryan Call <bc...@apache.org>
Authored: Fri Dec 6 16:59:09 2013 -0800
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Dec 6 16:59:09 2013 -0800

----------------------------------------------------------------------
 CHANGES | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/960c3f8f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 429ac04..cacc5ad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2419] Don't close client connection when responding with a 204 and there is no body
 
   *) [TS-1146] Add RFC 5077 TLS session ticket support.
    Author: Wei Sun <su...@yahoo-inc.com>


[16/50] git commit: Merge branch 'patch-2' of https://github.com/jbfavre/trafficserver

Posted by zw...@apache.org.
Merge branch 'patch-2' of https://github.com/jbfavre/trafficserver


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

Branch: refs/heads/5.0.x
Commit: 6dabbd7ba30d1363bb9288ad77ed4093198fa7c3
Parents: 0850f4c 82ad4ef
Author: James Peach <jp...@apache.org>
Authored: Fri Dec 6 14:39:54 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 6 14:39:54 2013 -0800

----------------------------------------------------------------------
 .../sample-buffered-null-transformation-plugin.en.rst        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[29/50] git commit: Fixed a bunch of misspelled words in comments

Posted by zw...@apache.org.
Fixed a bunch of misspelled words in comments


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

Branch: refs/heads/5.0.x
Commit: adbccf960187870d00817b7a9353fb718f4d97dc
Parents: b57a809
Author: Bryan Call <bc...@apache.org>
Authored: Sun Dec 8 14:48:47 2013 -0800
Committer: Bryan Call <bc...@apache.org>
Committed: Sun Dec 8 14:48:47 2013 -0800

----------------------------------------------------------------------
 proxy/http/HttpSM.cc | 86 +++++++++++++++++++++++------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/adbccf96/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 1ae8615..cc79002 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -76,7 +76,7 @@ ink_mutex debug_sm_list_mutex;
 //  sparse initialization, not copying dead space for history.
 //
 //  Most of the content of in the prototype object consists of zeroes.
-//  To take advantage of that, a "scatter list" is contructed of
+//  To take advantage of that, a "scatter list" is constructed of
 //  the non-zero words, and those values are scattered onto the
 //  new object after first zeroing out the object (except for dead space).
 //
@@ -536,7 +536,7 @@ HttpSM::state_add_to_list(int event, void * /* data ATS_UNUSED */)
 int
 HttpSM::state_remove_from_list(int event, void * /* data ATS_UNUSED */)
 {
-  // The config parameters are guranteed not change
+  // The config parameters are guaranteed not change
   //   across the life of a transaction so it safe to
   //   check the config here and use it detrmine
   //   whether we need to strip ourselves off of the
@@ -564,8 +564,8 @@ int
 HttpSM::kill_this_async_hook(int /* event ATS_UNUSED */, void * /* data ATS_UNUSED */)
 {
   // In the base HttpSM, we don't have anything to
-  //   do here.  subclasses can overide this function
-  //   to do their own asyncronous cleanup
+  //   do here.  subclasses can override this function
+  //   to do their own asynchronous cleanup
   // So We're now ready to finish off the state machine
   terminate_sm = true;
   kill_this_async_done = true;
@@ -626,7 +626,7 @@ HttpSM::attach_client_session(HttpClientSession * client_vc, IOBufferReader * bu
   }
 
   // We first need to run the transaction start hook.  Since
-  //  this hook maybe asyncronous, we need to disable IO on
+  //  this hook maybe asynchronous, we need to disable IO on
   //  client but set the continuation to be the state machine
   //  so if we get an timeout events the sm handles them
   ua_entry->read_vio = client_vc->do_io_read(this, 0, buffer_reader->mbuf);
@@ -977,7 +977,7 @@ HttpSM::setup_push_read_response_header()
       resp_hdr_state = state_read_push_response_header(VC_EVENT_READ_READY, ua_entry->read_vio);
     }
   }
-  // It is possible that the entire PUSHed responsed header was already
+  // It is possible that the entire PUSHed response header was already
   //  in the buffer.  In this case we don't want to fire off any more
   //  IO since we are going to switch buffers when we go to tunnel to
   //  the cache
@@ -1149,7 +1149,7 @@ HttpSM::state_raw_http_server_open(int event, void *data)
 //
 //   We've done a successful transform open and issued a do_io_write
 //    to the transform.  We are now ready for the transform  to tell
-//    us it is now ready to be read from and it done modifing the
+//    us it is now ready to be read from and it done modifying the
 //    server request header
 //
 int
@@ -1189,7 +1189,7 @@ HttpSM::state_request_wait_for_transform_read(int event, void *data)
 //
 //   We've done a successful transform open and issued a do_io_write
 //    to the transform.  We are now ready for the transform  to tell
-//    us it is now ready to be read from and it done modifing the
+//    us it is now ready to be read from and it done modifying the
 //    user agent response header
 //
 int
@@ -1220,7 +1220,7 @@ HttpSM::state_response_wait_for_transform_read(int event, void *data)
 
 // int HttpSM::state_common_wait_for_transform_read(...)
 //
-//   This function handles the overlapping cases bewteen request and response
+//   This function handles the overlapping cases between request and response
 //     transforms which prevents code duplication
 //
 int
@@ -1254,7 +1254,7 @@ HttpSM::state_common_wait_for_transform_read(HttpTransformInfo * t_info, HttpSMH
         ink_assert(t_info == &post_transform_info);
         return (this->*tunnel_handler) (event, data);
       } else {
-        // On the reponse side, we just forward as much
+        // On the response side, we just forward as much
         //   as we can of truncated documents so
         //   just don't cache the result
         ink_assert(t_info == &transform_info);
@@ -1293,7 +1293,7 @@ HttpSM::state_common_wait_for_transform_read(HttpTransformInfo * t_info, HttpSMH
 // int HttpSM::state_api_callback(int event, void *data)
 
 //   InkAPI.cc calls us directly here to avoid problems
-//    with setting and chanings the default_handler
+//    with setting and changing the default_handler
 //    function.  As such, this is an entry point
 //    and needs to handle the reentrancy counter and
 //    deallocation the state machine if necessary
@@ -1520,7 +1520,7 @@ HttpSM::state_api_callout(int event, void *data)
 // void HttpSM::handle_api_return()
 //
 //   Figures out what to do after calling api callouts
-//    have finised.  This messy and I would like
+//    have finished.  This messy and I would like
 //    to come up with a cleaner way to handle the api
 //    return.  The way we are doing things also makes a
 //    mess of set_next_state()
@@ -2322,7 +2322,7 @@ HttpSM::state_icp_lookup(int event, void *data)
 /*
 *  Disable ICP loop detection since the Cidera network
 *    insists on trying to preload the cache from a
-*    a sibiling cache.
+*    a sibling cache.
 *
 *  // inhibit bad ICP looping behavior
 *  if (t_state.icp_ip_result.sin_addr.s_addr ==
@@ -2458,7 +2458,7 @@ HttpSM::state_cache_open_read(int event, void *data)
       DebugSM("http", "[%" PRId64 "] cache_open_read - CACHE_EVENT_OPEN_READ", sm_id);
 
       /////////////////////////////////
-      // lookup/open is successfull. //
+      // lookup/open is successful. //
       /////////////////////////////////
       ink_assert(cache_sm.cache_read_vc != NULL);
       t_state.source = HttpTransact::SOURCE_CACHE;
@@ -2561,11 +2561,11 @@ HttpSM::tunnel_handler_post_or_put(HttpTunnelProducer * p)
   ink_assert(p->vc_type == HT_HTTP_CLIENT);
   HttpTunnelConsumer *c;
 
-  // If there is a post tranform, remove it's entry from the State
+  // If there is a post transform, remove it's entry from the State
   //  Machine's VC table
   //
   // MUST NOT clear the vc pointer from post_transform_info
-  //    as this causes a double close of the tranform vc in transform_cleanup
+  //    as this causes a double close of the transform vc in transform_cleanup
   //
   if (post_transform_info.vc != NULL) {
     ink_assert(post_transform_info.entry->in_tunnel == true);
@@ -3009,8 +3009,8 @@ HttpSM::is_bg_fill_necessary(HttpTunnelConsumer * c)
       int64_t ua_body_done = c->bytes_written - client_response_hdr_bytes;
       float pDone = (float) ua_body_done / ua_cl;
 
-      // If we got a good content lenght.  Check to make sure that we haven't already
-      //  done more the content length since that would indicate the content-legth
+      // If we got a good content length.  Check to make sure that we haven't already
+      //  done more the content length since that would indicate the content-length
       //  is bogus.  If we've done more than the threshold, continue the background fill
       if (pDone <= 1.0 && pDone > t_state.txn_conf->background_fill_threshold) {
         return true;
@@ -3059,7 +3059,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer * c)
       server_session->get_netvc()->
         set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout));
     } else {
-      // No bakground fill
+      // No background fill
       p = c->producer;
       tunnel.chain_abort_all(c->producer);
       selfc = p->self_consumer;
@@ -3256,7 +3256,7 @@ HttpSM::tunnel_handler_cache_write(int event, HttpTunnelConsumer * c)
     //   abort the cache since it's finicky about a close
     //   in this case.  This case can only occur
     //   we got a truncated header from the origin server
-    //   but decided to accpet it anyways
+    //   but decided to accept it anyways
     if (c->write_vio == NULL) {
       *status_ptr = HttpTransact::CACHE_WRITE_ERROR;
       c->write_success = false;
@@ -3285,7 +3285,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer * p)
 
   switch (event) {
   case VC_EVENT_EOS:
-    // My reading of spec says that user agents can not ternminate
+    // My reading of spec says that user agents can not terminate
     //  posts with a half close so this is an error
   case VC_EVENT_ERROR:
   case VC_EVENT_INACTIVITY_TIMEOUT:
@@ -3378,7 +3378,7 @@ HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer * c)
   case VC_EVENT_ERROR:
   case VC_EVENT_INACTIVITY_TIMEOUT:
   case VC_EVENT_ACTIVE_TIMEOUT:
-    //  Did not complete post tunnling
+    //  Did not complete post tunneling
     //
     //    In the http case, we don't want to close
     //    the connection because the
@@ -3386,7 +3386,7 @@ HttpSM::tunnel_handler_post_server(int event, HttpTunnelConsumer * c)
     //    a response even though the tunnel failed.
 
     // Shutdown both sides of the connection.  This prevents us
-    //  from getting any futher events and signals to client
+    //  from getting any further events and signals to client
     //  that POST data will not be forwarded to the server.  Doing
     //  shutdown on the write side will likely generate a TCP
     //  reset to the client but if the proxy wasn't here this is
@@ -3621,7 +3621,7 @@ HttpSM::tunnel_handler_transform_write(int event, HttpTunnelConsumer * c)
     c->vc->do_io_close(EHTTP_ERROR);
     break;
   case VC_EVENT_EOS:
-    //   It possbile the transform quit
+    //   It possible the transform quit
     //   before the producer finished.  If this is true
     //   we need shut  down the producer if it doesn't
     //   have other consumers to serve or else it will
@@ -3904,7 +3904,7 @@ HttpSM::do_hostdb_lookup()
       }
     }
     return;
-  } else {                      /* we arent using SRV stuff... */
+  } else {                      /* we aren't using SRV stuff... */
     DebugSM("http_seq", "[HttpSM::do_hostdb_lookup] Doing DNS Lookup");
 
     // If there is not a current server, we must be looking up the origin
@@ -4029,15 +4029,15 @@ HttpSM::do_hostdb_update_if_necessary()
 }
 
 /*
- * range entry vaild [a,b] (a >= 0 and b >= 0 and a <= b)
+ * range entry valid [a,b] (a >= 0 and b >= 0 and a <= b)
  * HttpTransact::RANGE_NONE if the content length of cached copy is zero or
  * no range entry
- * HttpTransact::RANGE_NOT_SATISFIABLE iff all range entrys are valid but
+ * HttpTransact::RANGE_NOT_SATISFIABLE iff all range entries are valid but
  * none overlap the current extent of the cached copy
- * HttpTransact::RANGE_NOT_HANDLED if out-of-order Range entrys or
+ * HttpTransact::RANGE_NOT_HANDLED if out-of-order Range entries or
  * the cached copy`s content_length is INT64_MAX (e.g. read_from_writer and trunked)
- * HttpTransact::RANGE_REQUESTED if all sub range entrys are valid and
- * in order (remove the entrys that not overlap the extent of cache copy)
+ * HttpTransact::RANGE_REQUESTED if all sub range entries are valid and
+ * in order (remove the entries that not overlap the extent of cache copy)
  */
 void
 HttpSM::parse_range_and_compare(MIMEField *field, int64_t content_length)
@@ -4600,7 +4600,7 @@ HttpSM::do_http_server_open(bool raw)
     }
   }
 
-  // We did not manage to get an exisiting session
+  // We did not manage to get an existing session
   //  and need to open a new connection
   Action *connect_action_handle;
 
@@ -5032,10 +5032,10 @@ HttpSM::handle_http_server_open()
 // void HttpSM::handle_server_setup_error(int event, void* data)
 //
 //   Handles setting t_state.current.state and calling
-//    Transact in bewteen opening an origin server connection
-//    and receving the reponse header (in the case of the
+//    Transact in between opening an origin server connection
+//    and receiving the response header (in the case of the
 //    POST, a post tunnel happens in between the sending
-//    request header and reading the resposne header
+//    request header and reading the response header
 //
 void
 HttpSM::handle_server_setup_error(int event, void *data)
@@ -5054,7 +5054,7 @@ HttpSM::handle_server_setup_error(int event, void *data)
     // it is possible only user agent post->post transform is set up
     // this happened for Linux iocore where NET_EVENT_OPEN was returned
     // for a non-existing listening port. the hack is to pass the error
-    // event for server connectionto post_transform_info
+    // event for server connection to post_transform_info
     if (c == NULL && post_transform_info.vc) {
       c = tunnel.get_consumer(post_transform_info.vc);
       // c->handler_state = HTTP_SM_TRANSFORM_FAIL;
@@ -5134,7 +5134,7 @@ HttpSM::handle_server_setup_error(int event, void *data)
     break;
   case HTTP_API_IN_CALLOUT:
   case HTTP_API_DEFERED_SERVER_ERROR:
-    // Callout in progress note that we are in defering
+    // Callout in progress note that we are in deferring
     //   the server error
     callout_state = HTTP_API_DEFERED_SERVER_ERROR;
     return;
@@ -5248,7 +5248,7 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type)
     int64_t post_bytes = chunked ? INT64_MAX : t_state.hdr_info.request_content_length;
 
     t_state.hdr_info.request_body_start = true;
-    // Note: Many browers, Netscape and IE included send two extra
+    // Note: Many browsers, Netscape and IE included send two extra
     //  bytes (CRLF) at the end of the post.  We just ignore those
     //  bytes since the sending them is not spec
 
@@ -5469,7 +5469,7 @@ HttpSM::attach_server_session(HttpServerSession * s)
   server_session = s;
   server_session->transact_count++;
 
-  // Set the mutex so that we have soemthing to update
+  // Set the mutex so that we have something to update
   //   stats with
   server_session->mutex = this->mutex;
 
@@ -5482,7 +5482,7 @@ HttpSM::attach_server_session(HttpServerSession * s)
   server_entry->vc_type = HTTP_SERVER_VC;
   server_entry->vc_handler = &HttpSM::state_send_server_request_header;
 
-  // Initate a read on the session so that the SM and not
+  // Initiate a read on the session so that the SM and not
   //  session manager will get called back if the timeout occurs
   //  or the server closes on us.  The IO Core now requires us to
   //  do the read with a buffer and a size so preallocate the
@@ -6244,7 +6244,7 @@ HttpSM::setup_push_transfer_to_cache()
   if (ua_entry->eos == true) {
     // The ua has shutdown on us already so the only data
     //  we'll get is already in the buffer.  Make sure it
-    //  fullfills the stated lenght
+    //  fulfills the stated length
     int64_t avail = ua_buffer_reader->read_avail();
 
     if (avail < nbytes) {
@@ -6374,7 +6374,7 @@ HttpSM::plugin_agents_cleanup()
 //
 //  HttpSM::kill_this()
 //
-//  This function has two phases.  One before we call the asyncrhonous
+//  This function has two phases.  One before we call the asynchronous
 //    clean up routines (api and list removal) and one after.
 //    The state about which phase we are in is kept in
 //    HttpSM::kill_this_async_done
@@ -6435,7 +6435,7 @@ HttpSM::kill_this()
     do_api_callout();
   }
   // The reentrancy_count is still valid up to this point since
-  //   the api shutdown hook is asyncronous and double frees can
+  //   the api shutdown hook is asynchronous and double frees can
   //   happen if the reentrancy count is not still valid until
   //   after all asynch callouts have completed
   //
@@ -6488,7 +6488,7 @@ HttpSM::kill_this()
     ink_mutex_release(&debug_sm_list_mutex);
 #endif
 
-    DebugSM("http", "[%" PRId64 "] dellocating sm", sm_id);
+    DebugSM("http", "[%" PRId64 "] deallocating sm", sm_id);
 //    authAdapter.destroyState();
     destroy();
   }


[21/50] git commit: TS-312: Add option to always share keep-alive connections to the origin server

Posted by zw...@apache.org.
TS-312: Add option to always share keep-alive connections to the origin server


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

Branch: refs/heads/5.0.x
Commit: d6ab7482489be6b79d911f55564afb707c7004d6
Parents: 960c3f8
Author: Bryan Call <bc...@apache.org>
Authored: Fri Dec 6 17:04:50 2013 -0800
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Dec 6 17:04:50 2013 -0800

----------------------------------------------------------------------
 CHANGES                  |  2 ++
 mgmt/RecordsConfig.cc    |  2 ++
 proxy/http/HttpConfig.cc |  1 +
 proxy/http/HttpConfig.h  |  1 +
 proxy/http/HttpSM.cc     | 16 +++++++---------
 5 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index cacc5ad..eca1bad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-312] Add option to always share keep-alive connections to the origin server
+
   *) [TS-2419] Don't close client connection when responding with a 204 and there is no body
 
   *) [TS-1146] Add RFC 5077 TLS session ticket support.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index a54e018..bf3674e 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -456,6 +456,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.http.origin_min_keep_alive_connections", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http.attach_sever_session_to_client", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  ,
 
   //       ##########################
   //       # HTTP referer filtering #

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 3c8109d..d36b3cc 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1145,6 +1145,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.oride.server_tcp_init_cwnd, "proxy.config.http.server_tcp_init_cwnd");
   HttpEstablishStaticConfigLongLong(c.oride.origin_max_connections, "proxy.config.http.origin_max_connections");
   HttpEstablishStaticConfigLongLong(c.origin_min_keep_alive_connections, "proxy.config.http.origin_min_keep_alive_connections");
+  HttpEstablishStaticConfigLongLong(c.attach_server_session_to_client, "proxy.config.http.attach_server_session_to_client");
 
   HttpEstablishStaticConfigByte(c.parent_proxy_routing_enable, "proxy.config.http.parent_proxy_routing_enable");
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 033ee7f..a663e2f 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -640,6 +640,7 @@ public:
 
   MgmtInt server_max_connections;
   MgmtInt origin_min_keep_alive_connections; // TODO: This one really ought to be overridable, but difficult right now.
+  MgmtInt attach_server_session_to_client;
 
   MgmtByte parent_proxy_routing_enable;
   MgmtByte disable_ssl_parenting;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6ab7482/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 503ac9b..1ae8615 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2934,15 +2934,13 @@ HttpSM::tunnel_handler_server(int event, HttpTunnelProducer * p)
     server_session->server_trans_stat--;
     HTTP_DECREMENT_DYN_STAT(http_current_server_transactions_stat);
 
-    // If the client is still around, attach the server session
-    // to so the next ka request can use it.  We bind privately to the
-    // client to add some degree of affinity to the system.  However,
-    // we turn off private binding when outbound connections are being
-    // limit since it makes it too expensive to initiate a purge of idle
-    // server keep-alive sessions
-    if (ua_session && t_state.client_info.keep_alive == HTTP_KEEPALIVE &&
-        t_state.http_config_param->server_max_connections <= 0 &&
-        t_state.txn_conf->origin_max_connections <= 0) {
+    // If the option to attach the server session to the client session is set
+    // and if the client is still around and the client is keep-alive, attach the
+    // server session to so the next ka request can use it.  Server sessions will
+    // be placed into the shared pool if the next incoming request is for a different
+    // origin server
+    if (t_state.http_config_param->attach_server_session_to_client == 1 &&
+        ua_session && t_state.client_info.keep_alive == HTTP_KEEPALIVE) {
       ua_session->attach_server_session(server_session);
     } else {
       // Release the session back into the shared session pool


[39/50] git commit: TS-312: s/sever/server/

Posted by zw...@apache.org.
TS-312: s/sever/server/


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

Branch: refs/heads/5.0.x
Commit: 39862b62afa2125e22e7072fe9a7821f38c5e4cf
Parents: 5cce736
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 10:09:10 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 10:09:10 2013 -0800

----------------------------------------------------------------------
 mgmt/RecordsConfig.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/39862b62/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 4b69724..94b9055 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -446,7 +446,7 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.http.origin_min_keep_alive_connections", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.attach_sever_session_to_client", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.attach_server_session_to_client", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
 
   //       ##########################


[11/50] git commit: Fix typo

Posted by zw...@apache.org.
Fix typo

Fixed typo breaking HTML rendering

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

Branch: refs/heads/5.0.x
Commit: 16882d8224a0af0f0de597709ee6587295ee9e04
Parents: a514c64
Author: Jean Baptiste Favre <gi...@jbfavre.org>
Authored: Fri Dec 6 17:53:03 2013 +0100
Committer: Jean Baptiste Favre <gi...@jbfavre.org>
Committed: Fri Dec 6 17:53:03 2013 +0100

----------------------------------------------------------------------
 .../sample-buffered-null-transformation-plugin.en.rst              | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/16882d82/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
----------------------------------------------------------------------
diff --git a/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst b/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
index b9f6826..866eb61 100644
--- a/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
+++ b/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
@@ -203,7 +203,7 @@ transform:
    vconnection:
 
    **Writing the Buffered Data to the Output Vconnection**
-   {#WritingBufferedtDataIntoVConnection)
+   {#WritingBufferedtDataIntoVConnection}
 
    .. figure:: /static/images/sdk/vconn_buf_output.jpg
       :alt: Writing the Buffered Data to the Output Vconnection


[41/50] git commit: TS-2424: set diags log file for each caller

Posted by zw...@apache.org.
TS-2424: set diags log file for each caller

Since DiagsConfig.cc is built into a static library, we can't rely
on the preprocessor to determine what the diagnostic log file should
be. Add a filename to the constructor so that each usage uses an
explicit name.


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

Branch: refs/heads/5.0.x
Commit: 4b94cdfd7942595fc461344f1bae834672e84502
Parents: e510c58
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 09:04:18 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 11:22:15 2013 -0800

----------------------------------------------------------------------
 mgmt/Main.cc                   |  5 +++--
 proxy/Main.cc                  |  5 +++--
 proxy/logging/LogStandalone.cc | 14 ++++++++++++--
 proxy/sac.cc                   |  5 ++++-
 proxy/shared/DiagsConfig.cc    | 20 ++++----------------
 proxy/shared/DiagsConfig.h     | 13 +++++++++----
 6 files changed, 35 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 0219e68..2452f16 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -59,6 +59,7 @@
 #include <grp.h>
 
 #define FD_THROTTLE_HEADROOM (128 + 64) // TODO: consolidate with THROTTLE_FD_HEADROOM
+#define DIAGS_LOG_FILENAME "manager.log"
 
 #if defined(freebsd)
 extern "C" int getpwnam_r(const char *name, struct passwd *result, char *buffer, size_t buflen, struct passwd **resptr);
@@ -520,7 +521,7 @@ main(int argc, char **argv)
 
   // Bootstrap the Diags facility so that we can use it while starting
   //  up the manager
-  diagsConfig = NEW(new DiagsConfig(debug_tags, action_tags, false));
+  diagsConfig = NEW(new DiagsConfig(DIAGS_LOG_FILENAME, debug_tags, action_tags, false));
   diags = diagsConfig->diags;
   diags->prefix_str = "Manager ";
 
@@ -570,7 +571,7 @@ main(int argc, char **argv)
   }
   // INKqa11968: need to set up callbacks and diags data structures
   // using configuration in records.config
-  diagsConfig = NEW(new DiagsConfig(debug_tags, action_tags, true));
+  diagsConfig = NEW(new DiagsConfig(DIAGS_LOG_FILENAME, debug_tags, action_tags, true));
   diags = diagsConfig->diags;
   RecSetDiags(diags);
   diags->prefix_str = "Manager ";

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index bc7c2d5..b03465b 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -112,6 +112,7 @@ extern "C" int plock(int);
 #endif
 
 #define DEFAULT_REMOTE_MANAGEMENT_FLAG    0
+#define DIAGS_LOG_FILENAME                "diags.log"
 
 static const long MAX_LOGIN =  sysconf(_SC_LOGIN_NAME_MAX) <= 0 ? _POSIX_LOGIN_NAME_MAX :  sysconf(_SC_LOGIN_NAME_MAX);
 
@@ -1285,7 +1286,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
   // re-start Diag completely) because at initialize, TM only has 1 thread.
   // In TS, some threads have already created, so if we delete Diag and
   // re-start it again, TS will crash.
-  diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, false));
+  diagsConfig = NEW(new DiagsConfig(DIAGS_LOG_FILENAME, error_tags, action_tags, false));
   diags = diagsConfig->diags;
   diags->prefix_str = "Server ";
   if (is_debug_tag_set("diags"))
@@ -1347,7 +1348,7 @@ main(int /* argc ATS_UNUSED */, char **argv)
     RecDebugOff();
     delete(diagsConfig);
   }
-  diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, true));
+  diagsConfig = NEW(new DiagsConfig(DIAGS_LOG_FILENAME, error_tags, action_tags, true));
   diags = diagsConfig->diags;
   RecSetDiags(diags);
   diags->prefix_str = "Server ";

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 5d79f80..931a254 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -42,6 +42,8 @@
 // Needs LibRecordsConfigInit()
 #include "RecordsConfig.h"
 
+#define LOG_FILENAME_SIZE 255
+
 class HttpBodyFactory;
 
 // globals the rest of the system depends on
@@ -196,11 +198,16 @@ check_lockfile()
 void
 init_log_standalone(const char *pgm_name, bool one_copy)
 {
+  char logfile[LOG_FILENAME_SIZE];
+
   // ensure that only one copy of the sac is running
   //
   if (one_copy) {
     check_lockfile();
   }
+
+  snprintf(logfile, sizeof(logfile), "%s.log", pgm_name);
+
   // set stdin/stdout to be unbuffered
   //
   setbuf(stdin, NULL);
@@ -210,7 +217,7 @@ init_log_standalone(const char *pgm_name, bool one_copy)
 
   init_system();
   initialize_process_manager();
-  diagsConfig = NEW(new DiagsConfig(error_tags, action_tags));
+  diagsConfig = NEW(new DiagsConfig(logfile, error_tags, action_tags));
   diags = diagsConfig->diags;
   diags_init = 1;
 }
@@ -232,11 +239,14 @@ init_log_standalone(const char *pgm_name, bool one_copy)
 void
 init_log_standalone_basic(const char *pgm_name)
 {
+  char logfile[LOG_FILENAME_SIZE];
+
+  snprintf(logfile, sizeof(logfile), "%s.log", pgm_name);
   openlog(pgm_name, LOG_PID | LOG_NDELAY | LOG_NOWAIT, LOG_DAEMON);
 
   init_system();
   const bool use_records = false;
-  diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, use_records));
+  diagsConfig = NEW(new DiagsConfig(logfile, error_tags, action_tags, use_records));
   diags = diagsConfig->diags;
   // set stdin/stdout to be unbuffered
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/proxy/sac.cc
----------------------------------------------------------------------
diff --git a/proxy/sac.cc b/proxy/sac.cc
index a9e4a9b..661b3cf 100644
--- a/proxy/sac.cc
+++ b/proxy/sac.cc
@@ -46,6 +46,8 @@
 #include "DiagsConfig.h"
 #include "I_Machine.h"
 
+#define DIAGS_LOG_FILENAME "collector.log"
+
 // sac-specific command-line flags
 //
 static int version_flag = 0;
@@ -90,8 +92,9 @@ main(int /* argc ATS_UNUSED */, char *argv[])
     _exit(0);
   }
 
-  diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, false));
+  diagsConfig = NEW(new DiagsConfig(DIAGS_LOG_FILENAME, error_tags, action_tags, false));
   diags = diagsConfig->diags;
+  diags->prefix_str = "Collector ";
 
   // initialize this application for standalone logging operation
   //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/proxy/shared/DiagsConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc
index 3cb6a3d..6576ff9 100644
--- a/proxy/shared/DiagsConfig.cc
+++ b/proxy/shared/DiagsConfig.cc
@@ -24,18 +24,6 @@
 #include "libts.h"
 #include "I_Layout.h"
 #include "DiagsConfig.h"
-#ifdef LOCAL_MANAGER
-
-#include "mgmt/Main.h"
-#define DIAGS_LOG_FILE "manager.log"
-
-#else
-#include "proxy/Main.h"
-#include "ProxyConfig.h"
-#define DIAGS_LOG_FILE "diags.log"
-
-#endif
-
 #include "P_RecCore.h"
 
 
@@ -285,7 +273,7 @@ DiagsConfig::RegisterDiagConfig()
 }
 
 
-DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
+DiagsConfig::DiagsConfig(const char * filename, const char * tags, const char * actions, bool use_records)
 {
   char diags_logpath[PATH_NAME_MAX + 1];
   xptr<char> logpath;
@@ -301,7 +289,7 @@ DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
   ////////////////////////////////////////////////////////////////////
 
   if (!use_records) {
-    diags = NEW(new Diags(bdt, bat, NULL));
+    diags = NEW(new Diags(tags, actions, NULL));
     config_diags_norecords();
     return;
   }
@@ -317,7 +305,7 @@ DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
     _exit(1);
   }
 
-  ink_filepath_make(diags_logpath, sizeof(diags_logpath), logpath, DIAGS_LOG_FILE);
+  ink_filepath_make(diags_logpath, sizeof(diags_logpath), logpath, filename);
 
   // open write append
   // diags_log_fp = fopen(diags_logpath,"w");
@@ -331,7 +319,7 @@ DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
     }
   }
 
-  diags = NEW(new Diags(bdt, bat, diags_log_fp));
+  diags = NEW(new Diags(tags, actions, diags_log_fp));
   if (diags_log_fp == NULL) {
 
     diags->print(NULL, DTA(DL_Warning),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4b94cdfd/proxy/shared/DiagsConfig.h
----------------------------------------------------------------------
diff --git a/proxy/shared/DiagsConfig.h b/proxy/shared/DiagsConfig.h
index b5a69b9..730d134 100644
--- a/proxy/shared/DiagsConfig.h
+++ b/proxy/shared/DiagsConfig.h
@@ -27,17 +27,22 @@
 
 struct DiagsConfig
 {
-  bool callbacks_established;
-  FILE *diags_log_fp;
-  Diags *diags;
 
   void reconfigure_diags();
   void config_diags_norecords();
   void parse_output_string(char *s, DiagsModeOutput * o);
   void RegisterDiagConfig();
   void register_diags_callbacks();
-    DiagsConfig(char *bdt, char *bat, bool use_records = true);
+
+  DiagsConfig(const char * filename, const char * tags, const char * actions, bool use_records = true);
    ~DiagsConfig();
+
+private:
+  bool callbacks_established;
+  FILE *diags_log_fp;
+
+public:
+  Diags *diags;
 };
 
 


[43/50] git commit: TS-2426: fix unused variable warnings

Posted by zw...@apache.org.
TS-2426: fix unused variable warnings


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

Branch: refs/heads/5.0.x
Commit: ab57e59fe645396404831bb9300d51586b570025
Parents: 536fb8e
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 12:19:35 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 12:19:35 2013 -0800

----------------------------------------------------------------------
 plugins/experimental/xdebug/xdebug.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ab57e59f/plugins/experimental/xdebug/xdebug.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/xdebug/xdebug.cc b/plugins/experimental/xdebug/xdebug.cc
index e33ffa3..b91b126 100644
--- a/plugins/experimental/xdebug/xdebug.cc
+++ b/plugins/experimental/xdebug/xdebug.cc
@@ -30,7 +30,7 @@ static TSCont XInjectHeadersCont = NULL;
 
 // Return the length of a string literal.
 template <int N> unsigned
-lengthof(const char (&str)[N]) {
+lengthof(const char (&)[N]) {
   return N - 1;
 }
 
@@ -96,7 +96,7 @@ done:
 }
 
 static int
-XInjectResponseHeaders(TSCont contp, TSEvent event, void * edata)
+XInjectResponseHeaders(TSCont /* contp */, TSEvent event, void * edata)
 {
   TSHttpTxn   txn = (TSHttpTxn)edata;
   intptr_t    xheaders = 0;
@@ -126,7 +126,7 @@ done:
 // Scan the client request headers and determine which debug headers they
 // want in the response.
 static int
-XScanRequestHeaders(TSCont contp, TSEvent event, void * edata)
+XScanRequestHeaders(TSCont /* contp */, TSEvent event, void * edata)
 {
   TSHttpTxn   txn = (TSHttpTxn)edata;
   intptr_t    xheaders = 0;
@@ -191,7 +191,7 @@ done:
 }
 
 void
-TSPluginInit(int argc, const char *argv[])
+TSPluginInit(int /* argc */, const char * /*argv */ [])
 {
   TSPluginRegistrationInfo info;
 


[18/50] git commit: TS-1146: fix the CentOS5 build

Posted by zw...@apache.org.
TS-1146: fix the CentOS5 build


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

Branch: refs/heads/5.0.x
Commit: a10b8090fcb1dc8fa745df9b12d15596ec76cc4d
Parents: 358e926
Author: James Peach <jp...@apache.org>
Authored: Fri Dec 6 16:09:43 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 6 16:09:43 2013 -0800

----------------------------------------------------------------------
 iocore/net/SSLUtils.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a10b8090/iocore/net/SSLUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index f7b5f4b..686194b 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -70,6 +70,9 @@ typedef SSL_METHOD * ink_ssl_method_t;
 #endif
 
 #if TS_USE_TLS_TICKETS
+static int ssl_callback_session_ticket(SSL *, unsigned char *, unsigned char *, EVP_CIPHER_CTX *, HMAC_CTX *, int);
+#endif /* TS_USE_TLS_TICKETS */
+
 struct ssl_ticket_key_t
 {
   unsigned char key_name[16];
@@ -77,10 +80,7 @@ struct ssl_ticket_key_t
   unsigned char aes_key[16];
 };
 
-static int ssl_callback_session_ticket(SSL *, unsigned char *, unsigned char *, EVP_CIPHER_CTX *, HMAC_CTX *, int);
 static int ssl_session_ticket_index = 0;
-#endif /* TS_USE_TLS_TICKETS */
-
 static ProxyMutex ** sslMutexArray;
 static bool open_ssl_initialized = false;
 


[47/50] git commit: TS-2251: simplify LogBuffer reference counting

Posted by zw...@apache.org.
TS-2251: simplify LogBuffer reference counting


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

Branch: refs/heads/5.0.x
Commit: 7244c89db2c0408c286f6f21fae94fceca24fd43
Parents: a302c86
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 20:52:04 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Dec 11 20:45:09 2013 -0800

----------------------------------------------------------------------
 CHANGES                   |  2 ++
 proxy/logging/LogBuffer.h | 19 ++++++++-----------
 2 files changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7244c89d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 22608c4..8a92590 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-2251] Simplify LogBuffer reference counting.
+
   *) [TS-2190] Remove cache.log from the cachurl plugin.
 
   *) [TS-2426] Add a new plugin, xdebug, for cache debugging using HTTP headers.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7244c89d/proxy/logging/LogBuffer.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogBuffer.h b/proxy/logging/LogBuffer.h
index e12fa25..20ab601 100644
--- a/proxy/logging/LogBuffer.h
+++ b/proxy/logging/LogBuffer.h
@@ -188,20 +188,17 @@ public:
                                   int write_to_len, long timestamp, long timestamp_us,
                                   unsigned buffer_version, LogFieldList * alt_fieldlist = NULL,
                                   char *alt_printf_str = NULL);
-  static void destroy(LogBuffer *lb)
-  {
-    int result, old_ref, new_ref;
-
-    do {
-      old_ref = lb->m_references;
-      new_ref = old_ref - 1;
-      result = ink_atomic_cas(&lb->m_references, old_ref, new_ref);
-    } while(!result);
 
-    ink_release_assert(new_ref >= 0);
+  static void destroy(LogBuffer *lb) {
+    // ink_atomic_increment() returns the previous value, so when it was 1, we are
+    // the thread that decremented to zero and should delete ...
+    int refcnt = ink_atomic_increment(&lb->m_references, -1);
 
-    if (new_ref == 0)
+    if (refcnt == 1) {
       delete lb;
+    }
+
+    ink_release_assert(refcnt >= 0);
   }
 
 private:


[14/50] git commit: Another typo fix

Posted by zw...@apache.org.
Another typo fix

Last code part was not well formatted.
Sorry for missing it at first time

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

Branch: refs/heads/5.0.x
Commit: 82ad4efcc899c9cf570cc143981c706f257a9893
Parents: eaaf889
Author: Jean Baptiste Favre <gi...@jbfavre.org>
Authored: Fri Dec 6 22:19:22 2013 +0100
Committer: Jean Baptiste Favre <gi...@jbfavre.org>
Committed: Fri Dec 6 22:19:22 2013 +0100

----------------------------------------------------------------------
 .../sample-buffered-null-transformation-plugin.en.rst        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ad4efc/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
----------------------------------------------------------------------
diff --git a/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst b/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
index 866eb61..f1e1b3a 100644
--- a/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
+++ b/doc/sdk/http-transformation-plugin/sample-buffered-null-transformation-plugin.en.rst
@@ -193,11 +193,11 @@ transform:
 #. The ``handle_output`` function writes the buffer to the output
    vconnection:
 
-.. code-block:: c
+   .. code-block:: c
 
-   data->output_vio =
-      TSVConnWrite (output_conn, contp, data->output_reader,
-      TSIOBufferReaderAvail (data->output_reader) );
+      data->output_vio =
+         TSVConnWrite (output_conn, contp, data->output_reader,
+         TSIOBufferReaderAvail (data->output_reader) );
 
    The following diagram illustrates the write to the output
    vconnection:


[06/50] git commit: TS-2401: Remove cache_system_config_directory

Posted by zw...@apache.org.
TS-2401: Remove cache_system_config_directory

Remove the global cache_system_config_directory array. It was only
really being used for an error message. The only real place where
it could have been use already used Layout::sysconfdir.


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

Branch: refs/heads/5.0.x
Commit: b6288c446f65d48f047af8b57991d41203e4f2c0
Parents: 67306a7
Author: James Peach <jp...@apache.org>
Authored: Mon Dec 2 15:19:56 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 iocore/cache/Cache.cc            | 33 +++------------------------
 iocore/cache/CacheHosting.cc     | 42 ++++++++++++-----------------------
 iocore/cache/P_CacheHosting.h    |  5 ++---
 iocore/cache/P_CacheInternal.h   |  1 -
 iocore/cache/Store.cc            | 12 ++--------
 iocore/cluster/ClusterMachine.cc | 12 ++++------
 lib/records/I_RecCore.h          |  2 +-
 lib/records/RecCore.cc           |  6 ++++-
 8 files changed, 31 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index bf80228..39688a7 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -77,7 +77,6 @@ int cache_config_agg_write_backlog = AGG_SIZE * 2;
 int cache_config_enable_checksum = 0;
 int cache_config_alt_rewrite_max_size = 4096;
 int cache_config_read_while_writer = 0;
-char cache_system_config_directory[PATH_NAME_MAX + 1];
 int cache_config_mutex_retry_delay = 2;
 #ifdef HTTP_CACHE
 static int enable_cache_empty_http_doc = 0;
@@ -3358,26 +3357,6 @@ ink_cache_init(ModuleVersion v)
   REC_EstablishStaticConfigInt32(cache_config_mutex_retry_delay, "proxy.config.cache.mutex_retry_delay");
   Debug("cache_init", "proxy.config.cache.mutex_retry_delay = %dms", cache_config_mutex_retry_delay);
 
-  // This is just here to make sure IOCORE "standalone" works, it's usually configured in RecordsConfig.cc
-  RecRegisterConfigString(RECT_CONFIG, "proxy.config.config_dir", TS_BUILD_SYSCONFDIR, RECU_DYNAMIC, RECC_NULL, NULL);
-  REC_ReadConfigString(cache_system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
-  if (cache_system_config_directory[0] != '/') {
-    // Not an absolute path so use system one
-    Layout::get()->relative(cache_system_config_directory, sizeof(cache_system_config_directory), cache_system_config_directory);
-  }
-  Debug("cache_init", "proxy.config.config_dir = \"%s\"", cache_system_config_directory);
-  if (access(cache_system_config_directory, R_OK) == -1) {
-    ink_strlcpy(cache_system_config_directory, Layout::get()->sysconfdir,
-                sizeof(cache_system_config_directory));
-    Debug("cache_init", "proxy.config.config_dir = \"%s\"", cache_system_config_directory);
-    if (access(cache_system_config_directory, R_OK) == -1) {
-      fprintf(stderr,"unable to access() config dir '%s': %d, %s\n",
-              cache_system_config_directory, errno, strerror(errno));
-      fprintf(stderr, "please set config path via 'proxy.config.config_dir' \n");
-      _exit(1);
-    }
-  }
-
   REC_EstablishStaticConfigInt32(cache_config_hit_evacuate_percent, "proxy.config.cache.hit_evacuate_percent");
   Debug("cache_init", "proxy.config.cache.hit_evacuate_percent = %d", cache_config_hit_evacuate_percent);
 
@@ -3423,16 +3402,10 @@ ink_cache_init(ModuleVersion v)
     printf("%s  failed\n", err);
     exit(1);
   }
-  // XXX: The read for proxy.config.cache.storage_filename is unused!
-  //
+
   if (theCacheStore.n_disks == 0) {
-    char p[PATH_NAME_MAX + 1];
-    snprintf(p, sizeof(p), "%s/", cache_system_config_directory);
-    REC_ReadConfigString(p + strlen(p), "proxy.config.cache.storage_filename", PATH_NAME_MAX - strlen(p) - 1);
-    if (p[strlen(p) - 1] == '/' || p[strlen(p) - 1] == '\\') {
-      ink_strlcat(p, "storage.config", sizeof(p));
-    }
-    Warning("no cache disks specified in %s: cache disabled\n", p);
+    xptr<char> path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config"));
+    Warning("no cache disks specified in %s: cache disabled\n", (const char *)path);
     //exit(1);
   }
 #if TS_USE_INTERIM_CACHE == 1

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cache/CacheHosting.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index 93ba8e6..e3c07e3 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -192,7 +192,7 @@ CacheHostMatcher::NewEntry(matcher_line * line_info)
 
 CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
 {
-
+  xptr<char> config_path;
 
   config_tags = &CacheHosting_tags;
   ink_assert(config_tags != NULL);
@@ -200,16 +200,12 @@ CacheHostTable::CacheHostTable(Cache * c, CacheType typ)
   type = typ;
   cache = c;
   matcher_name = "[CacheHosting]";;
-  config_file_path[0] = '\0';
-  char *config_file = NULL;
-  REC_ReadConfigStringAlloc(config_file, "proxy.config.cache.hosting_filename");
-  ink_release_assert(config_file != NULL);
-  Layout::relative_to(config_file_path, sizeof(config_file_path),
-                      cache_system_config_directory, config_file);
-  ats_free(config_file);
   hostMatch = NULL;
 
-  m_numEntries = this->BuildTable();
+  config_path = RecConfigReadConfigPath("proxy.config.cache.hosting_filename");
+  ink_release_assert(config_path);
+
+  m_numEntries = this->BuildTable(config_path);
 }
 
 CacheHostTable::~CacheHostTable()
@@ -263,7 +259,7 @@ int fstat_wrapper(int fd, struct stat *s);
 //      from it
 //
 int
-CacheHostTable::BuildTableFromString(char *file_buf)
+CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_buf)
 {
   // Table build locals
   Tokenizer bufTok("\n");
@@ -417,10 +413,8 @@ CacheHostTable::BuildTableFromString(char *file_buf)
 }
 
 int
-CacheHostTable::BuildTable()
+CacheHostTable::BuildTable(const char * config_file_path)
 {
-
-  // File I/O Locals
   char *file_buf;
   int ret;
 
@@ -432,7 +426,7 @@ CacheHostTable::BuildTable()
     return 0;
   }
 
-  ret = BuildTableFromString(file_buf);
+  ret = BuildTableFromString(config_file_path, file_buf);
   ats_free(file_buf);
   return ret;
 }
@@ -631,27 +625,19 @@ CacheHostRecord::Print()
 void
 ConfigVolumes::read_config_file()
 {
-
-// File I/O Locals
+  xptr<char> config_path;
   char *file_buf;
-  char config_file_path[PATH_NAME_MAX];
-  char *config_file = NULL;
-  config_file_path[0] = '\0';
-
-  REC_ReadConfigStringAlloc(config_file, "proxy.config.cache.volume_filename");
-  ink_release_assert(config_file != NULL);
-  Layout::relative_to(config_file_path, sizeof(config_file_path),
-                      cache_system_config_directory, config_file);
-  ats_free(config_file);
 
-  file_buf = readIntoBuffer(config_file_path, "[CacheVolition]", NULL);
+  config_path = RecConfigReadConfigPath("proxy.config.cache.volume_filename");
+  ink_release_assert(config_path);
 
+  file_buf = readIntoBuffer(config_path, "[CacheVolition]", NULL);
   if (file_buf == NULL) {
-    Warning("Cannot read the config file: %s", config_file_path);
+    Warning("Cannot read the config file: %s", (const char *)config_path);
     return;
   }
 
-  BuildListFromString(config_file_path, file_buf);
+  BuildListFromString(config_path, file_buf);
   ats_free(file_buf);
   return;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cache/P_CacheHosting.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
index cd3ca2b..dc7008a 100644
--- a/iocore/cache/P_CacheHosting.h
+++ b/iocore/cache/P_CacheHosting.h
@@ -105,8 +105,8 @@ public:
   //  object is
   CacheHostTable(Cache *c, CacheType typ);
    ~CacheHostTable();
-  int BuildTable();
-  int BuildTableFromString(char *str);
+  int BuildTable(const char * config_file_path);
+  int BuildTableFromString(const char * config_file_path, char *str);
   void Match(char *rdata, int rlen, CacheHostResult *result);
   void Print();
 
@@ -128,7 +128,6 @@ public:
 private:
   CacheHostMatcher *hostMatch;
   const matcher_tags *config_tags;
-  char config_file_path[PATH_NAME_MAX];
   const char *matcher_name;     // Used for Debug/Warning/Error messages
 };
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 20b89b3..f9a5845 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -219,7 +219,6 @@ extern int cache_config_agg_write_backlog;
 extern int cache_config_enable_checksum;
 extern int cache_config_alt_rewrite_max_size;
 extern int cache_config_read_while_writer;
-extern char cache_system_config_directory[PATH_NAME_MAX + 1];
 extern int cache_clustering_enabled;
 extern int cache_config_agg_write_backlog;
 extern int cache_config_ram_cache_compress;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cache/Store.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc
index bd13bfd..2e79958 100644
--- a/iocore/cache/Store.cc
+++ b/iocore/cache/Store.cc
@@ -296,17 +296,9 @@ Store::read_config(int fd)
   // Get pathname if not checking file
 
   if (fd < 0) {
-    char storage_path[PATH_NAME_MAX + 1];
-    char storage_file[PATH_NAME_MAX + 1];
-    // XXX: cache_system_config_directory is initialized
-    //      inside ink_cache_init() which is called AFTER
-    //      initialize_store().
-    //
-    // ink_strlcpy(p, cache_system_config_directory, sizeof(p));
-    REC_ReadConfigString(storage_file, "proxy.config.cache.storage_filename", PATH_NAME_MAX);
-    Layout::relative_to(storage_path, PATH_NAME_MAX, Layout::get()->sysconfdir, storage_file);
-    Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", storage_path);
+    xptr<char> storage_path(RecConfigReadConfigPath("proxy.config.cache.storage_filename", "storage.config"));
 
+    Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", (const char *)storage_path);
     fd =::open(storage_path, O_RDONLY);
     if (fd < 0) {
       err = "error on open";

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/iocore/cluster/ClusterMachine.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterMachine.cc b/iocore/cluster/ClusterMachine.cc
index 00e99e6..408ae8a 100644
--- a/iocore/cluster/ClusterMachine.cc
+++ b/iocore/cluster/ClusterMachine.cc
@@ -29,7 +29,7 @@
 #include "ink_config.h"
 #include <unistd.h>
 #include "P_Cluster.h"
-extern char cache_system_config_directory[PATH_NAME_MAX + 1];
+#include "I_Layout.h"
 extern int num_of_cluster_threads;
 
 MachineList *machines_config = NULL;
@@ -214,13 +214,9 @@ read_MachineList(char *filename, int afd)
   int n = -1, i = 0, ln = 0;
   MachineList *l = NULL;
   ink_assert(filename || (afd != -1));
-  char p[PATH_NAME_MAX];
-  if (filename) {
-    ink_strlcpy(p, cache_system_config_directory, sizeof(p));
-    ink_strlcat(p, "/", sizeof(p));
-    ink_strlcat(p, filename, sizeof(p));
-  }
-  int fd = ((afd != -1) ? afd : open(p, O_RDONLY));
+  xptr<char> path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename));
+
+  int fd = ((afd != -1) ? afd : open(path, O_RDONLY));
   if (fd >= 0) {
     while (ink_file_fd_readline(fd, sizeof(line) - 1, line) > 0) {
       ln++;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/lib/records/I_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h
index 44b0922..8462752 100644
--- a/lib/records/I_RecCore.h
+++ b/lib/records/I_RecCore.h
@@ -56,7 +56,7 @@ char * RecConfigReadSnapshotDir();
 // Return a copy of a configuration file that is relative to sysconfdir. The relative path to the configuration
 // file is specified in the configuration variable named by "file_variable". If the configuration variable has no
 // value, NULL is returned. The caller MUST release the result with ats_free().
-char * RecConfigReadConfigPath(const char * file_variable);
+char * RecConfigReadConfigPath(const char * file_variable, const char * default_value = NULL);
 
 // Test whether the named configuration value is overridden by an environment variable. Return either
 // the overridden value, or the original value. Caller MUST NOT free the result.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b6288c44/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index d76cb90..6c17cc9 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -1091,7 +1091,7 @@ RecConfigReadSnapshotDir()
 // RecConfigReadConfigPath
 //-------------------------------------------------------------------------
 char *
-RecConfigReadConfigPath(const char * file_variable)
+RecConfigReadConfigPath(const char * file_variable, const char * default_value)
 {
   char buf[PATH_NAME_MAX + 1];
 
@@ -1101,6 +1101,10 @@ RecConfigReadConfigPath(const char * file_variable)
     return Layout::get()->relative_to(Layout::get()->sysconfdir, buf);
   }
 
+  if (default_value) {
+    return Layout::get()->relative_to(Layout::get()->sysconfdir, default_value);
+  }
+
   return NULL;
 }
 


[37/50] git commit: TS-2426: document the xdebug plugin

Posted by zw...@apache.org.
TS-2426: document the xdebug plugin


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

Branch: refs/heads/5.0.x
Commit: 399e27cc14be15d20ac786860f40a031a9be38e3
Parents: 14667c6
Author: James Peach <jp...@apache.org>
Authored: Sat Dec 7 20:29:42 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 09:28:18 2013 -0800

----------------------------------------------------------------------
 doc/reference/plugins/index.en.rst  |  1 +
 doc/reference/plugins/xdebug.en.rst | 45 ++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/399e27cc/doc/reference/plugins/index.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/index.en.rst b/doc/reference/plugins/index.en.rst
index 4001acc..4b9307b 100644
--- a/doc/reference/plugins/index.en.rst
+++ b/doc/reference/plugins/index.en.rst
@@ -73,4 +73,5 @@ directory of the Apache Traffic Server source tree. Exmperimental plugins can be
   mysql_remap.en
   stale_while_revalidate.en
   ts_lua.en
+  xdebug.en
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/399e27cc/doc/reference/plugins/xdebug.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/xdebug.en.rst b/doc/reference/plugins/xdebug.en.rst
new file mode 100644
index 0000000..bf2ac13
--- /dev/null
+++ b/doc/reference/plugins/xdebug.en.rst
@@ -0,0 +1,45 @@
+XDebug Plugin
+*************
+
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+The `XDebug` plugin allows HTTP clients to debug the operation of
+the Traffic Server cache using the ``X-Debug`` header. The plugin
+is triggered by the presence of the ``X-Debug`` header in the client
+request. The contents of this header should be the names of the
+debug headers that are desired in the response. The `XDebug` plugin
+will remove the ``X-Debug`` header from the client request and
+inject the desired headers into the client response.
+
+`XDebug` is a global plugin. It is installed by adding it to the
+:file:`plugin.config` file.
+
+Debugging Headers
+=================
+
+The `XDebug` plugin is able to generate the following debugging headers:
+
+Via
+    If the ``Via`` header is requested, the `XDebug` plugin sets the
+    :ts:cv:`proxy.config.http.insert_response_via_str` configuration variable
+    to ``3`` for the request.
+
+X-Cache-Key
+    The ``X-Cache-Key`` contains the URL that identifies the HTTP object in the
+    Traffic Server cache. This header is particularly useful if a custom cache
+    key is being used.


[32/50] git commit: TS-2077 Added to CHANGES.

Posted by zw...@apache.org.
TS-2077 Added to CHANGES.


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

Branch: refs/heads/5.0.x
Commit: a2c2ded9069a2e6d2dce22936a6e078dae98dc9b
Parents: 081848c
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Dec 10 07:59:28 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Dec 10 07:59:28 2013 -0700

----------------------------------------------------------------------
 CHANGES | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2c2ded9/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 965d50d..49488e9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2077] Remove pipeline configurations, they were no-op's anyways. We
+   still support pipelining (we always do), it's just not treated specially
+   (or optimized).
+
   *) [TS-2386] clean up unused files and codes -- round 4.2
 
   *) [TS-548] remove Initialize.cc Initialize.h


[33/50] git commit: Document the remap.config '.include' directive

Posted by zw...@apache.org.
Document the remap.config '.include' directive


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

Branch: refs/heads/5.0.x
Commit: 8b6ab74d6eb099674dc4d101297699459abcca65
Parents: 49111ee
Author: James Peach <jp...@apache.org>
Authored: Fri Dec 6 16:36:14 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 09:05:31 2013 -0800

----------------------------------------------------------------------
 doc/reference/configuration/remap.config.en.rst | 53 +++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8b6ab74d/doc/reference/configuration/remap.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/remap.config.en.rst b/doc/reference/configuration/remap.config.en.rst
index fa2713d..b6223da 100644
--- a/doc/reference/configuration/remap.config.en.rst
+++ b/doc/reference/configuration/remap.config.en.rst
@@ -284,7 +284,9 @@ Examples
 
 ::
 
-    map http://url/path http://url/path @plugin=/etc/traffic_server/config/plugins/plugin1.so @pparam=1 @pparam=2 @plugin=/etc/traffic_server/config/plugins/plugin2.so @pparam=3
+    map http://url/path http://url/path \
+        @plugin=/etc/traffic_server/config/plugins/plugin1.so @pparam=1 @pparam=2 \
+        @plugin=/etc/traffic_server/config/plugins/plugin2.so @pparam=3
 
 will pass "1" and "2" to plugin1.so and "3" to plugin2.so.
 
@@ -324,3 +326,52 @@ The filter `disable_delete_purge` will be applied to all of the
 mapping rules. (It is activated before any mappings and is never
 deactivated.) The filter `internal_only` will only be applied to the
 second mapping.
+
+Including Additional Remap Files
+================================
+
+The ``.include`` directive allows mapping rules to be spread across
+multiple files. The argument to the ``.include`` directive is a
+list of file names to be parsed for additional mapping rules. Unless
+the names are absolute paths, they are resolved relative to the
+Traffic Server configuration directory.
+
+The effect of the ``.include`` directive is as if the contents of
+the listed files is included in the parent and parsing restarted
+at the point of inclusion. This means that and filters named in the
+included files are global in scope, and that additional ``.include``
+directives are allowed.
+
+.. note::
+
+  Included remap files are not currently tracked by the configuration
+  subsystem. Changes to included remap files will not be noticed
+  by online configuration changes applied by :option:`traffic_line
+  -x` unless :file:`remap.config` has also changed.
+
+Examples
+--------
+
+In this example, a top-level :file:`remap.config` file simply
+references additional mapping rules files ::
+
+  .include filters.config
+  .include one.example.com.config two.example.com.config
+
+The file `filters.config` contains ::
+
+  .definefilter deny_purge @action=deny @method=purge
+  .definefilter allow_purge @action=allow @method=purge
+
+The file `one.example.com.config` contains::
+
+  .activatefilter deny_purge
+  map http://one.example.com http://origin-one.example.com
+  .deactivatefilter deny_purge
+
+The file `two.example.com.config` contains::
+
+  .activatefilter allow_purge
+  map http://two.example.com http://origin-two.example.com
+  .deactivatefilter dallowpurge
+


[09/50] git commit: TS-2401: Remove global system_log_dir

Posted by zw...@apache.org.
TS-2401: Remove global system_log_dir

In the 2 places that actually look at this, we implement the
predictable semantics of using proxy.config.log.logfile_dir (relative
to $PREFIX) if it is specified. Otherwise we use the compile-time
log directory.  In either case, we never fall back to different
directories. We either use the one specified by the operator or
fail loudly and suddenly.


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

Branch: refs/heads/5.0.x
Commit: 88f51768941ea440a19d8ff9ee5ef8907b72b782
Parents: bdd7af5
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 15:51:49 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 example/app-template/app-template.cc |  2 --
 lib/records/I_RecDefs.h              |  1 -
 mgmt/Main.cc                         |  9 --------
 proxy/Initialize.cc                  |  2 +-
 proxy/Main.cc                        | 13 -----------
 proxy/logging/LogConfig.cc           | 24 +++++++++-----------
 proxy/logging/LogStandalone.cc       |  1 -
 proxy/sac.cc                         |  8 -------
 proxy/shared/DiagsConfig.cc          | 37 ++++++++++++++++++-------------
 9 files changed, 32 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index fefff13..5f8cb6d 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -55,7 +55,6 @@ int system_num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
 
 char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
-char system_log_dir[PATH_NAME_MAX + 1];
 
 //int system_remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
@@ -159,7 +158,6 @@ int main(int argc, char * argv[])
   // Get TS directories
   ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory));
   ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, sizeof(system_runtime_dir));
-  ink_strlcpy(system_log_dir, Layout::get()->logdir, sizeof(system_log_dir));
 
   if (chdir(Layout::get()->prefix) < 0) {
     fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index 4517357..302b3c9 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -179,6 +179,5 @@ typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData *
 // System Defaults
 extern char system_runtime_dir[PATH_NAME_MAX + 1];
 extern char system_config_directory[PATH_NAME_MAX + 1];
-extern char system_log_dir[PATH_NAME_MAX + 1];
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index a48686b..c8e1a33 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -80,7 +80,6 @@ static bool proxy_on = true;
 // TODO: Check if really need those
 char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
-char system_log_dir[PATH_NAME_MAX + 1];
 
 char mgmt_path[PATH_NAME_MAX + 1];
 
@@ -287,14 +286,6 @@ init_dirs()
     mgmt_elog(0, "please set 'proxy.config.local_state_dir'\n");
     _exit(1);
   }
-
-  REC_ReadConfigString(buf, "proxy.config.log.logfile_dir", PATH_NAME_MAX);
-  Layout::get()->relative(system_log_dir, PATH_NAME_MAX, buf);
-  if (access(system_log_dir, W_OK) == -1) {
-    mgmt_elog(0, "unable to access() log dir'%s': %d, %s\n", system_log_dir, errno, strerror(errno));
-    mgmt_elog(0, "please set 'proxy.config.log.logfile_dir'\n");
-    _exit(1);
-  }
 }
 
 static void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/Initialize.cc
----------------------------------------------------------------------
diff --git a/proxy/Initialize.cc b/proxy/Initialize.cc
index be296b2..54026ba 100644
--- a/proxy/Initialize.cc
+++ b/proxy/Initialize.cc
@@ -276,7 +276,7 @@ init_system_diags(char *bdt, char *bat)
   char diags_logpath[PATH_NAME_MAX + 1];
 
   ink_filepath_make(diags_logpath, sizeof(diags_logpath),
-                    system_log_dir, DIAGS_LOG_FILE);
+                    Layout::get()->logdir, DIAGS_LOG_FILE);
 
   diags_log_fp = fopen(diags_logpath, "w");
   if (diags_log_fp) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 3b7e6ae..ec75cef 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -146,7 +146,6 @@ int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
 char system_runtime_dir[PATH_NAME_MAX + 1];  // Layout->runtimedir
 char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
-char system_log_dir[PATH_NAME_MAX + 1];          // Layout->logdir
 
 static char error_tags[1024] = "";
 static char action_tags[1024] = "";
@@ -288,7 +287,6 @@ init_dirs(void)
 
   ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, PATH_NAME_MAX);
   ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, PATH_NAME_MAX);
-  ink_strlcpy(system_log_dir, Layout::get()->logdir, PATH_NAME_MAX);
 
   /*
    * XXX: There is not much sense in the following code
@@ -318,17 +316,6 @@ init_dirs(void)
     }
   }
 
-  if (access(system_log_dir, W_OK) == -1) {
-    REC_ReadConfigString(buf, "proxy.config.log.logfile_dir", PATH_NAME_MAX);
-    Layout::get()->relative(system_log_dir, PATH_NAME_MAX, buf);
-    if (access(system_log_dir, W_OK) == -1) {
-      fprintf(stderr,"unable to access() log dir'%s':%d, %s\n",
-              system_log_dir, errno, strerror(errno));
-      fprintf(stderr,"please set 'proxy.config.log.logfile_dir'\n");
-      _exit(1);
-    }
-  }
-
 }
 
 //

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index c411336..6cb8e68 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -66,8 +66,6 @@
 
 #define PARTITION_HEADROOM_MB 	10
 
-char *ink_prepare_dir(char *logfile_dir);
-
 void
 LogConfig::setup_default_values()
 {
@@ -248,20 +246,18 @@ LogConfig::read_configuration_variables()
     // Make it relative from Layout
     logfile_dir = Layout::get()->relative(ptr);
     ats_free(ptr);
-    if (access(logfile_dir, W_OK) == -1) {
-      ats_free(logfile_dir);
-      logfile_dir = NULL;
-      if (access(system_log_dir, W_OK) == -1) {
-        // Try 'system_root_dir/var/log/trafficserver' directory
-        fprintf(stderr,"unable to access() log dir'%s': %d, %s\n",
-                system_log_dir, errno, strerror(errno));
-        fprintf(stderr,"please set 'proxy.config.log.logfile_dir'\n");
-        _exit(1);
-      }
-      logfile_dir = ats_strdup(system_log_dir);
-    }
+  } else {
+    ats_free(logfile_dir);
+    logfile_dir = ats_strdup(Layout::get()->logdir);
   }
 
+  if (access(logfile_dir, R_OK | W_OK | X_OK) == -1) {
+    // Try 'system_root_dir/var/log/trafficserver' directory
+    fprintf(stderr,"unable to access log directory '%s': %d, %s\n",
+            logfile_dir, errno, strerror(errno));
+    fprintf(stderr,"please set 'proxy.config.log.logfile_dir'\n");
+    _exit(1);
+  }
 
   //
   // for each predefined logging format, we need to know:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 17fd687..5bf3b6f 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -58,7 +58,6 @@ char proxy_name[MAXDNAME + 1] = "unknown";
 
 char system_config_directory[PATH_NAME_MAX + 1] = "";
 char system_runtime_dir[PATH_NAME_MAX + 1] = "";
-char system_log_dir[PATH_NAME_MAX + 1] = "";
 
 char error_tags[1024] = "";
 char action_tags[1024] = "";

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/sac.cc
----------------------------------------------------------------------
diff --git a/proxy/sac.cc b/proxy/sac.cc
index f094e04..e150507 100644
--- a/proxy/sac.cc
+++ b/proxy/sac.cc
@@ -89,14 +89,6 @@ main(int /* argc ATS_UNUSED */, char *argv[])
   snprintf(configDirectoryType, sizeof(configDirectoryType), "S%d", PATH_NAME_MAX - 1);
   process_args(argument_descriptions, countof(argument_descriptions), argv);
 
-  // Get log directory
-  ink_strlcpy(system_log_dir, Layout::get()->logdir, sizeof(system_log_dir));
-  if (access(system_log_dir, R_OK) == -1) {
-    fprintf(stderr, "unable to change to log directory \"%s\" [%d '%s']\n", system_log_dir, errno, strerror(errno));
-    fprintf(stderr, " please set correct path in env variable TS_ROOT \n");
-    exit(1);
-  }
-
   // check for the version number request
   //
   if (version_flag) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88f51768/proxy/shared/DiagsConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/shared/DiagsConfig.cc b/proxy/shared/DiagsConfig.cc
index 53af04c..27ec46b 100644
--- a/proxy/shared/DiagsConfig.cc
+++ b/proxy/shared/DiagsConfig.cc
@@ -288,6 +288,8 @@ DiagsConfig::RegisterDiagConfig()
 DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
 {
   char diags_logpath[PATH_NAME_MAX + 1];
+  xptr<char> logpath;
+
   callbacks_established = false;
   diags_log_fp = (FILE *) NULL;
   diags = NULL;
@@ -303,23 +305,26 @@ DiagsConfig::DiagsConfig(char *bdt, char *bat, bool use_records)
     config_diags_norecords();
     return;
   }
-  ////////////////////////
-  // open the diags log //
-  ////////////////////////
-
-  if (access(system_log_dir, R_OK) == -1) {
-    REC_ReadConfigString(diags_logpath, "proxy.config.log.logfile_dir", PATH_NAME_MAX);
-    Layout::get()->relative(system_log_dir, PATH_NAME_MAX, diags_logpath);
-
-    if (access(system_log_dir, R_OK) == -1) {
-      fprintf(stderr,"unable to access() log dir'%s': %d, %s\n",
-              system_log_dir, errno, strerror(errno));
-      fprintf(stderr,"please set 'proxy.config.log.logfile_dir'\n");
-      _exit(1);
-    }
+
+  // Open the diagnostics log. If proxy.config.log.logfile_dir is set use that, otherwise fall
+  // back to the configured log directory.
+
+  diags_logpath[0] = '\0';
+  REC_ReadConfigString(diags_logpath, "proxy.config.log.logfile_dir", PATH_NAME_MAX);
+  if (strlen(diags_logpath) > 0) {
+    logpath = Layout::get()->relative(diags_logpath);
+  } else {
+    logpath = ats_strdup(Layout::get()->logdir);
+  }
+
+  if (access(logpath, W_OK | R_OK) == -1) {
+    fprintf(stderr, "unable to access log directory '%s': %d, %s\n",
+            (const char *)logpath, errno, strerror(errno));
+    fprintf(stderr, "please set 'proxy.config.log.logfile_dir'\n");
+    _exit(1);
   }
-  ink_filepath_make(diags_logpath, sizeof(diags_logpath),
-                    system_log_dir, DIAGS_LOG_FILE);
+
+  ink_filepath_make(diags_logpath, sizeof(diags_logpath), logpath, DIAGS_LOG_FILE);
 
   // open write append
   // diags_log_fp = fopen(diags_logpath,"w");


[30/50] git commit: TS-2077 Remove proxy.config.http.user_agent_pipeline remnants

Posted by zw...@apache.org.
TS-2077 Remove proxy.config.http.user_agent_pipeline remnants


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

Branch: refs/heads/5.0.x
Commit: 1247f0d659801d5c8611622955f5ec008fa6856d
Parents: adbccf9
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jul 26 10:32:18 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Dec 10 07:56:06 2013 -0700

----------------------------------------------------------------------
 ci/jenkins/records.config              | 1 -
 lib/perl/lib/Apache/TS/AdminClient.pm  | 1 -
 mgmt/RecordsConfig.cc                  | 4 +---
 proxy/config/records.config.default.in | 1 -
 proxy/http/HttpConfig.cc               | 2 --
 proxy/http/HttpConfig.h                | 2 --
 6 files changed, 1 insertion(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/ci/jenkins/records.config
----------------------------------------------------------------------
diff --git a/ci/jenkins/records.config b/ci/jenkins/records.config
index ba99c95..11057d6 100644
--- a/ci/jenkins/records.config
+++ b/ci/jenkins/records.config
@@ -140,7 +140,6 @@ CONFIG proxy.config.http.send_http11_requests INT 1
    #  2 - Share, with a connection pool per worker thread
 CONFIG proxy.config.http.share_server_sessions INT 2
 CONFIG proxy.config.http.origin_server_pipeline INT 1
-CONFIG proxy.config.http.user_agent_pipeline INT 8
    ##########################
    # HTTP referer filtering #
    ##########################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/lib/perl/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index f6fa827..6f6ea73 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -521,7 +521,6 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.http.transaction_no_activity_timeout_out
  proxy.config.http_ui_enabled
  proxy.config.http.uncacheable_requests_bypass_parent
- proxy.config.http.user_agent_pipeline
  proxy.config.icp.default_reply_port
  proxy.config.icp.enabled
  proxy.config.icp.icp_configuration

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index bf3674e..1b45bfb 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -426,7 +426,7 @@ RecordElement RecordsConfig[] = {
   //       #
   {RECT_CONFIG, "proxy.config.http.send_http11_requests", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  //       #  origin_server_pipeline and user_agent_pipeline
+  //       #  origin_server_pipeline
   //       #
   //       #  0      - no keepalive
   //       #  n >= 1 - max pipeline window
@@ -434,8 +434,6 @@ RecordElement RecordsConfig[] = {
   //       #
   {RECT_CONFIG, "proxy.config.http.origin_server_pipeline", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.user_agent_pipeline", RECD_INT, "8", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
   {RECT_CONFIG, "proxy.config.http.share_server_sessions", RECD_INT, "2", RECU_RESTART_TS, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http.record_heartbeat", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/proxy/config/records.config.default.in
----------------------------------------------------------------------
diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in
index 870637d..bc3c9ce 100644
--- a/proxy/config/records.config.default.in
+++ b/proxy/config/records.config.default.in
@@ -146,7 +146,6 @@ CONFIG proxy.config.http.send_http11_requests INT 1
    #  2 - Share, with a connection pool per worker thread
 CONFIG proxy.config.http.share_server_sessions INT 2
 CONFIG proxy.config.http.origin_server_pipeline INT 1
-CONFIG proxy.config.http.user_agent_pipeline INT 8
    ##########################
    # HTTP referer filtering #
    ##########################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index d36b3cc..0ec4d61 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1179,7 +1179,6 @@ HttpConfig::startup()
   HttpEstablishStaticConfigLongLong(c.oride.flow_high_water_mark, "proxy.config.http.flow_control.high_water");
   HttpEstablishStaticConfigLongLong(c.oride.flow_low_water_mark, "proxy.config.http.flow_control.low_water");
   HttpEstablishStaticConfigLongLong(c.origin_server_pipeline, "proxy.config.http.origin_server_pipeline");
-  HttpEstablishStaticConfigLongLong(c.user_agent_pipeline, "proxy.config.http.user_agent_pipeline");
   HttpEstablishStaticConfigByte(c.oride.share_server_sessions, "proxy.config.http.share_server_sessions");
   HttpEstablishStaticConfigByte(c.oride.keep_alive_post_out, "proxy.config.http.keep_alive_post_out");
 
@@ -1433,7 +1432,6 @@ HttpConfig::reconfigure()
   }
 
   params->origin_server_pipeline = m_master.origin_server_pipeline;
-  params->user_agent_pipeline = m_master.user_agent_pipeline;
   params->oride.share_server_sessions = m_master.oride.share_server_sessions;
   params->oride.keep_alive_post_out = INT_TO_BOOL(m_master.oride.keep_alive_post_out);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1247f0d6/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index a663e2f..91470fd 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -669,7 +669,6 @@ public:
   ///////////////////////////////////////////////////
   MgmtByte session_auth_cache_keep_alive_enabled;
   MgmtInt origin_server_pipeline;
-  MgmtInt user_agent_pipeline;
   MgmtInt transaction_active_timeout_in;
   MgmtInt accept_no_activity_timeout;
 
@@ -894,7 +893,6 @@ HttpConfigParams::HttpConfigParams()
     num_url_expansions(0),
     session_auth_cache_keep_alive_enabled(1),
     origin_server_pipeline(1),
-    user_agent_pipeline(8),
     transaction_active_timeout_in(900),
     accept_no_activity_timeout(120),
     parent_connect_attempts(4),


[35/50] git commit: doc: fix various sphinx syntax errors

Posted by zw...@apache.org.
doc: fix various sphinx syntax errors


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

Branch: refs/heads/5.0.x
Commit: 5e256d253eeb3554cd942f8349032deb4b9c8afa
Parents: 8b6ab74
Author: James Peach <jp...@apache.org>
Authored: Sat Dec 7 19:59:15 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 09:19:35 2013 -0800

----------------------------------------------------------------------
 doc/reference/plugins/balancer.en.rst | 18 ++++++------------
 doc/reference/plugins/index.en.rst    |  4 ++--
 2 files changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5e256d25/doc/reference/plugins/balancer.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/balancer.en.rst b/doc/reference/plugins/balancer.en.rst
index 4fba905..43aa3ed 100644
--- a/doc/reference/plugins/balancer.en.rst
+++ b/doc/reference/plugins/balancer.en.rst
@@ -24,18 +24,16 @@ Balancer Plugin
 This is a plugin for Traffic Server, that allows you to configure
 mapping rules.
 
-To use this plugin, configure a remap.config rule like
+To use this plugin, configure a remap.config rule like this::
 
-::
    map http://foo.com http://bar.com @plugin=balancer.so @pparam=rotation:news
 
 The "To-Url" in the remap.config rule is generally not used, unless the
 lookup completely fails (i.e. this is a backup URL for extreme error
 cases).
 
-This is a list of all available options (set via @pparam):
+This is a list of all available options (set via @pparam)::
 
-::
     rotation      The name of the rotation (e.g. news) [to-host in remap]
     hash      What to hash on, url, path, cookie, ip, header (primary)
     hash2     Optional, secondary hash, to hash within a multi-host bucket
@@ -46,28 +44,24 @@ not specified, we will default to the same name as used in the To URL in
 the remap rule.
 
 The bucket width specifies how many hosts a particular hash bucket
-should contain, for example:
+should contain, for example::
 
-::
     @pparam=bucketw:2
 
 The hash parameter can be used zero or more times, without it, no
 hashing is done at all. If you have more than one hash keys, they are
-concatenated in the order specified. For example:
+concatenated in the order specified. For example::
 
-::
     @pparam=hash:ip @pparam=hash:cookie/B
 
-The "header" hash key takes a required extra value, for example:
+The "header" hash key takes a required extra value, for example::
 
-::
     @pparam=hash:header/Host
 
 For "cookie" hash keys, you can optionally specify an identifier for
 which cookie to use (without it, the entire cookie header is used). For
-example:
+example::
 
-::
     @pparam=hash:cookie/B
 
 The secondary hash ("hash2") is used to provide "stickiness" within a

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5e256d25/doc/reference/plugins/index.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/index.en.rst b/doc/reference/plugins/index.en.rst
index 875b325..4001acc 100644
--- a/doc/reference/plugins/index.en.rst
+++ b/doc/reference/plugins/index.en.rst
@@ -51,8 +51,8 @@ Experimental plugins
 ====================
 
 Plugins that are considered experimental are located in the
-```plugins/experimental`` <https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;a=tree;f=plugins/experimental;hb=HEAD>`_
-directory in the Apache Traffic Server source tree. Exmperimental plugins can be compiled by passing the
+`plugins/experimental <https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;a=tree;f=plugins/experimental;hb=HEAD>`_
+directory of the Apache Traffic Server source tree. Exmperimental plugins can be compiled by passing the
 `--enable-experimental-plugins` option to `configure`::
 
     $ autoconf -i


[31/50] git commit: TS-2077 Remove proxy.config.http.origin_server_pipeline

Posted by zw...@apache.org.
TS-2077 Remove proxy.config.http.origin_server_pipeline


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

Branch: refs/heads/5.0.x
Commit: 081848cc800ddc7e730f5f7d69db12fc1b0cbe49
Parents: 1247f0d
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Jul 30 14:10:28 2013 +0200
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Dec 10 07:56:06 2013 -0700

----------------------------------------------------------------------
 ci/jenkins/records.config              |  1 -
 lib/perl/lib/Apache/TS/AdminClient.pm  |  1 -
 mgmt/RecordsConfig.cc                  |  8 ----
 proxy/config/records.config.default.in |  1 -
 proxy/hdrs/HTTP.h                      |  3 +-
 proxy/http/HttpConfig.cc               |  2 -
 proxy/http/HttpConfig.h                |  2 -
 proxy/http/HttpSM.cc                   |  2 +-
 proxy/http/HttpTransact.cc             | 64 ++++++++++++++---------------
 9 files changed, 32 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/ci/jenkins/records.config
----------------------------------------------------------------------
diff --git a/ci/jenkins/records.config b/ci/jenkins/records.config
index 11057d6..2cc3493 100644
--- a/ci/jenkins/records.config
+++ b/ci/jenkins/records.config
@@ -139,7 +139,6 @@ CONFIG proxy.config.http.send_http11_requests INT 1
    #  1 - Share, with a single global connection pool
    #  2 - Share, with a connection pool per worker thread
 CONFIG proxy.config.http.share_server_sessions INT 2
-CONFIG proxy.config.http.origin_server_pipeline INT 1
    ##########################
    # HTTP referer filtering #
    ##########################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/lib/perl/lib/Apache/TS/AdminClient.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm b/lib/perl/lib/Apache/TS/AdminClient.pm
index 6f6ea73..37281ae 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -483,7 +483,6 @@ The Apache Traffic Server Administration Manual will explain what these strings
  proxy.config.http.number_of_redirections
  proxy.config.http.origin_max_connections
  proxy.config.http.origin_min_keep_alive_connections
- proxy.config.http.origin_server_pipeline
  proxy.config.http.parent_proxies
  proxy.config.http.parent_proxy.connect_attempts_timeout
  proxy.config.http.parent_proxy.fail_threshold

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 1b45bfb..4b69724 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -426,14 +426,6 @@ RecordElement RecordsConfig[] = {
   //       #
   {RECT_CONFIG, "proxy.config.http.send_http11_requests", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  //       #  origin_server_pipeline
-  //       #
-  //       #  0      - no keepalive
-  //       #  n >= 1 - max pipeline window
-  //       #           (1 is the same HTTP/1.0 keepalive)
-  //       #
-  {RECT_CONFIG, "proxy.config.http.origin_server_pipeline", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}
-  ,
   {RECT_CONFIG, "proxy.config.http.share_server_sessions", RECD_INT, "2", RECU_RESTART_TS, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http.record_heartbeat", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/config/records.config.default.in
----------------------------------------------------------------------
diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in
index bc3c9ce..91b0969 100644
--- a/proxy/config/records.config.default.in
+++ b/proxy/config/records.config.default.in
@@ -145,7 +145,6 @@ CONFIG proxy.config.http.send_http11_requests INT 1
    #  1 - Share, with a single global connection pool
    #  2 - Share, with a connection pool per worker thread
 CONFIG proxy.config.http.share_server_sessions INT 2
-CONFIG proxy.config.http.origin_server_pipeline INT 1
    ##########################
    # HTTP referer filtering #
    ##########################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/hdrs/HTTP.h
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 45a59bf..e6eabac 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -91,8 +91,7 @@ enum HTTPKeepAlive
 {
   HTTP_KEEPALIVE_UNDEFINED = 0,
   HTTP_NO_KEEPALIVE,
-  HTTP_KEEPALIVE,
-  HTTP_PIPELINE
+  HTTP_KEEPALIVE
 };
 
 enum HTTPWarningCode

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 0ec4d61..26fa002 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1178,7 +1178,6 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.oride.flow_control_enabled, "proxy.config.http.flow_control.enabled");
   HttpEstablishStaticConfigLongLong(c.oride.flow_high_water_mark, "proxy.config.http.flow_control.high_water");
   HttpEstablishStaticConfigLongLong(c.oride.flow_low_water_mark, "proxy.config.http.flow_control.low_water");
-  HttpEstablishStaticConfigLongLong(c.origin_server_pipeline, "proxy.config.http.origin_server_pipeline");
   HttpEstablishStaticConfigByte(c.oride.share_server_sessions, "proxy.config.http.share_server_sessions");
   HttpEstablishStaticConfigByte(c.oride.keep_alive_post_out, "proxy.config.http.keep_alive_post_out");
 
@@ -1431,7 +1430,6 @@ HttpConfig::reconfigure()
     params->oride.flow_high_water_mark = params->oride.flow_low_water_mark = 0;
   }
 
-  params->origin_server_pipeline = m_master.origin_server_pipeline;
   params->oride.share_server_sessions = m_master.oride.share_server_sessions;
   params->oride.keep_alive_post_out = INT_TO_BOOL(m_master.oride.keep_alive_post_out);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 91470fd..b3b9e40 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -668,7 +668,6 @@ public:
   // connection variables. timeouts are in seconds //
   ///////////////////////////////////////////////////
   MgmtByte session_auth_cache_keep_alive_enabled;
-  MgmtInt origin_server_pipeline;
   MgmtInt transaction_active_timeout_in;
   MgmtInt accept_no_activity_timeout;
 
@@ -892,7 +891,6 @@ HttpConfigParams::HttpConfigParams()
     url_expansions(NULL),
     num_url_expansions(0),
     session_auth_cache_keep_alive_enabled(1),
-    origin_server_pipeline(1),
     transaction_active_timeout_in(900),
     accept_no_activity_timeout(120),
     parent_connect_attempts(4),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index cc79002..590aff1 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3080,7 +3080,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer * c)
   case VC_EVENT_WRITE_COMPLETE:
     c->write_success = true;
     t_state.client_info.abort = HttpTransact::DIDNOT_ABORT;
-    if (t_state.client_info.keep_alive == HTTP_KEEPALIVE || t_state.client_info.keep_alive == HTTP_PIPELINE) {
+    if (t_state.client_info.keep_alive == HTTP_KEEPALIVE) {
       if (t_state.www_auth_content != HttpTransact::CACHE_AUTH_SERVE || ua_session->get_bound_ss()) {
         // successful keep-alive
         close_connection = false;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/081848cc/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index a7a14a2..59391e3 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -2545,7 +2545,7 @@ HttpTransact::HandleCacheOpenReadHit(State* s)
       // we haven't done the ICP lookup yet. The following is to
       // fake an icp_info to cater for build_request's needs
       s->icp_info.http_version.set(1, 0);
-      if (!s->txn_conf->keep_alive_enabled_out || s->http_config_param->origin_server_pipeline == 0) {
+      if (!s->txn_conf->keep_alive_enabled_out) {
         s->icp_info.keep_alive = HTTP_NO_KEEPALIVE;
       } else {
         s->icp_info.keep_alive = HTTP_KEEPALIVE;
@@ -3025,7 +3025,7 @@ HttpTransact::HandleICPLookup(State* s)
     //   values are not initialized.
     // Force them to be initialized
     s->icp_info.http_version.set(1, 0);
-    if (!s->txn_conf->keep_alive_enabled_out || s->http_config_param->origin_server_pipeline == 0) {
+    if (!s->txn_conf->keep_alive_enabled_out) {
       s->icp_info.keep_alive = HTTP_NO_KEEPALIVE;
     } else {
       s->icp_info.keep_alive = HTTP_KEEPALIVE;
@@ -4063,26 +4063,26 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
     break;
 
   case HTTP_STATUS_HTTPVER_NOT_SUPPORTED:      // 505
+    {
+      bool keep_alive = (s->current.server->keep_alive == HTTP_KEEPALIVE);
 
-    bool keep_alive;
-    keep_alive = ((s->current.server->keep_alive == HTTP_KEEPALIVE) ||
-                  (s->current.server->keep_alive == HTTP_PIPELINE));
-
-    s->next_action = how_to_open_connection(s);
+      s->next_action = how_to_open_connection(s);
 
-    /* Downgrade the request level and retry */
-    if (!HttpTransactHeaders::downgrade_request(&keep_alive, &s->hdr_info.server_request)) {
-      build_error_response(s, HTTP_STATUS_HTTPVER_NOT_SUPPORTED, "HTTP Version Not Supported", "response#bad_version", "");
-      s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
-      s->already_downgraded = true;
-    } else {
-      if (!keep_alive) {
-        /* START Hack */
-        (s->hdr_info.server_request).field_delete(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION);
-        /* END   Hack */
+      /* Downgrade the request level and retry */
+      if (!HttpTransactHeaders::downgrade_request(&keep_alive, &s->hdr_info.server_request)) {
+        build_error_response(s, HTTP_STATUS_HTTPVER_NOT_SUPPORTED, "HTTP Version Not Supported",
+                             "response#bad_version", "");
+        s->next_action = PROXY_SEND_ERROR_CACHE_NOOP;
+        s->already_downgraded = true;
+      } else {
+        if (!keep_alive) {
+          /* START Hack */
+          (s->hdr_info.server_request).field_delete(MIME_FIELD_PROXY_CONNECTION, MIME_LEN_PROXY_CONNECTION);
+          /* END   Hack */
+        }
+        s->already_downgraded = true;
+        s->next_action = how_to_open_connection(s);
       }
-      s->already_downgraded = true;
-      s->next_action = how_to_open_connection(s);
     }
     return;
 
@@ -4391,8 +4391,7 @@ HttpTransact::handle_no_cache_operation_on_forward_server_response(State* s)
   DebugTxn("http_trans", "[handle_no_cache_operation_on_forward_server_response] (hncoofsr)");
   DebugTxn("http_seq", "[handle_no_cache_operation_on_forward_server_response]");
 
-  bool keep_alive = true;
-  keep_alive = ((s->current.server->keep_alive == HTTP_KEEPALIVE) || (s->current.server->keep_alive == HTTP_PIPELINE));
+  bool keep_alive = s->current.server->keep_alive == HTTP_KEEPALIVE;
   const char *warn_text = NULL;
 
   switch (s->hdr_info.server_response.status_get()) {
@@ -4902,7 +4901,7 @@ HttpTransact::get_ka_info_from_host_db(State *s, ConnectionAttributes *server_in
       (http11_if_hostdb == true &&
        host_db_info->app.http_data.http_version == HostDBApplicationInfo::HTTP_VERSION_11)) {
     server_info->http_version.set(1, 1);
-    server_info->keep_alive = HTTP_PIPELINE;
+    server_info->keep_alive = HTTP_KEEPALIVE;
   } else if (host_db_info->app.http_data.http_version == HostDBApplicationInfo::HTTP_VERSION_10) {
     server_info->http_version.set(1, 0);
     server_info->keep_alive = HTTP_KEEPALIVE;
@@ -4921,15 +4920,9 @@ HttpTransact::get_ka_info_from_host_db(State *s, ConnectionAttributes *server_in
   /////////////////////////////
   // origin server keep_alive //
   /////////////////////////////
-  if ((!s->txn_conf->keep_alive_enabled_out) || (s->http_config_param->origin_server_pipeline == 0)) {
+  if (!s->txn_conf->keep_alive_enabled_out) {
     server_info->keep_alive = HTTP_NO_KEEPALIVE;
   }
-  ///////////////////////////////
-  // keep_alive w/o pipelining  //
-  ///////////////////////////////
-  if ((server_info->keep_alive == HTTP_PIPELINE) && (s->http_config_param->origin_server_pipeline <= 1)) {
-    server_info->keep_alive = HTTP_KEEPALIVE;
-  }
 
   return;
 }
@@ -6634,12 +6627,15 @@ void
 HttpTransact::handle_request_keep_alive_headers(State* s, HTTPVersion ver, HTTPHdr* heads)
 {
   enum KA_Action_t
-  { KA_UNKNOWN, KA_DISABLED, KA_CLOSE, KA_CONNECTION };
+  {
+    KA_UNKNOWN,
+    KA_DISABLED,
+    KA_CLOSE,
+    KA_CONNECTION
+  };
 
   KA_Action_t ka_action = KA_UNKNOWN;
-
-  bool upstream_ka = ((s->current.server->keep_alive == HTTP_KEEPALIVE) ||
-                      (s->current.server->keep_alive == HTTP_PIPELINE));
+  bool upstream_ka = (s->current.server->keep_alive == HTTP_KEEPALIVE);
 
   ink_assert(heads->type_get() == HTTP_TYPE_REQUEST);
 
@@ -6751,7 +6747,7 @@ HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, HTTP
   }
 
   // Check pre-conditions for keep-alive
-  if (s->client_info.keep_alive != HTTP_KEEPALIVE && s->client_info.keep_alive != HTTP_PIPELINE) {
+  if (s->client_info.keep_alive != HTTP_KEEPALIVE) {
     ka_action = KA_DISABLED;
   } else if (HTTP_MAJOR(ver.m_version) == 0) {  /* No K-A for 0.9 apps */
     ka_action = KA_DISABLED;


[02/50] git commit: TS-2401: Replace system_root_dir with Layout::prefix

Posted by zw...@apache.org.
TS-2401: Replace system_root_dir with Layout::prefix


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

Branch: refs/heads/5.0.x
Commit: fa100cffa77b33c723ad0236876477a3c054bac1
Parents: bb26f42
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 14:50:48 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:48 2013 -0800

----------------------------------------------------------------------
 example/app-template/app-template.cc |  8 +++-----
 iocore/hostdb/HostDB.cc              |  2 +-
 lib/records/I_RecDefs.h              |  1 -
 mgmt/Main.cc                         |  9 ++++-----
 proxy/InkAPI.cc                      |  2 +-
 proxy/Main.cc                        | 10 +++++-----
 proxy/logging/LogStandalone.cc       |  1 -
 7 files changed, 14 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/example/app-template/app-template.cc
----------------------------------------------------------------------
diff --git a/example/app-template/app-template.cc b/example/app-template/app-template.cc
index d4d63cd..fefff13 100644
--- a/example/app-template/app-template.cc
+++ b/example/app-template/app-template.cc
@@ -53,7 +53,6 @@ int system_num_of_processors  = ink_number_of_processors();
 int system_num_of_net_threads = DEFAULT_NUMBER_OF_THREADS;
 int system_num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS;
 
-char system_root_dir[PATH_NAME_MAX + 1];
 char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
 char system_log_dir[PATH_NAME_MAX + 1];
@@ -158,17 +157,16 @@ int main(int argc, char * argv[])
   }
 
   // Get TS directories
-  ink_strlcpy(system_root_dir, Layout::get()->prefix, sizeof(system_root_dir));
   ink_strlcpy(system_config_directory, Layout::get()->sysconfdir, sizeof(system_config_directory));
   ink_strlcpy(system_runtime_dir, Layout::get()->runtimedir, sizeof(system_runtime_dir));
   ink_strlcpy(system_log_dir, Layout::get()->logdir, sizeof(system_log_dir));
 
-  if (system_root_dir[0] && (chdir(system_root_dir) < 0)) {
-    fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", system_root_dir, errno, strerror(errno));
+  if (chdir(Layout::get()->prefix) < 0) {
+    fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n", Layout::get()->prefix, errno, strerror(errno));
     fprintf(stderr," please set correct path in env variable TS_ROOT \n");
     _exit(1);
   } else {
-    printf("[tsapp] using root directory '%s'\n",system_root_dir);
+    printf("[tsapp] using root directory '%s'\n", Layou::get()->prefix);
   }
 
   // Diags

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0b114b4..0ffd5bc 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -391,7 +391,7 @@ HostDBCache::start(int flags)
   REC_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
 
   if (storage_path[0] != '/') {
-    Layout::relative_to(storage_path, PATH_NAME_MAX, system_root_dir, storage_path);
+    Layout::relative_to(storage_path, PATH_NAME_MAX, Layout::get()->prefix, storage_path);
   }
 
   Debug("hostdb", "Storage path is %s", storage_path);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/lib/records/I_RecDefs.h
----------------------------------------------------------------------
diff --git a/lib/records/I_RecDefs.h b/lib/records/I_RecDefs.h
index 9a22613..4517357 100644
--- a/lib/records/I_RecDefs.h
+++ b/lib/records/I_RecDefs.h
@@ -177,7 +177,6 @@ typedef int (*RecRawStatSyncCb) (const char *name, RecDataT data_type, RecData *
 
 
 // System Defaults
-extern char system_root_dir[PATH_NAME_MAX + 1];
 extern char system_runtime_dir[PATH_NAME_MAX + 1];
 extern char system_config_directory[PATH_NAME_MAX + 1];
 extern char system_log_dir[PATH_NAME_MAX + 1];

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 59d697a..a48686b 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -78,7 +78,6 @@ static char action_tags[1024] = "";
 static bool proxy_on = true;
 
 // TODO: Check if really need those
-char system_root_dir[PATH_NAME_MAX + 1];
 char system_runtime_dir[PATH_NAME_MAX + 1];
 char system_config_directory[PATH_NAME_MAX + 1];
 char system_log_dir[PATH_NAME_MAX + 1];
@@ -301,13 +300,14 @@ init_dirs()
 static void
 chdir_root()
 {
+  const char * prefix = Layout::get()->prefix;
 
-  if (system_root_dir[0] && (chdir(system_root_dir) < 0)) {
-    mgmt_elog(0, "unable to change to root directory \"%s\" [%d '%s']\n", system_root_dir, errno, strerror(errno));
+  if (chdir(prefix) < 0) {
+    mgmt_elog(0, "unable to change to root directory \"%s\" [%d '%s']\n", prefix, errno, strerror(errno));
     mgmt_elog(0, " please set correct path in env variable TS_ROOT \n");
     exit(1);
   } else {
-    mgmt_log("[TrafficManager] using root directory '%s'\n",system_root_dir);
+    mgmt_log("[TrafficManager] using root directory '%s'\n", prefix);
   }
 }
 
@@ -370,7 +370,6 @@ main(int argc, char **argv)
 {
   // Before accessing file system initialize Layout engine
   Layout::create();
-  ink_strlcpy(system_root_dir, Layout::get()->prefix, sizeof(system_root_dir));
   ink_strlcpy(mgmt_path, Layout::get()->sysconfdir, sizeof(mgmt_path));
 
   // change the directory to the "root" directory

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 4b533d7..1b4ce13 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -1705,7 +1705,7 @@ TShrtime()
 const char *
 TSInstallDirGet(void)
 {
-  return system_root_dir;
+  return Layout::get()->prefix;
 }
 
 const char *

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 3cdd0f4..3b7e6ae 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -144,7 +144,6 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST;
 static char command_string[512] = "";
 int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
-char system_root_dir[PATH_NAME_MAX + 1];         // Layout->prefix
 char system_runtime_dir[PATH_NAME_MAX + 1];  // Layout->runtimedir
 char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
 char system_log_dir[PATH_NAME_MAX + 1];          // Layout->logdir
@@ -1099,13 +1098,15 @@ run_RegressionTest()
 static void
 chdir_root()
 {
-  if (system_root_dir[0] && (chdir(system_root_dir) < 0)) {
+  const char * prefix = Layout::get()->prefix;
+
+  if (chdir(prefix) < 0) {
     fprintf(stderr,"unable to change to root directory \"%s\" [%d '%s']\n",
-            system_root_dir, errno, strerror(errno));
+            prefix, errno, strerror(errno));
     fprintf(stderr," please set correct path in env variable TS_ROOT \n");
     _exit(1);
   } else {
-    printf("[TrafficServer] using root directory '%s'\n", system_root_dir);
+    printf("[TrafficServer] using root directory '%s'\n", prefix);
   }
 }
 
@@ -1291,7 +1292,6 @@ main(int /* argc ATS_UNUSED */, char **argv)
 
   // Before accessing file system initialize Layout engine
   Layout::create();
-  ink_strlcpy(system_root_dir, Layout::get()->prefix, sizeof(system_root_dir));
   chdir_root(); // change directory to the install root of traffic server.
 
   process_args(argument_descriptions, countof(argument_descriptions), argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa100cff/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 014baac..17fd687 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -56,7 +56,6 @@ int remote_management_flag = 0;
 int auto_clear_hostdb_flag = 0;
 char proxy_name[MAXDNAME + 1] = "unknown";
 
-char system_root_dir[PATH_NAME_MAX + 1] = "";
 char system_config_directory[PATH_NAME_MAX + 1] = "";
 char system_runtime_dir[PATH_NAME_MAX + 1] = "";
 char system_log_dir[PATH_NAME_MAX + 1] = "";


[23/50] git commit: TS-2082: remove NON_MODULAR define

Posted by zw...@apache.org.
TS-2082: remove NON_MODULAR define


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

Branch: refs/heads/5.0.x
Commit: 5140b18d0c15be1b532edab8c92b00b7c862324f
Parents: 51ce9ae
Author: Zhao Yongming <mi...@gmail.com>
Authored: Thu Nov 7 18:53:14 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 14:30:19 2013 +0800

----------------------------------------------------------------------
 iocore/cache/Cache.cc                | 11 +---------
 iocore/cache/CachePages.cc           |  2 --
 iocore/cache/CachePagesInternal.cc   |  4 ----
 iocore/cluster/ClusterAPI.cc         |  7 -------
 iocore/cluster/ClusterHandlerBase.cc |  5 +----
 iocore/cluster/ClusterProcessor.cc   |  2 --
 iocore/cluster/P_ClusterCache.h      |  2 --
 iocore/cluster/P_ClusterInternal.h   |  2 --
 iocore/hostdb/HostDB.cc              | 34 -------------------------------
 iocore/hostdb/MultiCache.cc          |  6 ------
 iocore/net/I_Socks.h                 |  3 +--
 iocore/net/UnixNetPages.cc           |  4 ----
 iocore/net/UnixNetProcessor.cc       |  4 ----
 lib/ts/ink_config.h.in               |  1 -
 14 files changed, 3 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 39688a7..711b7c9 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -25,10 +25,8 @@
 #include "P_Cache.h"
 
 // Cache Inspector and State Pages
-#ifdef NON_MODULAR
 #include "P_CacheTest.h"
 #include "StatPages.h"
-#endif
 
 #include "I_Layout.h"
 
@@ -580,7 +578,7 @@ static const int DEFAULT_CACHE_OPTIONS = (O_RDWR | _O_ATTRIB_OVERLAPPED);
 int
 CacheProcessor::start_internal(int flags)
 {
-#ifdef NON_MODULAR
+
   ink_assert((int)TS_EVENT_CACHE_OPEN_READ == (int)CACHE_EVENT_OPEN_READ);
   ink_assert((int)TS_EVENT_CACHE_OPEN_READ_FAILED == (int)CACHE_EVENT_OPEN_READ_FAILED);
   ink_assert((int)TS_EVENT_CACHE_OPEN_WRITE == (int)CACHE_EVENT_OPEN_WRITE);
@@ -593,7 +591,6 @@ CacheProcessor::start_internal(int flags)
   ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_BLOCKED == (int)CACHE_EVENT_SCAN_OPERATION_BLOCKED);
   ink_assert((int)TS_EVENT_CACHE_SCAN_OPERATION_FAILED == (int)CACHE_EVENT_SCAN_OPERATION_FAILED);
   ink_assert((int)TS_EVENT_CACHE_SCAN_DONE == (int)CACHE_EVENT_SCAN_DONE);
-#endif
 
 #if AIO_MODE == AIO_MODE_NATIVE
   int etype = ET_NET;
@@ -2218,12 +2215,10 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data
 
 int
 Cache::open_done() {
-#ifdef NON_MODULAR
   Action *register_ShowCache(Continuation * c, HTTPHdr * h);
   Action *register_ShowCacheInternal(Continuation *c, HTTPHdr *h);
   statPagesManager.register_http("cache", register_ShowCache);
   statPagesManager.register_http("cache-internal", register_ShowCacheInternal);
-#endif
   if (total_good_nvol == 0) {
     ready = CACHE_INIT_FAILED;
     cacheProcessor.cacheInitialized();
@@ -2645,7 +2640,6 @@ Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char *hostn
     return ACTION_RESULT_DONE;
 }
 
-#ifdef NON_MODULAR
 Action *
 Cache::lookup(Continuation *cont, CacheURL *url, CacheFragType type)
 {
@@ -2656,7 +2650,6 @@ Cache::lookup(Continuation *cont, CacheURL *url, CacheFragType type)
   const char *hostname = url->host_get(&len);
   return lookup(cont, &md5, type, (char *) hostname, len);
 }
-#endif
 
 int
 CacheVC::removeEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
@@ -3417,7 +3410,6 @@ ink_cache_init(ModuleVersion v)
 #endif
 }
 
-#ifdef NON_MODULAR
 //----------------------------------------------------------------------------
 Action *
 CacheProcessor::open_read(Continuation *cont, URL *url, bool cluster_cache_local, CacheHTTPHdr *request,
@@ -3483,4 +3475,3 @@ CacheProcessor::remove(Continuation *cont, URL *url, bool cluster_cache_local, C
   return caches[frag_type]->remove(cont, &md5, frag_type, true, false, const_cast<char*>(hostname), len);
 }
 
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cache/CachePages.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CachePages.cc b/iocore/cache/CachePages.cc
index e30dba0..08ef4b7 100644
--- a/iocore/cache/CachePages.cc
+++ b/iocore/cache/CachePages.cc
@@ -23,7 +23,6 @@
 
 #include "P_Cache.h"
 
-#ifdef NON_MODULAR
 #include "api/ts/ts.h"
 #include "Show.h"
 #include "I_Tasks.h"
@@ -640,4 +639,3 @@ ShowCache::handleCacheScanCallback(int event, Event *e)
   }
 }
 
-#endif // NON_MODULAR

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cache/CachePagesInternal.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CachePagesInternal.cc b/iocore/cache/CachePagesInternal.cc
index 16e822d..adde166 100644
--- a/iocore/cache/CachePagesInternal.cc
+++ b/iocore/cache/CachePagesInternal.cc
@@ -23,7 +23,6 @@
 
 #include "P_Cache.h"
 
-#ifdef NON_MODULAR
 #include "Show.h"
 #include "I_Tasks.h"
 
@@ -339,6 +338,3 @@ ShowCacheInternal::showSegSegment(int event, Event * e)
   return EVENT_CONT;
 }
 
-
-
-#endif // NON_MODULAR

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cluster/ClusterAPI.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterAPI.cc b/iocore/cluster/ClusterAPI.cc
index fab80dc..3600022 100644
--- a/iocore/cluster/ClusterAPI.cc
+++ b/iocore/cluster/ClusterAPI.cc
@@ -30,7 +30,6 @@
 ****************************************************************************/
 #include "P_Cluster.h"
 
-#ifdef NON_MODULAR
 #include "InkAPIInternal.h"
 
 class ClusterAPIPeriodicSM;
@@ -278,11 +277,6 @@ void
 clusterAPI_init()
 {
   MachineStatusSM *mssmp = 0;
-  // XXX: BIG RED WARNING!!! Direct null pointer dereference
-  //      Either create MachineStatusSM before ose or axe this function.
-  //      It is used only if NON_MODULAR is defined making that
-  //      flag crashing ClusterProcessor::init()
-  //
   ink_atomiclist_init(&status_callout_atomic_q,
                       "cluster API status_callout_q", (char *) &mssmp->link.next - (char *) mssmp);
   ClusterAPI_mutex = new_ProxyMutex();
@@ -580,7 +574,6 @@ TSSendClusterRPC(TSNodeHandle_t * nh, TSClusterRPCMsg_t * msg)
 
   return 0;
 }
-#endif /* NON_MODULAR */
 
 /*
  *  End of ClusterAPI.cc

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cluster/ClusterHandlerBase.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc
index 520e3a3..6022b9f 100644
--- a/iocore/cluster/ClusterHandlerBase.cc
+++ b/iocore/cluster/ClusterHandlerBase.cc
@@ -754,9 +754,7 @@ ClusterHandler::machine_down()
 #else
   Note("machine down %u.%u.%u.%u:%d", DOT_SEPARATED(ip), id);
 #endif
-#ifdef NON_MODULAR
   machine_offline_APIcallout(ip);
-#endif
   snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port);
   REC_SignalManager(REC_SIGNAL_MACHINE_DOWN, textbuf);
   if (net_vc) {
@@ -1145,9 +1143,8 @@ failed:
         }
 
         this->needByteSwap = !clusteringVersion.NativeByteOrder();
-#ifdef NON_MODULAR
         machine_online_APIcallout(ip);
-#endif
+
         // Signal the manager
         snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port);
         REC_SignalManager(REC_SIGNAL_MACHINE_UP, textbuf);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cluster/ClusterProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/cluster/ClusterProcessor.cc b/iocore/cluster/ClusterProcessor.cc
index b01e0ff..a16381a 100644
--- a/iocore/cluster/ClusterProcessor.cc
+++ b/iocore/cluster/ClusterProcessor.cc
@@ -699,10 +699,8 @@ ClusterProcessor::init()
   REC_ReadConfigInteger(cluster_type, "proxy.local.cluster.type");
 
   create_this_cluster_machine();
-#ifdef NON_MODULAR
   // Cluster API Initializations
   clusterAPI_init();
-#endif
   // Start global Cluster periodic event
   PeriodicClusterEvent = NEW(new GlobalClusterPeriodicEvent);
   PeriodicClusterEvent->init();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cluster/P_ClusterCache.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterCache.h b/iocore/cluster/P_ClusterCache.h
index 10fc46a..5d6b0b9 100644
--- a/iocore/cluster/P_ClusterCache.h
+++ b/iocore/cluster/P_ClusterCache.h
@@ -828,7 +828,6 @@ ClusterFunctionDescriptor clusterFunction[]
    /*********************************************
     * RESERVED for Cluster RPC API use		*
     *********************************************/
-#ifdef NON_MODULAR
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
@@ -859,7 +858,6 @@ ClusterFunctionDescriptor clusterFunction[]
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0},
   {true, false, CMSG_LOW_PRI, default_api_ClusterFunction, 0}
-#endif
   // ********** ADD NEW ENTRIES ABOVE THIS LINE ************
 }
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/cluster/P_ClusterInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cluster/P_ClusterInternal.h b/iocore/cluster/P_ClusterInternal.h
index b7dd616..679461d 100644
--- a/iocore/cluster/P_ClusterInternal.h
+++ b/iocore/cluster/P_ClusterInternal.h
@@ -514,10 +514,8 @@ extern int cluster_port;
 int machine_config_change(const char *, RecDataT, RecData, void *);
 extern void do_machine_config_change(void *, const char *);
 
-#ifdef NON_MODULAR
 // Cluster API support functions
 extern void clusterAPI_init();
 extern void machine_online_APIcallout(int);
 extern void machine_offline_APIcallout(int);
-#endif
 #endif /* _ClusterInternal_h */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index e0fe928..d2c5e76 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -25,12 +25,7 @@
 
 #include "P_HostDB.h"
 #include "I_Layout.h"
-
-#ifndef NON_MODULAR
-//char system_config_directory[512] = "etc/trafficserver";
-#else
 #include "Show.h"
-#endif
 
 // dxu: turn off all Diags.h 's function.
 //#define Debug
@@ -69,9 +64,7 @@ ClassAllocator<HostDBContinuation> hostDBContAllocator("hostDBContAllocator");
 
 HostDBCache hostDB;
 
-#ifdef NON_MODULAR
 static  Queue <HostDBContinuation > remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
-#endif
 
 char *
 HostDBInfo::srvname(HostDBRoundRobin *rr)
@@ -165,10 +158,8 @@ string_for(HostDBMark mark) {
 //
 // Function Prototypes
 //
-#ifdef NON_MODULAR
 static Action *
 register_ShowHostDB(Continuation * c, HTTPHdr * h);
-#endif
 
 void
 HostDBMD5::refresh() {
@@ -456,16 +447,12 @@ HostDBProcessor::start(int, size_t)
   if (hostDB.start(0) < 0)
     return -1;
 
-#ifdef NON_MODULAR
   if (auto_clear_hostdb_flag)
     hostDB.clear();
-#endif
 
   HOSTDB_SET_DYN_COUNT(hostdb_total_entries_stat, hostDB.totalelements);
 
-#ifdef NON_MODULAR
   statPagesManager.register_http("hostdb", register_ShowHostDB);
-#endif
 
   //
   // Register configuration callback, and establish configuation links
@@ -673,9 +660,7 @@ probe(ProxyMutex *mutex, HostDBMD5 const& md5, bool ignore_timeout)
       // -or-
       // we are beyond our TTL but we choose to serve for another N seconds [hostdb_serve_stale_but_revalidate seconds]
       if ((!ignore_timeout && r->is_ip_stale()
-#ifdef NON_MODULAR
            && !cluster_machine_at_depth(master_hash(md5.hash))
-#endif
            && !r->reverse_dns) || (r->is_ip_timeout() && r->serve_stale_but_revalidate())) {
         Debug("hostdb", "stale %u %u %u, using it and refreshing it", r->ip_interval(),
               r->ip_timestamp, r->ip_timeout_interval);
@@ -1332,10 +1317,8 @@ HostDBContinuation::lookup_done(IpAddr const& ip, char const* aname, bool around
       }
     }
   }
-#ifdef NON_MODULAR
   if (from_cont)
     do_put_response(from, i, from_cont);
-#endif
   ink_assert(!i->round_robin || !i->reverse_dns);
   return i;
 }
@@ -1610,13 +1593,11 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
     ink_assert(!r || !r->round_robin || !r->reverse_dns);
     ink_assert(failed || !r->round_robin || r->app.rr.offset);
 
-#ifdef NON_MODULAR
     // if we are not the owner, put on the owner
     //
     ClusterMachine *m = cluster_machine_at_depth(master_hash(md5.hash));
     if (m)
       do_put_response(m, r, NULL);
-#endif
 
     // try to callback the user
     //
@@ -1650,7 +1631,6 @@ HostDBContinuation::dnsEvent(int event, HostEnt * e)
 }
 
 
-#ifdef NON_MODULAR
 //
 // HostDB Get Message
 // Used to lookup host information on a remote node in the cluster
@@ -1802,7 +1782,6 @@ HostDBContinuation::do_put_response(ClusterMachine * m, HostDBInfo * r, Continua
   clusterProcessor.invoke_remote(m->pop_ClusterHandler(), PUT_HOSTINFO_CLUSTER_FUNCTION, (char *) &msg, len);
 
 }
-#endif // NON_MODULAR
 
 
 //
@@ -1828,10 +1807,8 @@ HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
   if (!hostdb_enable || (!*md5.host_name && !md5.ip.isValid())) {
     if (action.continuation)
       action.continuation->handleEvent(EVENT_HOST_DB_LOOKUP, NULL);
-#ifdef NON_MODULAR
     if (from)
       do_put_response(from, 0, from_cont);
-#endif
     hostdb_cont_free(this);
     return EVENT_DONE;
   }
@@ -1845,7 +1822,6 @@ HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
     if (r)
       HOSTDB_INCREMENT_DYN_STAT(hostdb_total_hits_stat);
 
-#ifdef NON_MODULAR
     if (action.continuation && r)
       reply_to_cont(action.continuation, r);
 
@@ -1853,7 +1829,6 @@ HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
     //
     if (from)
       do_put_response(from, r, from_cont);
-#endif
 
     // If it suceeds or it was a remote probe, we are done
     //
@@ -1861,12 +1836,10 @@ HostDBContinuation::probeEvent(int /* event ATS_UNUSED */, Event * e)
       hostdb_cont_free(this);
       return EVENT_DONE;
     }
-#ifdef NON_MODULAR
     // If it failed, do a remote probe
     //
     if (do_get_response(e))
       return EVENT_CONT;
-#endif
   }
   // If there are no remote nodes to probe, do a DNS lookup
   //
@@ -1959,8 +1932,6 @@ HostDBContinuation::do_dns()
   }
 }
 
-#ifdef NON_MODULAR
-
 
 //
 // Handle the response (put message)
@@ -2151,7 +2122,6 @@ put_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
   c->from = ch->machine;
   dnsProcessor.thread->schedule_imm(c);
 }
-#endif // NON_MODULAR
 
 
 //
@@ -2248,15 +2218,12 @@ HostDBInfo::heap_offset_ptr()
 }
 
 
-#ifdef NON_MODULAR
 ClusterMachine *
 HostDBContinuation::master_machine(ClusterConfiguration * cc)
 {
   return cc->machine_hash((int) (md5.hash[1] >> 32));
 }
-#endif // NON_MODULAR
 
-#ifdef NON_MODULAR
 struct ShowHostDB;
 typedef int (ShowHostDB::*ShowHostDBEventHandler) (int event, Event * data);
 struct ShowHostDB: public ShowCont
@@ -2401,7 +2368,6 @@ register_ShowHostDB(Continuation * c, HTTPHdr * h)
   this_ethread()->schedule_imm(s);
   return &s->action;
 }
-#endif // NON_MODULAR
 
 
 #define HOSTDB_TEST_MAX_OUTSTANDING 100

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index b153d75..629f87c 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -30,13 +30,7 @@
 
 #include "libts.h"
 #include "I_Layout.h"
-#ifdef NON_MODULAR
 #include "P_HostDB.h"
-#else
-//extern const char *system_config_directory;
-extern int hostdb_sync_frequency;
-#endif
-
 #include "P_MultiCache.h"
 #include "P_EventSystem.h"      // FIXME: need to have this in I_* header files.
 #include "ink_file.h"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/net/I_Socks.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Socks.h b/iocore/net/I_Socks.h
index a8aac85..4dd206e 100644
--- a/iocore/net/I_Socks.h
+++ b/iocore/net/I_Socks.h
@@ -24,13 +24,12 @@
 #ifndef __I_SOCKS_H__
 #define __I_SOCKS_H__
 
-#ifdef NON_MODULAR
 /*When this is being compiled with TS, we enable more features the use
   non modularized stuff. namely:
   ip_ranges and multiple socks server support.
 */
 #define SOCKS_WITH_TS
-#endif
+
 
 #define SOCKS_DEFAULT_VERSION 0 //defined the configuration variable
 #define SOCKS4_VERSION  4

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/net/UnixNetPages.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetPages.cc b/iocore/net/UnixNetPages.cc
index dfcc28f..7a19c51 100644
--- a/iocore/net/UnixNetPages.cc
+++ b/iocore/net/UnixNetPages.cc
@@ -22,9 +22,6 @@
  */
 
 #include "libts.h"
-
-#ifdef NON_MODULAR
-
 #include "P_Net.h"
 #include "Show.h"
 #include "I_Tasks.h"
@@ -250,4 +247,3 @@ register_ShowNet(Continuation * c, HTTPHdr * h)
   return &s->action;
 }
 
-#endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/iocore/net/UnixNetProcessor.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index b3b121c..eaae439 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -24,9 +24,7 @@
 #include "P_Net.h"
 
 // For Stat Pages
-#ifdef NON_MODULAR
 #include "StatPages.h"
-#endif
 
 NetProcessor::AcceptOptions const NetProcessor::DEFAULT_ACCEPT_OPTIONS;
 
@@ -439,11 +437,9 @@ UnixNetProcessor::start(int, size_t)
 /*
  * Stat pages
  */
-#ifdef NON_MODULAR
   extern Action *register_ShowNet(Continuation * c, HTTPHdr * h);
   if (etype == ET_NET)
     statPagesManager.register_http("net", register_ShowNet);
-#endif
   return 1;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5140b18d/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 3a31c9f..e158a2d 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -94,7 +94,6 @@
 
 # define FIXME_NONMODULAR               1
 # define SPLIT_DNS                      1
-# define NON_MODULAR                    1
 # define HTTP_CACHE                     1
 
 /* Defaults for user / group */


[34/50] git commit: update regex remap docs

Posted by zw...@apache.org.
update regex remap docs


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

Branch: refs/heads/5.0.x
Commit: 49111ee87aba994548cf06be7d4255719cefb2f7
Parents: a2c2ded
Author: James Peach <jp...@apache.org>
Authored: Wed Dec 4 20:16:55 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 09:05:31 2013 -0800

----------------------------------------------------------------------
 doc/reference/plugins/regex_remap.en.rst | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/49111ee8/doc/reference/plugins/regex_remap.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/plugins/regex_remap.en.rst b/doc/reference/plugins/regex_remap.en.rst
index a98107b..0b8bb70 100644
--- a/doc/reference/plugins/regex_remap.en.rst
+++ b/doc/reference/plugins/regex_remap.en.rst
@@ -27,12 +27,15 @@ To use this plugin, configure a remap.config rule like ::
 
     map http://a.com http://b.com @plugin=regex_remap.so @pparam=maps.reg
 
-The parameter with the file name is always required, and the regular
-expressions within are evaluated sequentially from the first to the
-last. When a regular expression is positively matched against a request
-URL, evaluation is stopped and the rewrite rule is applied. If none of
-the regular expressions are a match, the default destination URL is
-applied (``http://b.com`` in the example above).
+The file name parameter is always required. Unless an absolute path
+is specified, the file name is assumed to be a path relative to the
+Traffic Server configuration directory.
+
+The regular expressions listed in the configuration file are evaluated
+sequentially. When a regular expression is positively matched against
+a request URL, evaluation is stopped and the rewrite rule is applied.
+If none of the regular expressions are a match, the default destination
+URL is applied (``http://b.com`` in the example above).
 
 An optional argument (``@pparam``) with the string "``profile``\ " will
 enable profiling of this regex remap rule, e.g. ::
@@ -66,7 +69,6 @@ like ::
 
     GET/path?query=bar
 
-
 The methods are always all upper-case, and always followed by one single
 space. There is no space between the method and the rest of the URL (or
 URI path).
@@ -81,11 +83,6 @@ the option 'matrix-parameters', e.g. ::
 
     ... @pparam=maps.reg @pparam=matrix-parameters
 
-The config file (``maps.reg`` above) can be placed anywhere, but unless
-you specify an absolute path (as above), it will default to ::
-
-    /usr/local/etc/regex_remap
-
 A typical regex would look like ::
 
     ^/(ogre.*)/more     http://www.ogre.com/$h/$0/$1
@@ -110,6 +107,12 @@ on the right hand side during evaluation ::
     $c     - The cookie string from the request
     $i     - The client IP for this request
 
+.. note::
+
+    The ``$0`` substitution expands to the characters that were
+    matched by the regular expression, not to the entire string that
+    the regular expression was matched against.
+
 You can also provide options, similar to how you configure your
 remap.config. The following options are available ::
 


[19/50] git commit: TS-2419: Don't close client connection when responding with a 204 and there is no body

Posted by zw...@apache.org.
TS-2419: Don't close client connection when responding with a 204 and there is no body


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

Branch: refs/heads/5.0.x
Commit: 1bcff7873b5cd701d90a00191d6646210ab9e7c3
Parents: a10b809
Author: Bryan Call <bc...@apache.org>
Authored: Fri Dec 6 16:57:46 2013 -0800
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Dec 6 16:57:46 2013 -0800

----------------------------------------------------------------------
 proxy/http/HttpTransact.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1bcff787/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 991e1bf..a7a14a2 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -6756,9 +6756,10 @@ HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, HTTP
   } else if (HTTP_MAJOR(ver.m_version) == 0) {  /* No K-A for 0.9 apps */
     ka_action = KA_DISABLED;
   }
-  // some systems hang until the connection closes when receiving a 204
-  //   regardless of the K-A headers
-  else if (heads->status_get() == HTTP_STATUS_NO_CONTENT) {
+  else if (heads->status_get() == HTTP_STATUS_NO_CONTENT &&
+      (s->current.server->transfer_encoding != NO_TRANSFER_ENCODING || s->hdr_info.request_content_length != 0)) {
+    // some systems hang until the connection closes when receiving a 204 regardless of the K-A headers
+    // close if there is any body response from the origin
     ka_action = KA_CLOSE;
   } else {
     // Determine if we are going to send either a server-generated or


[24/50] git commit: add TS-2082

Posted by zw...@apache.org.
add TS-2082


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

Branch: refs/heads/5.0.x
Commit: db8052d5760fb1882057561b8e4250b6939235df
Parents: 5140b18
Author: Zhao Yongming <mi...@gmail.com>
Authored: Sat Dec 7 14:57:00 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 14:57:00 2013 +0800

----------------------------------------------------------------------
 CHANGES | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/db8052d5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index eca1bad..6745047 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2082] remove STANDALONE_IOCORE and NON_MODULAR defines
+
   *) [TS-312] Add option to always share keep-alive connections to the origin server
 
   *) [TS-2419] Don't close client connection when responding with a 204 and there is no body
@@ -96,8 +98,6 @@ Changes with Apache Traffic Server 4.2.0
   *) [TS-2303] Incorrect docs for negative_caching_enabled.
     Author: Thomas Jackson <ja...@gmail.com>
 
-  *) [TS-2082] fix build with --enable-standalone-iocore.
-
   *) [TS-2712] Explicitly use subdir-objects in automake init.
 
   *) [TS-2309] Allow mod_generator plugin for lighttpd to accept "SI" postfixes.


[44/50] git commit: doc: link hostdb proposal

Posted by zw...@apache.org.
doc: link hostdb proposal


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

Branch: refs/heads/5.0.x
Commit: 610052660e2a75014b7fafcc794cf723d966d5f0
Parents: ab57e59
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 12:32:16 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 12:32:16 2013 -0800

----------------------------------------------------------------------
 doc/arch/index.en.rst | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/61005266/doc/arch/index.en.rst
----------------------------------------------------------------------
diff --git a/doc/arch/index.en.rst b/doc/arch/index.en.rst
index 5f21f8b..51f5b83 100644
--- a/doc/arch/index.en.rst
+++ b/doc/arch/index.en.rst
@@ -31,3 +31,4 @@ Contents:
    :maxdepth: 2
 
    cache/cache.en
+   proposals/hostdb.en


[10/50] git commit: TS-2401: update CHANGES

Posted by zw...@apache.org.
TS-2401: update CHANGES


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

Branch: refs/heads/5.0.x
Commit: a514c64a35bebdd29237e73c6844604b77cd9a95
Parents: ccc01b6
Author: James Peach <jp...@apache.org>
Authored: Thu Dec 5 20:33:20 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:34:10 2013 -0800

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a514c64a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 03a04c6..309edcf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-2401] Use Layout instead of global install path directories.
+
   *) [TS-2420] Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule those
    continuations in ET_TASK
 


[49/50] git commit: Merge branch 'master' into 5.0.x

Posted by zw...@apache.org.
Merge branch 'master' into 5.0.x

Conflicts:
	CHANGES
	iocore/cache/CacheRead.cc


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

Branch: refs/heads/5.0.x
Commit: d6a7a9c4efeb0f85509b633a14acd896dc8eb3e4
Parents: c63666b 3388fd8
Author: Leif Hedstrom <zw...@apache.org>
Authored: Sat Dec 14 14:44:55 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Sat Dec 14 14:44:55 2013 -0700

----------------------------------------------------------------------
 .gitattributes                                  |    1 -
 CHANGES                                         |   70 +
 Makefile.am                                     |    6 +-
 build/crypto.m4                                 |   48 +
 ci/jenkins/git-jenkins-setup.sh                 |   55 +
 ci/jenkins/git-jenkins-update.sh                |   44 +
 ci/jenkins/jobs.yaml                            |    8 +-
 ci/jenkins/records.config                       |    3 -
 ci/regression                                   |    1 +
 cmd/traffic_cop/traffic_cop.cc                  |   18 +-
 cmd/traffic_top/stats.h                         |    4 +-
 configure.ac                                    |   72 +-
 doc/Makefile.am                                 |   19 +-
 doc/admin/event-logging-formats.en.rst          |    3 +
 doc/admin/faqs.en.rst                           |    2 +-
 doc/admin/index.en.rst                          |    8 +
 doc/admin/performance-tuning.en.rst             |   54 +
 doc/arch/cache/cache-appendix.en.rst            |    6 +-
 doc/arch/cache/tier-storage.en.rst              |    2 +-
 doc/arch/index.en.rst                           |    1 +
 doc/conf.py                                     |   44 +-
 doc/reference/api/TSUrlCreate.en.rst            |  144 +-
 doc/reference/api/TSUrlHostGet.en.rst           |   79 +
 doc/reference/api/TSUrlHostSet.en.rst           |   74 +
 doc/reference/api/TSUrlPercentEncode.en.rst     |   67 +
 doc/reference/api/TSUrlStringGet.en.rst         |   67 +
 doc/reference/api/index.en.rst                  |    4 +
 doc/reference/commands/traffic_server.en.rst    |    2 -
 .../configuration/records.config.en.rst         |  108 +-
 doc/reference/configuration/remap.config.en.rst |   53 +-
 .../configuration/ssl_multicert.config.en.rst   |   57 +-
 .../configuration/storage.config.en.rst         |    5 +
 doc/reference/plugins/balancer.en.rst           |   18 +-
 doc/reference/plugins/cacheurl.en.rst           |   30 +-
 doc/reference/plugins/index.en.rst              |    6 +-
 doc/reference/plugins/regex_remap.en.rst        |   27 +-
 doc/reference/plugins/ts_lua.en.rst             |  584 ++++
 doc/reference/plugins/xdebug.en.rst             |   45 +
 doc/sdk/http-hooks-and-transactions.en.rst      |   85 +-
 .../adding-hooks.en.rst                         |   14 +-
 ...e-buffered-null-transformation-plugin.en.rst |   10 +-
 .../unable-to-debug-tags.en.rst                 |    4 +-
 example/app-template/app-template.cc            |   19 +-
 iocore/Makefile.am                              |    7 +-
 iocore/aio/AIO.cc                               |    2 +-
 iocore/aio/Makefile.am                          |    1 -
 iocore/cache/Cache.cc                           |   73 +-
 iocore/cache/CacheHosting.cc                    |   42 +-
 iocore/cache/CacheHttp.cc                       |   16 +-
 iocore/cache/CachePages.cc                      |    2 -
 iocore/cache/CachePagesInternal.cc              |    4 -
 iocore/cache/CacheRead.cc                       |   21 +-
 iocore/cache/CacheWrite.cc                      |    4 +
 iocore/cache/I_CacheDefs.h                      |    2 +-
 iocore/cache/Makefile.am                        |   12 -
 iocore/cache/Notes                              |    3 -
 iocore/cache/P_CacheHosting.h                   |    5 +-
 iocore/cache/P_CacheInternal.h                  |   12 +-
 iocore/cache/Store.cc                           |   12 +-
 iocore/cluster/ClusterAPI.cc                    |    7 -
 iocore/cluster/ClusterHandlerBase.cc            |    5 +-
 iocore/cluster/ClusterMachine.cc                |   12 +-
 iocore/cluster/ClusterProcessor.cc              |    2 -
 iocore/cluster/Makefile.am                      |    2 -
 iocore/cluster/P_ClusterCache.h                 |    2 -
 iocore/cluster/P_ClusterInternal.h              |    2 -
 iocore/dns/DNS.cc                               |    1 -
 iocore/dns/Makefile.am                          |    9 -
 iocore/dns/P_DNSProcessor.h                     |   26 +
 iocore/dns/P_SplitDNSProcessor.h                |   27 -
 iocore/eventsystem/Makefile.am                  |    1 -
 iocore/hostdb/HostDB.cc                         |   65 +-
 iocore/hostdb/Makefile.am                       |   10 -
 iocore/hostdb/MultiCache.cc                     |   11 +-
 iocore/net/I_Socks.h                            |    3 +-
 iocore/net/Makefile.am                          |   10 +-
 iocore/net/P_NetAccept.h                        |    2 +-
 iocore/net/P_SSLConfig.h                        |    3 +
 iocore/net/P_SSLUtils.h                         |    3 +
 iocore/net/SSLCertLookup.cc                     |    2 +-
 iocore/net/SSLConfig.cc                         |   24 +
 iocore/net/SSLNetVConnection.cc                 |   29 +-
 iocore/net/SSLUtils.cc                          |  254 +-
 iocore/net/Socks.cc                             |    2 +-
 iocore/net/UnixNetAccept.cc                     |    4 +-
 iocore/net/UnixNetPages.cc                      |    4 -
 iocore/net/UnixNetProcessor.cc                  |   13 +-
 iocore/net/test_certlookup.cc                   |    9 +
 iocore/utils/Makefile.am                        |    2 -
 lib/perl/lib/Apache/TS/AdminClient.pm           |    2 -
 lib/records/I_RecCore.h                         |   17 +
 lib/records/I_RecDefs.h                         |    7 -
 lib/records/I_RecProcess.h                      |    2 +-
 lib/records/P_RecCore.h                         |    2 -
 lib/records/RecConfigParse.cc                   |    1 +
 lib/records/RecCore.cc                          |   87 +-
 lib/records/RecDebug.cc                         |   15 +
 lib/records/RecMessage.cc                       |    6 +-
 lib/records/RecProcess.cc                       |   73 +-
 lib/ts/EventNotify.cc                           |    3 +-
 lib/ts/ink_config.h.in                          |   11 +-
 lib/ts/ink_resource.h                           |    2 +-
 mgmt/FileManager.cc                             |   92 +-
 mgmt/FileManager.h                              |    1 -
 mgmt/LocalManager.cc                            |   23 +-
 mgmt/LocalManager.h                             |    4 +-
 mgmt/Main.cc                                    |   49 +-
 mgmt/Main.h                                     |    1 -
 mgmt/ProcessManager.cc                          |    6 +-
 mgmt/ProcessManager.h                           |    2 +-
 mgmt/RecordsConfig.cc                           |   17 +-
 mgmt/Rollback.cc                                |   34 +-
 mgmt/Rollback.h                                 |    1 -
 mgmt/cluster/VMap.cc                            |   13 +-
 mgmt/web2/WebIntrMain.cc                        |    9 +-
 plugins/cacheurl/cacheurl.c                     |   38 +-
 plugins/experimental/Makefile.am                |   22 +-
 .../experimental/buffer_upload/buffer_upload.cc |   33 +-
 plugins/experimental/ts_lua/Makefile.am         |   35 +
 plugins/experimental/ts_lua/README.md           |  546 ++++
 .../experimental/ts_lua/business/mediaslice.lua |  155 +
 .../experimental/ts_lua/business/sethost.lua    |   41 +
 plugins/experimental/ts_lua/example/hdr.lua     |   37 +
 .../ts_lua/example/test_cache_lookup.lua        |   44 +
 .../ts_lua/example/test_client_socket.lua       |   40 +
 .../ts_lua/example/test_creq_method.lua         |   40 +
 .../ts_lua/example/test_creq_uri.lua            |   40 +
 .../ts_lua/example/test_creq_uri_args.lua       |   36 +
 .../ts_lua/example/test_intercept.lua           |   42 +
 .../experimental/ts_lua/example/test_post.lua   |   48 +
 .../ts_lua/example/test_ret_403.lua             |   38 +
 .../ts_lua/example/test_server_intercept.lua    |   41 +
 .../ts_lua/example/test_transform.lua           |   49 +
 plugins/experimental/ts_lua/ts_lua.c            |  148 +
 plugins/experimental/ts_lua/ts_lua_atomic.c     |   98 +
 plugins/experimental/ts_lua/ts_lua_atomic.h     |   30 +
 .../ts_lua/ts_lua_cached_response.c             |   88 +
 .../ts_lua/ts_lua_cached_response.h             |   28 +
 .../experimental/ts_lua/ts_lua_client_request.c |  514 +++
 .../experimental/ts_lua/ts_lua_client_request.h |   28 +
 .../ts_lua/ts_lua_client_response.c             |  198 ++
 .../ts_lua/ts_lua_client_response.h             |   28 +
 plugins/experimental/ts_lua/ts_lua_common.h     |  134 +
 plugins/experimental/ts_lua/ts_lua_context.c    |   94 +
 plugins/experimental/ts_lua/ts_lua_context.h    |   29 +
 plugins/experimental/ts_lua/ts_lua_hook.c       |  143 +
 plugins/experimental/ts_lua/ts_lua_hook.h       |   28 +
 plugins/experimental/ts_lua/ts_lua_http.c       |  227 ++
 plugins/experimental/ts_lua/ts_lua_http.h       |   28 +
 .../experimental/ts_lua/ts_lua_http_intercept.c |  299 ++
 .../experimental/ts_lua/ts_lua_http_intercept.h |   28 +
 plugins/experimental/ts_lua/ts_lua_log.c        |  117 +
 plugins/experimental/ts_lua/ts_lua_log.h        |   27 +
 plugins/experimental/ts_lua/ts_lua_misc.c       |   91 +
 plugins/experimental/ts_lua/ts_lua_misc.h       |   28 +
 .../experimental/ts_lua/ts_lua_server_request.c |  207 ++
 .../experimental/ts_lua/ts_lua_server_request.h |   28 +
 .../ts_lua/ts_lua_server_response.c             |  194 ++
 .../ts_lua/ts_lua_server_response.h             |   28 +
 plugins/experimental/ts_lua/ts_lua_transform.c  |  173 +
 plugins/experimental/ts_lua/ts_lua_transform.h  |   28 +
 plugins/experimental/ts_lua/ts_lua_util.c       |  451 +++
 plugins/experimental/ts_lua/ts_lua_util.h       |   45 +
 plugins/experimental/xdebug/Makefile.am         |   22 +
 plugins/experimental/xdebug/xdebug.cc           |  217 ++
 plugins/header_rewrite/conditions.cc            |    4 -
 plugins/header_rewrite/operators.cc             |    2 +-
 proxy/ControlMatcher.cc                         |   13 +-
 proxy/ControlMatcher.h                          |    5 +-
 proxy/ICPConfig.cc                              |   13 +-
 proxy/IPAllow.cc                                |   13 +-
 proxy/IPAllow.h                                 |    1 -
 proxy/Initialize.cc                             |  273 --
 proxy/Initialize.h                              |   57 -
 proxy/InkAPI.cc                                 |    7 +-
 proxy/InkAPITest.cc                             |    5 +-
 proxy/InkXml.cc                                 |  485 ---
 proxy/InkXml.h                                  |  231 --
 proxy/Main.cc                                   |  130 +-
 proxy/Main.h                                    |    5 +-
 proxy/Makefile.am                               |   48 +-
 proxy/MuxVC.cc                                  | 3063 ------------------
 proxy/MuxVC.h                                   |  382 ---
 proxy/Plugin.cc                                 |   32 +-
 proxy/Plugin.h                                  |    3 +-
 proxy/Prefetch.cc                               |   17 +-
 proxy/ReverseProxy.cc                           |   22 +-
 proxy/StatSystem.cc                             |   20 +-
 proxy/Update.cc                                 |   10 +-
 proxy/config/records.config.default.in          |    3 -
 proxy/hdrs/HTTP.cc                              |   17 +-
 proxy/hdrs/HTTP.h                               |   47 +-
 proxy/http/HttpBodyFactory.cc                   |   27 +-
 proxy/http/HttpBodyFactory.h                    |    1 -
 proxy/http/HttpConfig.cc                        |    5 +-
 proxy/http/HttpConfig.h                         |    5 +-
 proxy/http/HttpSM.cc                            |  104 +-
 proxy/http/HttpTransact.cc                      |   93 +-
 proxy/http/remap/UrlRewrite.cc                  |    3 +-
 proxy/logcat.cc                                 |    1 -
 proxy/logging/LogBuffer.h                       |   19 +-
 proxy/logging/LogConfig.cc                      |   60 +-
 proxy/logging/LogStandalone.cc                  |   34 +-
 proxy/sac.cc                                    |   23 +-
 proxy/shared/DiagsConfig.cc                     |   48 +-
 proxy/shared/DiagsConfig.h                      |   13 +-
 proxy/shared/Error.cc                           |    2 +-
 proxy/shared/InkXml.cc                          |  485 +++
 proxy/shared/InkXml.h                           |  231 ++
 proxy/shared/Makefile.am                        |   17 +-
 proxy/shared/UglyLogStubs.cc                    |    1 +
 proxy/shared/signals.cc                         |  414 +++
 proxy/shared/signals.h                          |   53 +
 proxy/signals.cc                                |  414 ---
 proxy/signals.h                                 |   53 -
 tools/http_load/http_load.c                     |    2 +-
 216 files changed, 8974 insertions(+), 6408 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/CHANGES
----------------------------------------------------------------------
diff --cc CHANGES
index 0882bf2,8a92590..f9672d9
--- a/CHANGES
+++ b/CHANGES
@@@ -1,9 -1,70 +1,73 @@@
                                                           -*- coding: utf-8 -*-
 -Changes with Apache Traffic Server 4.2.0
 +Changes with Apache Traffic Server 5.0.0
 +
 +  *) [TS-1919] Eliminate CacheLookupHttpConfig. This breaks cluster
 +   compatibility, so all cluster nodes should be upgraded simultaneously.
  
+ 
+   *) [TS-2251] Simplify LogBuffer reference counting.
+ 
+   *) [TS-2190] Remove cache.log from the cachurl plugin.
+ 
+   *) [TS-2426] Add a new plugin, xdebug, for cache debugging using HTTP headers.
+ 
+   *) [TS-2077] Remove pipeline configurations, they were no-op's anyways. We
+    still support pipelining (we always do), it's just not treated specially
+    (or optimized).
+ 
+   *) [TS-2386] clean up unused files and codes -- round 4.2
+ 
+   *) [TS-548] remove Initialize.cc Initialize.h
+ 
+   *) [TS-2082] remove STANDALONE_IOCORE FIXME_NONMODULAR and NON_MODULAR defines
+ 
+   *) [TS-312] Add option to always share keep-alive connections to the origin server
+ 
+   *) [TS-2419] Don't close client connection when responding with a 204 and there is no body
+ 
+   *) [TS-1146] Add RFC 5077 TLS session ticket support.
+    Author: Wei Sun <su...@yahoo-inc.com>
+ 
+   *) [TS-2401] Use Layout instead of global install path directories.
+ 
+   *) [TS-2420] Remove STAT_SYNC, CONF_SYNC, and REM_SYNC threads and schedule those
+    continuations in ET_TASK
+ 
+   *) [TS-2372] Enable TLS perfect forward security with ECDHE.
+ 
+   *) [TS-2416] Make TLS the session timeout threshold configurable.
+    Author: Wei Sun <su...@yahoo-inc.com>
+ 
+   *) [TS-2335] adding ts_lua plugin to experimental directory
+ 
+   *) [TS-2347] buffer_upload uses unsafe function tempnam(). Replace it
+    with mkstemp()
+ 
+   *) [TS-1815] Add thread number and port to accept thread name and
+    add the file descriptor number to the ET_AIO thread names
+ 
+   *) [TS-2415] Use standard continuations to release UrlRewrite objects.
+ 
+   *) [TS-2413] Release memory for idle SSL connections.
+    Author: Wei Sun <su...@yahoo-inc.com>
+ 
+   *) [TS-2365] Configure the maximum TLS record size.
+    Author: Wei Sun <su...@yahoo-inc.com>
+ 
+   *) [TS-2351] Bandaid fix for Range request crash related to
+    Read-While-Writer and content length calculations.
+ 
+   *) [TS-2408] Fix double free of proxy.config.admin.user_id.
+ 
+   *) [TS-2396] UrlRewrite.cc does not free the queue correctly.
+    Author: Yu Qing <zh...@taobao.com>
+ 
+   *) [TS-2382] Partial fix for make install creating man files as root.
+ 
+   *) [TS-2381] Reorganize TSUrlCreate docs into separate files.
+ 
+   *) [TS-2377] Install man pages as part of the build.
+ 
    *) [TS-2379] Add a new field: '%<chp>', "client_host_port" to LogFormat.
  
    *) [TS-2374] Abort the producer if the none of it`s consumers is alive.
@@@ -26,7 -89,7 +92,11 @@@
  
    *) [TS-2348] Rename tstop to traffic_top.
  
++<<<<<<< HEAD
 +Changes with Apache Traffic Server 4.2.0
++=======
+   *) [TS-2384] Fix regression in key-lookup code between 4.0.x and 4.1.x
++>>>>>>> master
  
    *) [TS-2340] Fix TextLogObject log rolling.
     Author: bettydramit <b1...@gmail.com>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/iocore/cache/Cache.cc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --cc iocore/cache/CacheRead.cc
index 5dda33b,5e8c6ac..e155304
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@@ -241,9 -241,8 +241,8 @@@ CacheVC::openReadChooseWriter(int /* ev
        }
        return -ECACHE_NO_DOC;
      }
- #ifdef FIXME_NONMODULAR
      if (cache_config_select_alternate) {
 -      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
 +      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, static_cast<HttpConfigParams*>(context));
        if (alternate_index < 0)
          return -ECACHE_ALT_MISS;
      } else
@@@ -967,11 -967,7 +967,8 @@@ CacheVC::openReadVecWrite(int /* event 
        dir_overwrite(&first_key, vol, &dir, &od->first_dir);
        if (od->move_resident_alt)
          dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
- #ifdef FIXME_NONMODULAR
 -      int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params);
++
 +      int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, static_cast<HttpConfigParams*>(context));
- #else
-       int alt_ndx = 0;
- #endif
        vol->close_write(this);
        if (alt_ndx >= 0) {
          vector.clear();
@@@ -1077,11 -1073,7 +1074,7 @@@ CacheVC::openReadStartHead(int event, E
          goto Ldone;
        }
        if (cache_config_select_alternate) {
- #ifdef FIXME_NONMODULAR
 -        alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
 +        alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, static_cast<HttpConfigParams*>(context));
- #else
-         alternate_index = 0;
- #endif
          if (alternate_index < 0) {
            err = ECACHE_ALT_MISS;
            goto Ldone;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/proxy/Prefetch.cc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6a7a9c4/proxy/http/HttpSM.cc
----------------------------------------------------------------------


[45/50] git commit: TS-2190: remove cache.log from the cacheurl plugin

Posted by zw...@apache.org.
TS-2190: remove cache.log from the cacheurl plugin

The information in the cacheurl plugin log is for debugging purposes,
but you can already get that from diagnostics.  Remove the log file
since it's not really useful and it's better to have fewer logfiles.


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

Branch: refs/heads/5.0.x
Commit: 1410994d448d0352f705110a6c4efc9f947825ea
Parents: 6100526
Author: James Peach <jp...@apache.org>
Authored: Tue Dec 10 21:00:39 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Dec 11 16:00:15 2013 -0800

----------------------------------------------------------------------
 CHANGES                     |  2 ++
 plugins/cacheurl/cacheurl.c | 36 ++----------------------------------
 2 files changed, 4 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1410994d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 30afc6c..22608c4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.2.0
 
 
+  *) [TS-2190] Remove cache.log from the cachurl plugin.
+
   *) [TS-2426] Add a new plugin, xdebug, for cache debugging using HTTP headers.
 
   *) [TS-2077] Remove pipeline configurations, they were no-op's anyways. We

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1410994d/plugins/cacheurl/cacheurl.c
----------------------------------------------------------------------
diff --git a/plugins/cacheurl/cacheurl.c b/plugins/cacheurl/cacheurl.c
index 1779bae..3b3e98d 100644
--- a/plugins/cacheurl/cacheurl.c
+++ b/plugins/cacheurl/cacheurl.c
@@ -57,8 +57,6 @@ typedef struct {
     //pr_list *next; /* Link to next set of patterns, if any */
 } pr_list;
 
-static TSTextLogObject log = NULL;
-
 static int regex_substitute(char **buf, char *str, regex_info *info) {
     int matchcount;
     int ovector[OVECOUNT]; /* Locations of matches in regex */
@@ -261,13 +259,7 @@ static pr_list* load_config_file(const char *config_file) {
         /* We have the pattern/replacement, now do precompilation.
          * buffer is the first part of the line. spend is the second part just
          * after the whitespace */
-        if (log) {
-            TSTextLogObjectWrite(log,
-                    "Adding pattern/replacement pair: '%s' -> '%s'",
-                    buffer, spend);
-        }
-        TSDebug(PLUGIN_NAME, "Adding pattern/replacement pair: '%s' -> '%s'\n",
-                buffer, spend);
+        TSDebug(PLUGIN_NAME, "Adding pattern/replacement pair: '%s' -> '%s'", buffer, spend);
         retval = regex_compile(&info, buffer, spend);
         if (!retval) {
             TSError("[%s] Error precompiling regex/replacement. Skipping.\n",
@@ -319,13 +311,7 @@ static int rewrite_cacheurl(pr_list *prl, TSHttpTxn txnp) {
             i++;
         }
         if (newurl) {
-            if (log) {
-                TSTextLogObjectWrite(log,
-                        "Rewriting cache URL for %s to %s", url,
-                        newurl);
-            }
-            TSDebug(PLUGIN_NAME, "Rewriting cache URL for %s to %s\n",
-                    url, newurl);
+            TSDebug(PLUGIN_NAME, "Rewriting cache URL for %s to %s", url, newurl);
             if (TSCacheUrlSet(txnp, newurl, strlen(newurl))
                     != TS_SUCCESS) {
                 TSError("[%s] Unable to modify cache url from "
@@ -391,16 +377,6 @@ TSReturnCode TSRemapInit(TSRemapInterface *api_info, char *errbuf,
         return TS_ERROR;
     }
 
-    if (!log) {
-        error = TSTextLogObjectCreate("cacheurl", TS_LOG_MODE_ADD_TIMESTAMP,
-                &log);
-        if (!log || error == TS_ERROR) {
-            snprintf(errbuf, errbuf_size - 1,
-                "[%s] Error creating log file\n", PLUGIN_NAME);
-            return TS_ERROR;
-        }
-    }
-
     TSDebug(PLUGIN_NAME, "remap plugin is successfully initialized");
     return TS_SUCCESS;
 }
@@ -453,14 +429,6 @@ void TSPluginInit(int argc, const char *argv[]) {
         return;
     }
 
-    if (!log) {
-        error = TSTextLogObjectCreate("cacheurl", TS_LOG_MODE_ADD_TIMESTAMP,
-                &log);
-        if (!log || error == TS_ERROR) {
-            TSError("[%s] Error creating log file\n", PLUGIN_NAME);
-        }
-    }
-
     prl = load_config_file(argc > 1 ? argv[1] : NULL);
 
     contp = TSContCreate((TSEventFunc)handle_hook, NULL);


[04/50] git commit: TS-2401: update records.config layout documentation

Posted by zw...@apache.org.
TS-2401: update records.config layout documentation


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

Branch: refs/heads/5.0.x
Commit: ccc01b66370d4f617b8685b6ba755188344cc215
Parents: a1162d8
Author: James Peach <jp...@apache.org>
Authored: Thu Dec 5 20:29:52 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:49 2013 -0800

----------------------------------------------------------------------
 .../configuration/records.config.en.rst         | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ccc01b66/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index 000ed19..bbe1a4d 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -166,9 +166,13 @@ System Variables
    The script executed before the :program:`traffic_manager` process spawns
    the :program:`traffic_server` process.
 
-.. ts:cv:: CONFIG proxy.config.config_dir STRING config
+.. ts:cv:: CONFIG proxy.config.config_dir STRING etc/trafficserver
 
    The directory that contains Traffic Server configuration files.
+   This is a read-only configuration option that contains the
+   ``SYSCONFDIR`` value specified at build time relative to the
+   installation prefic. THe ``$TS_ROOT`` environment variable can
+   be used alter the installation prefix at run time.
 
 .. ts:cv:: CONFIG proxy.config.alarm_email STRING
    :reloadable:
@@ -200,8 +204,10 @@ A value of ``0`` means no signal will be sent.
 
 .. ts:cv:: CONFIG proxy.config.snapshot_dir STRING snapshots
 
-   The directory in which Traffic Server stores configuration snapshots on the local system. Unless you specify an absolute path, this
-   directory is located in the Traffic Server ``config`` directory.
+   The directory in which Traffic Server stores configuration
+   snapshots on the local system. Unless you specify an absolute
+   path, this directory is located in the Traffic Server ``SYSCONFDIR``
+   directory.
 
 .. ts:cv:: CONFIG proxy.config.exec_thread.autoconfig INT 1
 
@@ -1293,9 +1299,11 @@ Customizable User Response Pages
    Enables (``1``) or disables (``0``) logging for customizable response pages. When enabled, Traffic Server records a message in
    the error log each time a customized response page is used or modified.
 
-.. ts:cv:: CONFIG proxy.config.body_factory.template_sets_dir STRING config/body_factory
+.. ts:cv:: CONFIG proxy.config.body_factory.template_sets_dir STRING etc/trafficserver/body_factory
 
-   The customizable response page default directory.
+   The customizable response page default directory. If this is a
+   relative path, Traffic Server resolves it relative to the
+   ``PREFIX`` directory.
 
 .. ts:cv:: CONFIG proxy.config.body_factory.response_suppression_mode INT 0
 
@@ -1556,10 +1564,12 @@ Logging Configuration
 
    The hostname of the machine running Traffic Server.
 
-.. ts:cv:: CONFIG proxy.config.log.logfile_dir STRING install_dir\ ``/logs``
+.. ts:cv:: CONFIG proxy.config.log.logfile_dir STRING var/log/trafficserver
    :reloadable:
 
-   The full path to the logging directory. This can be an absolute path or a path relative to the directory in which Traffic Server is installed.
+   The path to the logging directory. This can be an absolute path
+   or a path relative to the ``PREFIX`` directory in which Traffic
+   Server is installed.
 
    .. note:: The directory you specify must already exist.
 


[25/50] git commit: TS-2082: remove FIXME_NONMODULAR defines

Posted by zw...@apache.org.
TS-2082: remove FIXME_NONMODULAR defines


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

Branch: refs/heads/5.0.x
Commit: 0b3367a8e1f52cf2ac3ca8c458156f11e89bfa70
Parents: db8052d
Author: Zhao Yongming <mi...@gmail.com>
Authored: Sat Dec 7 15:11:39 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Sat Dec 7 15:19:16 2013 +0800

----------------------------------------------------------------------
 CHANGES                   |  2 +-
 iocore/cache/CacheRead.cc | 10 ----------
 iocore/cache/Notes        |  3 ---
 lib/ts/ink_config.h.in    |  1 -
 4 files changed, 1 insertion(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b3367a8/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6745047..be9c8c7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
-  *) [TS-2082] remove STANDALONE_IOCORE and NON_MODULAR defines
+  *) [TS-2082] remove STANDALONE_IOCORE FIXME_NONMODULAR and NON_MODULAR defines
 
   *) [TS-312] Add option to always share keep-alive connections to the origin server
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b3367a8/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 6121668..5e8c6ac 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -241,13 +241,11 @@ CacheVC::openReadChooseWriter(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSE
       }
       return -ECACHE_NO_DOC;
     }
-#ifdef FIXME_NONMODULAR
     if (cache_config_select_alternate) {
       alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
       if (alternate_index < 0)
         return -ECACHE_ALT_MISS;
     } else
-#endif
       alternate_index = 0;
     CacheHTTPInfo *obj = vector.get(alternate_index);
     for (w = (CacheVC *) od->writers.head; w; w = (CacheVC *) w->opendir_link.next) {
@@ -969,11 +967,7 @@ CacheVC::openReadVecWrite(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */
       dir_overwrite(&first_key, vol, &dir, &od->first_dir);
       if (od->move_resident_alt)
         dir_insert(&od->single_doc_key, vol, &od->single_doc_dir);
-#ifdef FIXME_NONMODULAR
       int alt_ndx = HttpTransactCache::SelectFromAlternates(write_vector, &request, params);
-#else
-      int alt_ndx = 0;
-#endif
       vol->close_write(this);
       if (alt_ndx >= 0) {
         vector.clear();
@@ -1079,11 +1073,7 @@ CacheVC::openReadStartHead(int event, Event * e)
         goto Ldone;
       }
       if (cache_config_select_alternate) {
-#ifdef FIXME_NONMODULAR
         alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request, params);
-#else
-        alternate_index = 0;
-#endif
         if (alternate_index < 0) {
           err = ECACHE_ALT_MISS;
           goto Ldone;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b3367a8/iocore/cache/Notes
----------------------------------------------------------------------
diff --git a/iocore/cache/Notes b/iocore/cache/Notes
index 0992d25..54d35c8 100644
--- a/iocore/cache/Notes
+++ b/iocore/cache/Notes
@@ -22,9 +22,6 @@ TS because there are a lot of stuff required for clustering in proxy/http.
 
 
 cache ifdefs
-FIXME_NONMODULAR -> this flaf needs to be turned on when compiling along 
-with the entire TS. Turning this flag on should automatically turn the 
-HTTP cache flag on.
 FIXME_HOSTDB -> Store ifdef to be turned off when HostDB stops using Store
 FIXME_MGMT   -> Interface for warnings on the manager
 FIXME_CLUSTER_ARGUMENTS -> runtime arguments for clustering etc. Needs

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b3367a8/lib/ts/ink_config.h.in
----------------------------------------------------------------------
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index e158a2d..ba6fd53 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -92,7 +92,6 @@
 # define TS_MAX_API_STATS               @max_api_stats@
 
 
-# define FIXME_NONMODULAR               1
 # define SPLIT_DNS                      1
 # define HTTP_CACHE                     1
 


[03/50] git commit: TS-2401: Remove unused global management_directory

Posted by zw...@apache.org.
TS-2401: Remove unused global management_directory


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

Branch: refs/heads/5.0.x
Commit: bb26f42affd1983370439a0337b35dc66db80879
Parents: 563c1e9
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 27 14:40:07 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Thu Dec 5 20:33:48 2013 -0800

----------------------------------------------------------------------
 doc/reference/commands/traffic_server.en.rst |  2 --
 proxy/Main.cc                                | 12 ------------
 proxy/Main.h                                 |  1 -
 proxy/logging/LogStandalone.cc               | 11 -----------
 proxy/sac.cc                                 |  3 ---
 5 files changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb26f42a/doc/reference/commands/traffic_server.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/commands/traffic_server.en.rst b/doc/reference/commands/traffic_server.en.rst
index 8ae9aab..442a369 100644
--- a/doc/reference/commands/traffic_server.en.rst
+++ b/doc/reference/commands/traffic_server.en.rst
@@ -52,8 +52,6 @@ Description
 
 .. option:: -M, --remote_management
 
-.. option:: -d DIR, --management_dir DIR
-
 .. option:: -C CMD, --command CMD
 
 .. option:: -k, --clear_hostdb

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb26f42a/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index b5a3873..3cdd0f4 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -144,7 +144,6 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST;
 static char command_string[512] = "";
 int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG;
 
-char management_directory[PATH_NAME_MAX+1];      // Layout->sysconfdir
 char system_root_dir[PATH_NAME_MAX + 1];         // Layout->prefix
 char system_runtime_dir[PATH_NAME_MAX + 1];  // Layout->runtimedir
 char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir
@@ -210,7 +209,6 @@ static const ArgumentDescription argument_descriptions[] = {
 
   {"interval", 'i', "Statistics Interval", "I", &show_statistics, "PROXY_STATS_INTERVAL", NULL},
   {"remote_management", 'M', "Remote Management", "T", &remote_management_flag, "PROXY_REMOTE_MANAGEMENT", NULL},
-  {"management_dir", 'd', "Management Directory", "S255", &management_directory, "PROXY_MANAGEMENT_DIRECTORY", NULL},
   {"command", 'C', "Maintenance Command to Execute", "S511", &command_string, "PROXY_COMMAND_STRING", NULL},
   {"clear_hostdb", 'k', "Clear HostDB on Startup", "F", &auto_clear_hostdb_flag, "PROXY_CLEAR_HOSTDB", NULL},
   {"clear_cache", 'K', "Clear Cache on Startup", "F", &cacheProcessor.auto_clear_flag, "PROXY_CLEAR_CACHE", NULL},
@@ -347,15 +345,6 @@ initialize_process_manager()
     remote_management_flag = true;
   }
 
-  if (access(management_directory, R_OK) == -1) {
-    ink_strlcpy(management_directory, Layout::get()->sysconfdir, sizeof(management_directory));
-    if (access(management_directory, R_OK) == -1) {
-      fprintf(stderr,"unable to access() management path '%s': %d, %s\n", management_directory, errno, strerror(errno));
-      fprintf(stderr,"please set management path via command line '-d <management directory>'\n");
-      _exit(1);
-    }
-  }
-
   RecProcessInit(remote_management_flag ? RECM_CLIENT : RECM_STAND_ALONE, diags);
 
   if (!remote_management_flag) {
@@ -1303,7 +1292,6 @@ main(int /* argc ATS_UNUSED */, char **argv)
   // Before accessing file system initialize Layout engine
   Layout::create();
   ink_strlcpy(system_root_dir, Layout::get()->prefix, sizeof(system_root_dir));
-  ink_strlcpy(management_directory, Layout::get()->sysconfdir, sizeof(management_directory));
   chdir_root(); // change directory to the install root of traffic server.
 
   process_args(argument_descriptions, countof(argument_descriptions), argv);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb26f42a/proxy/Main.h
----------------------------------------------------------------------
diff --git a/proxy/Main.h b/proxy/Main.h
index d7a9a12..363fffc 100644
--- a/proxy/Main.h
+++ b/proxy/Main.h
@@ -55,7 +55,6 @@ extern char cluster_host[MAXDNAME + 1];
 extern int cluster_port_number;
 
 extern int remote_management_flag;
-extern char management_directory[PATH_NAME_MAX + 1];
 
 inkcoreapi extern int qt_accept_file_descriptor;
 inkcoreapi extern int cache_clustering_enabled;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb26f42a/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index 366dac3..014baac 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -60,7 +60,6 @@ char system_root_dir[PATH_NAME_MAX + 1] = "";
 char system_config_directory[PATH_NAME_MAX + 1] = "";
 char system_runtime_dir[PATH_NAME_MAX + 1] = "";
 char system_log_dir[PATH_NAME_MAX + 1] = "";
-char management_directory[PATH_NAME_MAX + 1] = "";
 
 char error_tags[1024] = "";
 char action_tags[1024] = "";
@@ -100,16 +99,6 @@ initialize_process_manager()
     remote_management_flag = true;
   }
 
-  if (management_directory[0] == '\0') {
-    ink_strlcpy(management_directory, Layout::get()->sysconfdir, sizeof(management_directory));
-    if (access(management_directory, R_OK) == -1) {
-      fprintf(stderr,"unable to access() management path '%s': %d, %s\n",
-              management_directory, errno, strerror(errno));
-      fprintf(stderr,"please set management path via command line '-d <management directory>'\n");
-      _exit(1);
-    }
-  }
-
   // diags should have been initialized by caller, e.g.: sac.cc
   ink_assert(diags);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bb26f42a/proxy/sac.cc
----------------------------------------------------------------------
diff --git a/proxy/sac.cc b/proxy/sac.cc
index db9571e..f094e04 100644
--- a/proxy/sac.cc
+++ b/proxy/sac.cc
@@ -97,9 +97,6 @@ main(int /* argc ATS_UNUSED */, char *argv[])
     exit(1);
   }
 
-  management_directory[0] = 0;
-  ink_strlcat(management_directory, system_config_directory, sizeof(management_directory));
-
   // check for the version number request
   //
   if (version_flag) {


[40/50] git commit: TS-2424: make g_diags private to RecDebug.cc

Posted by zw...@apache.org.
TS-2424: make g_diags private to RecDebug.cc


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

Branch: refs/heads/5.0.x
Commit: e510c586b3ee5121bf162add11ed5188dc70a80f
Parents: 39862b6
Author: James Peach <jp...@apache.org>
Authored: Mon Dec 9 16:15:31 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Dec 10 11:22:07 2013 -0800

----------------------------------------------------------------------
 cmd/traffic_cop/traffic_cop.cc |  2 --
 lib/records/P_RecCore.h        |  2 --
 lib/records/RecCore.cc         | 16 ----------------
 lib/records/RecDebug.cc        | 15 +++++++++++++++
 4 files changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e510c586/cmd/traffic_cop/traffic_cop.cc
----------------------------------------------------------------------
diff --git a/cmd/traffic_cop/traffic_cop.cc b/cmd/traffic_cop/traffic_cop.cc
index 564f070..21ea7d1 100644
--- a/cmd/traffic_cop/traffic_cop.cc
+++ b/cmd/traffic_cop/traffic_cop.cc
@@ -61,8 +61,6 @@ static const char COP_TRACE_FILE[] = "/tmp/traffic_cop.trace";
 #define COP_WARNING  LOG_ERR
 #define COP_DEBUG    LOG_DEBUG
 
-Diags * g_diags; // link time dependency
-
 static const char *root_dir;
 static const char *runtime_dir;
 static const char *config_dir;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e510c586/lib/records/P_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecCore.h b/lib/records/P_RecCore.h
index 2d92f81..375f526 100644
--- a/lib/records/P_RecCore.h
+++ b/lib/records/P_RecCore.h
@@ -43,8 +43,6 @@ extern int g_num_update[];
 extern RecModeT g_mode_type;
 extern RecTree *g_records_tree;
 
-extern Diags *g_diags;
-
 // records.config items
 extern const char *g_rec_config_fpath;
 extern LLQ *g_rec_config_contents_llq;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e510c586/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 96cddfc..759dcef 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -31,8 +31,6 @@
 
 static bool g_initialized = false;
 
-Diags *g_diags = NULL;
-
 RecRecord *g_records = NULL;
 InkHashTable *g_records_ht = NULL;
 ink_rwlock g_records_rwlock;
@@ -216,20 +214,6 @@ RecCoreInit(RecModeT mode_type, Diags *_diags)
   return REC_ERR_OKAY;
 }
 
-
-//-------------------------------------------------------------------------
-// RecSetDiags
-//-------------------------------------------------------------------------
-int
-RecSetDiags(Diags * _diags)
-{
-  // Warning! It's very dangerous to change diags on the fly!  This
-  // function only exists so that we can boot-strap TM on startup.
-  ink_atomic_swap(&g_diags, _diags);
-  return REC_ERR_OKAY;
-}
-
-
 //-------------------------------------------------------------------------
 // RecLinkCnfigXXX
 //-------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e510c586/lib/records/RecDebug.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecDebug.cc b/lib/records/RecDebug.cc
index ec7f5da..836ff23 100644
--- a/lib/records/RecDebug.cc
+++ b/lib/records/RecDebug.cc
@@ -24,6 +24,21 @@
 #include "P_RecUtils.h"
 #include "P_RecCore.h"
 
+static Diags *g_diags = NULL;
+
+//-------------------------------------------------------------------------
+// RecSetDiags
+//-------------------------------------------------------------------------
+int
+RecSetDiags(Diags * _diags)
+{
+  // Warning! It's very dangerous to change diags on the fly!  This
+  // function only exists so that we can boot-strap TM on startup.
+  ink_atomic_swap(&g_diags, _diags);
+  return REC_ERR_OKAY;
+}
+
+
 //-------------------------------------------------------------------------
 // RecLog
 //-------------------------------------------------------------------------