[trafficserver] branch master updated: Adds a missing header field for the tcpinfo log

2019-04-08 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new b20ba1e  Adds a missing header field for the tcpinfo log
b20ba1e is described below

commit b20ba1e2d3d3a76829070ee9802cfc3d9cb1cd09
Author: Leif Hedstrom 
AuthorDate: Sun Apr 7 12:32:31 2019 -0600

Adds a missing header field for the tcpinfo log
---
 plugins/tcpinfo/tcpinfo.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/tcpinfo/tcpinfo.cc b/plugins/tcpinfo/tcpinfo.cc
index dccb4c2..588ba34 100644
--- a/plugins/tcpinfo/tcpinfo.cc
+++ b/plugins/tcpinfo/tcpinfo.cc
@@ -57,7 +57,7 @@
 static const char *tcpi_headers[] = {
   "timestamp event client server rtt",
   "timestamp event client server rtt rttvar last_sent last_recv "
-  "snd_ssthresh rcv_ssthresh unacked sacked lost retrans fackets all_retrans",
+  "snd_cwnd snd_ssthresh rcv_ssthresh unacked sacked lost retrans fackets 
all_retrans",
 };
 
 struct Config {



[trafficserver] branch master updated: Fixed cache test, using updated shutdown

2019-04-08 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new cc7e102  Fixed cache test, using updated shutdown
cc7e102 is described below

commit cc7e10282b3f15c3b8cf8da1a1450ff304d125db
Author: Bryan Call 
AuthorDate: Mon Apr 8 10:31:40 2019 -0700

Fixed cache test, using updated shutdown
---
 iocore/cache/test/main.cc | 2 +-
 iocore/cache/test/main.h  | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/iocore/cache/test/main.cc b/iocore/cache/test/main.cc
index 777d9ca..578314d 100644
--- a/iocore/cache/test/main.cc
+++ b/iocore/cache/test/main.cc
@@ -31,7 +31,7 @@ char working_dir[1024] = {0};
 void
 test_done()
 {
-  shutdown_event_system = true;
+  TSSystemState::shut_down_event_system();
 }
 
 const char *GLOBAL_DATA = (char *)ats_malloc(10 * 1024 * 1024 + 3); // 10M
diff --git a/iocore/cache/test/main.h b/iocore/cache/test/main.h
index b4dc4ee..e661faa 100644
--- a/iocore/cache/test/main.h
+++ b/iocore/cache/test/main.h
@@ -29,6 +29,7 @@
 
 #include "tscore/I_Layout.h"
 #include "tscore/Diags.h"
+#include "tscore/TSSystemState.h"
 
 #include "RecordsConfig.h"
 #include "records/I_RecProcess.h"



[trafficserver] branch master updated: url_sig: fixed unit-test for remapped url.

2019-04-08 Thread gancho
This is an automated email from the ASF dual-hosted git repository.

gancho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 233aa44  url_sig: fixed unit-test for remapped url.
233aa44 is described below

commit 233aa44353c90a94830455f68bb7ad18635e80ac
Author: Gancho Tenev 
AuthorDate: Mon Feb 25 14:57:50 2019 -0800

url_sig: fixed unit-test for remapped url.

When the plugin does not use @pparam=pristineurl it should work
with the remapped url. The code already does this but the unit-test
still tests the signing of the pristine url in those specific use
cases. This is related to a behavior change with v9.0 where the
1st plugin gets the remapped url as a remap API requestUrl
regardless of its possition in the plugin chain (PR #4964).
---
 .../gold_tests/pluginTest/url_sig/url_sig.test.py  | 37 +++---
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py 
b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
index e4a5819..3b83837 100644
--- a/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
+++ b/tests/gold_tests/pluginTest/url_sig/url_sig.test.py
@@ -16,6 +16,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+import hashlib
+import hmac
 import os
 import subprocess
 Test.Summary = '''
@@ -194,16 +196,6 @@ tr.Processes.Default.Command = (
 
 # Success tests.
 
-# No client / SHA1 / P=1 / URL not pristine / URL not altered.
-#
-tr = Test.AddTestRun()
-tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.Command = (
-"curl --verbose --proxy http://127.0.0.1:{} 
'http://one.two.three/".format(ts.Variables.port) +
-
"foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=acae22b0e1ba6ea6fbb5d26018dbf152558e98cb'"
 +
-LogTee
-)
-
 # With client / SHA1 / P=1 / URL pristine / URL not altered.
 #
 tr = Test.AddTestRun()
@@ -244,13 +236,34 @@ tr.Processes.Default.Command = (
 LogTee
 )
 
+def sign(payload, key):
+  secret=bytes(key,'utf-8')
+  data=bytes(payload, 'utf-8')
+  md=bytes(hmac.new(secret, data, digestmod=hashlib.sha1).digest().hex(), 
'utf-8')
+  return md.decode("utf-8")
+
+# No client / SHA1 / P=1 / URL not pristine / URL not altered.
+#
+path="foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S="
+to_sign="127.0.0.1:{}/".format(server.Variables.Port) + path
+url="http://one.two.three/"; + path + sign(to_sign, 
"dqsgopTSM_doT6iAysasQVUKaPykyb6e")
+
+tr = Test.AddTestRun()
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Command = (
+"curl --verbose --proxy http://127.0.0.1:{} 
'{}'".format(ts.Variables.port, url) + LogTee
+)
+
 # No client / SHA1 / P=1 / URL not pristine / URL not altered -- HTTPS.
 #
+path="foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S="
+to_sign="127.0.0.1:{}/".format(server.Variables.Port) + path
+url="https://127.0.0.1:{}/".format(ts.Variables.ssl_port) + path + 
sign(to_sign, "dqsgopTSM_doT6iAysasQVUKaPykyb6e")
+
 tr = Test.AddTestRun()
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Command = (
-"curl --verbose --http1.1 --insecure --header 'Host: one.two.three' 
'https://127.0.0.1:{}/".format(ts.Variables.ssl_port) +
-
"foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S=acae22b0e1ba6ea6fbb5d26018dbf152558e98cb'"
 +
+"curl --verbose --http1.1 --insecure --header 'Host: one.two.three' 
'{}'".format(url) +
 LogTee + " ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > 
{0}/url_sig_short.log ".format(ts.RunDirectory)
 )
 



[trafficserver] branch master updated: Setting the correct directory for test_Cache

2019-04-08 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 8ec536b  Setting the correct directory for test_Cache
8ec536b is described below

commit 8ec536bf5a2c35a95bea9e8c5028f554e192f973
Author: Bryan Call 
AuthorDate: Fri Apr 5 17:10:36 2019 -0700

Setting the correct directory for test_Cache
---
 include/tscore/ink_config.h.in | 2 ++
 iocore/cache/test/main.cc  | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/tscore/ink_config.h.in b/include/tscore/ink_config.h.in
index 3e3aa28..53b02db 100644
--- a/include/tscore/ink_config.h.in
+++ b/include/tscore/ink_config.h.in
@@ -118,6 +118,8 @@
 #define TS_BUILD_CACHEDIR "@rel_cachedir@"
 #define TS_BUILD_INFODIR "@rel_infodir@"
 
+#define TS_ABS_TOP_SRCDIR "@abs_top_srcdir@"
+
 #define TS_BUILD_CANONICAL_HOST "@host@"
 
 #define TS_BUILD_DEFAULT_LOOPBACK_IFACE "@default_loopback_iface@"
diff --git a/iocore/cache/test/main.cc b/iocore/cache/test/main.cc
index c62cd3f..777d9ca 100644
--- a/iocore/cache/test/main.cc
+++ b/iocore/cache/test/main.cc
@@ -65,8 +65,9 @@ struct EventProcessorListener : Catch::TestEventListenerBase {
 thread->set_specific();
 init_buffer_allocators(0);
 
-Layout::get()->sysconfdir = std::string_view("./test");
-Layout::get()->prefix = std::string_view("./test");
+std::string src_dir   = std::string(TS_ABS_TOP_SRCDIR) + 
"/iocore/cache/test";
+Layout::get()->sysconfdir = src_dir;
+Layout::get()->prefix = src_dir;
 ::remove("./test/var/trafficserver/cache.db");
   }
 };



[trafficserver] branch master updated: Some tidying up of the global namespace.

2019-04-08 Thread amc
This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new cdd6481  Some tidying up of the global namespace.
cdd6481 is described below

commit cdd6481aabb97bc1b620f5d668f04a168c246ea1
Author: Walter Karas 
AuthorDate: Mon Feb 11 18:03:19 2019 -0600

Some tidying up of the global namespace.
---
 include/tscore/TSSystemState.h   | 92 
 iocore/aio/AIO.cc|  4 +-
 iocore/aio/test_AIO.cc   |  3 +-
 iocore/eventsystem/I_EThread.h   |  2 -
 iocore/eventsystem/UnixEThread.cc|  6 +--
 iocore/eventsystem/test_Event.cc |  3 +-
 iocore/net/SSLNetVConnection.cc  |  5 +-
 iocore/net/UnixNetAccept.cc  |  4 +-
 iocore/net/UnixNetProcessor.cc   |  3 +-
 mgmt/ProcessManager.cc   |  5 +-
 proxy/ProxyClientSession.h   |  7 ++-
 proxy/logging/Log.cc |  5 +-
 src/traffic_server/traffic_server.cc | 22 -
 13 files changed, 126 insertions(+), 35 deletions(-)

diff --git a/include/tscore/TSSystemState.h b/include/tscore/TSSystemState.h
new file mode 100644
index 000..cc5bf3d
--- /dev/null
+++ b/include/tscore/TSSystemState.h
@@ -0,0 +1,92 @@
+/**
+  @file TSSystemState.h
+
+  @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.
+
+*/
+
+#pragma once
+
+#include 
+#include 
+
+// Global status information for trafficserver
+//
+class TSSystemState
+{
+private:
+  struct Data {
+bool ssl_handshaking_stopped;
+bool event_system_shut_down;
+bool draining;
+  };
+
+public:
+  static bool
+  is_ssl_handshaking_stopped()
+  {
+return unlikely(_instance().ssl_handshaking_stopped);
+  }
+
+  static bool
+  is_event_system_shut_down()
+  {
+return unlikely(_instance().event_system_shut_down);
+  }
+
+  // Keeps track if the server is in draining state, follows the 
proxy.node.config.draining metric.
+  //
+  static bool
+  is_draining()
+  {
+return unlikely(_instance().draining);
+  }
+
+  static void
+  stop_ssl_handshaking()
+  {
+ink_assert(!_instance().ssl_handshaking_stopped);
+
+_instance().ssl_handshaking_stopped = true;
+  }
+
+  static void
+  shut_down_event_system()
+  {
+// For some reason this is triggered by the regression testing.
+// ink_assert(_instance().ssl_handshaking_stopped && 
!_instance().event_system_shut_down);
+
+_instance().event_system_shut_down = true;
+  }
+
+  static void
+  drain(bool enable)
+  {
+_instance().draining = enable;
+  }
+
+private:
+  static Data &
+  _instance()
+  {
+static Data d;
+
+return d;
+  }
+};
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index ca7860c..29deaf6 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -25,6 +25,8 @@
  * Async Disk IO operations.
  */
 
+#include 
+
 #include "P_AIO.h"
 
 #if AIO_MODE == AIO_MODE_NATIVE
@@ -457,7 +459,7 @@ aio_thread_main(void *arg)
   ink_mutex_acquire(&my_aio_req->aio_mutex);
   for (;;) {
 do {
-  if (unlikely(shutdown_event_system == true)) {
+  if (TSSystemState::is_event_system_shut_down()) {
 ink_mutex_release(&my_aio_req->aio_mutex);
 return nullptr;
   }
diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc
index 4292e6d..4bc2c23 100644
--- a/iocore/aio/test_AIO.cc
+++ b/iocore/aio/test_AIO.cc
@@ -24,6 +24,7 @@
 #include "P_AIO.h"
 #include "InkAPIInternal.h"
 #include "tscore/I_Layout.h"
+#include "tscore/TSSystemState.h"
 #include 
 #include 
 
@@ -469,7 +470,7 @@ main(int /* argc ATS_UNUSED */, char *argv[])
 }
   }
 
-  while (!shutdown_event_system) {
+  while (!TSSystemState::is_event_system_shut_down()) {
 sleep(1);
   }
   delete main_thread;
diff --git a/iocore/eventsystem/I_EThread.h b/iocore/eventsystem/I_EThread.h
index 9a1bbcd..a0518fd 100644
--- a/iocore/eventsystem/I_EThread.h
+++ b/iocore/eventsystem/I_EThread.h
@@ -51,8 +51,6 @@ enum ThreadType {
   DEDICATED,
 };
 
-extern bool shutdown_event_system;
-
 /**
   Event System specific type of thread.
 
diff --git a/iocore/eventsystem/UnixEThread.cc 
b/iocor