[trafficserver] branch master updated: Assert when sm callback to wrong thread

2019-02-11 Thread scw00
This is an automated email from the ASF dual-hosted git repository.

scw00 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 f5534ba  Assert when sm callback to wrong thread
f5534ba is described below

commit f5534ba5581e09ebe3e759dc04c9dda23b75a741
Author: scw00 
AuthorDate: Thu Jan 24 17:43:37 2019 +0800

Assert when sm callback to wrong thread
---
 src/traffic_server/InkAPI.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index cbe88ce..5b63750 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -5928,13 +5928,14 @@ TSHttpTxnReenable(TSHttpTxn txnp, TSEvent event)
   // If this function is being executed on a thread created by the API
   // which is DEDICATED, the continuation needs to be called back on a
   // REGULAR thread.
-  if (eth == nullptr || eth->tt != REGULAR) {
+  if (eth == nullptr || eth->tt != REGULAR || !eth->is_event_type(ET_NET)) {
 eventProcessor.schedule_imm(new TSHttpSMCallback(sm, event), ET_NET);
   } else {
 MUTEX_TRY_LOCK(trylock, sm->mutex, eth);
 if (!trylock.is_locked()) {
   eventProcessor.schedule_imm(new TSHttpSMCallback(sm, event), ET_NET);
 } else {
+  ink_assert(eth->is_event_type(ET_NET));
   sm->state_api_callback((int)event, nullptr);
 }
   }



[trafficserver] branch master updated: Add history to HTTP/2

2019-02-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori 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 84d59dc  Add history to HTTP/2
84d59dc is described below

commit 84d59dc083a37a8b98d446c81fc2853bb131a11d
Author: Masaori Koshiba 
AuthorDate: Thu Feb 7 12:38:24 2019 +0900

Add history to HTTP/2
---
 proxy/http2/Http2ClientSession.cc   | 16 
 proxy/http2/Http2ClientSession.h|  6 ++
 proxy/http2/Http2ConnectionState.cc | 25 ++---
 proxy/http2/Http2Stream.cc  | 12 
 proxy/http2/Http2Stream.h   |  3 +++
 5 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index e6037fd..7774d01 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -25,8 +25,14 @@
 #include "HttpDebugNames.h"
 #include "tscore/ink_base64.h"
 
+#define REMEMBER(e, r)  \
+  { \
+this->remember(MakeSourceLocation(), e, r); \
+  }
+
 #define STATE_ENTER(state_name, event) 
  \
   do { 
  \
+REMEMBER(event, this->recursion)   
  \
 SsnDebug(this, "http2_cs", "[%" PRId64 "] [%s, %s]", 
this->connection_id(), #state_name, \
  HttpDebugNames::get_event_name(event));   
  \
   } while (0)
@@ -35,6 +41,7 @@
 
 #define HTTP2_SET_SESSION_HANDLER(handler) \
   do { \
+REMEMBER(NO_EVENT, this->recursion);   \
 this->session_handler = (handler); \
   } while (0)
 
@@ -65,6 +72,7 @@ Http2ClientSession::destroy()
 {
   if (!in_destroy) {
 in_destroy = true;
+REMEMBER(NO_EVENT, this->recursion)
 Http2SsnDebug("session destroy");
 // Let everyone know we are going down
 do_api_callout(TS_HTTP_SSN_CLOSE_HOOK);
@@ -87,6 +95,7 @@ Http2ClientSession::free()
 return;
   }
 
+  REMEMBER(NO_EVENT, this->recursion)
   Http2SsnDebug("session free");
 
   HTTP2_DECREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_CLIENT_SESSION_COUNT, 
this->mutex->thread_holding);
@@ -253,6 +262,7 @@ Http2ClientSession::do_io_shutdown(ShutdownHowTo_t howto)
 void
 Http2ClientSession::do_io_close(int alerrno)
 {
+  REMEMBER(NO_EVENT, this->recursion)
   Http2SsnDebug("session closed");
 
   ink_assert(this->mutex->thread_holding == this_ethread());
@@ -550,3 +560,9 @@ 
Http2ClientSession::decrement_current_active_client_connections_stat()
 {
   
HTTP2_DECREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_ACTIVE_CLIENT_CONNECTION_COUNT,
 this_ethread());
 }
+
+void
+Http2ClientSession::remember(const SourceLocation &location, int event, int 
reentrant)
+{
+  this->_history.push_back(location, event, reentrant);
+}
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index 26636fb..9a2c5a1 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -29,6 +29,7 @@
 #include "Http2ConnectionState.h"
 #include 
 #include "tscore/ink_inet.h"
+#include "tscore/History.h"
 
 // Name   Edata Description
 // HTTP2_SESSION_EVENT_INIT   Http2ClientSession *  HTTP/2 session is born
@@ -304,6 +305,9 @@ public:
 return write_buffer->max_read_avail();
   }
 
+  // Record history from Http2ConnectionState
+  void remember(const SourceLocation &location, int event, int reentrant = 
NO_REENTRANT);
+
   // noncopyable
   Http2ClientSession(Http2ClientSession &) = delete;
   Http2ClientSession &operator=(const Http2ClientSession &) = delete;
@@ -333,6 +337,8 @@ private:
   IpEndpoint cached_client_addr;
   IpEndpoint cached_local_addr;
 
+  History _history;
+
   // For Upgrade: h2c
   Http2UpgradeContext upgrade_context;
 
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 45689d7..3da2dd7 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -26,8 +26,16 @@
 #include "Http2ClientSession.h"
 #include "Http2Stream.h"
 #include "Http2DebugNames.h"
+#include "HttpDebugNames.h"
 #include 
 
+#define REMEMBER(e, r)\
+  {   \
+if (this->ua_session) {   \
+  this->ua_session->remember(MakeSourceLocation(), e, r); \
+} \
+  }
+
 #define Http2ConDebug(ua_session, fmt, ...) \
   SsnDebug(ua_session, "http2_con", "[%" PRId64 "] " fmt, 
ua_session->connection_id(), ##__VA_ARGS__);
 
@@ -877,6 +885,7 @@ Http2ConnectionState::main_event_handle

[trafficserver] branch master updated: HdrHeap: Remove pointless code and misleading comment. By design for serialization, HdrHeap has no virtual methods and therefore no virtual function pointer.

2019-02-11 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 7680a52  HdrHeap: Remove pointless code and misleading comment. By 
design for serialization, HdrHeap has no virtual methods and therefore no 
virtual function pointer.
7680a52 is described below

commit 7680a52ffe4afd4fd9b6c70c19cfc85ee88f49cc
Author: Alan M. Carroll 
AuthorDate: Mon Feb 11 17:20:35 2019 -0600

HdrHeap: Remove pointless code and misleading comment.
By design for serialization, HdrHeap has no virtual methods and therefore 
no virtual function pointer.
---
 proxy/hdrs/HdrHeap.cc | 6 --
 1 file changed, 6 deletions(-)

diff --git a/proxy/hdrs/HdrHeap.cc b/proxy/hdrs/HdrHeap.cc
index 70cf6d5..243d6ce 100644
--- a/proxy/hdrs/HdrHeap.cc
+++ b/proxy/hdrs/HdrHeap.cc
@@ -40,7 +40,6 @@
 #define MAX_LOST_STR_SPACE 1024
 
 Allocator hdrHeapAllocator("hdrHeap", HDR_HEAP_DEFAULT_SIZE);
-static HdrHeap proto_heap;
 
 Allocator strHeapAllocator("hdrStrHeap", HDR_STR_HEAP_DEFAULT_SIZE);
 
@@ -122,11 +121,6 @@ new_HdrHeap(int size)
 h = (HdrHeap *)ats_malloc(size);
   }
 
-  //Debug("hdrs", "Allocated header heap in size %d", size);
-
-  // Patch virtual function table ptr
-  *((void **)h) = *((void **)&proto_heap);
-
   h->m_size = size;
   h->init();
 



[trafficserver] 05/05: Updated Changelog

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

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

commit ae79abbae97acb843d186ca5fc7f23b01404d2b7
Author: Bryan Call 
AuthorDate: Mon Feb 11 16:42:47 2019 -0800

Updated Changelog
---
 CHANGELOG-8.0.3 | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG-8.0.3 b/CHANGELOG-8.0.3
index 6a71e0f..1e0f48c 100644
--- a/CHANGELOG-8.0.3
+++ b/CHANGELOG-8.0.3
@@ -1,10 +1,12 @@
 Changes with Apache Traffic Server 8.0.3
+  #3008 - Fix an failed assertion in HttpSM::parse_range_and_compare
   #4189 - Plugins: Cleanup up dependencies on core headers - background_fetch
   #4279 - Ensure NOFILES ulimit is set high
   #4297 - Don't update records.config when other configs are reloaded
   #4311 - Fix typo of the nofiles ulimit to a sane number
   #4354 - Fix logging log file roll issue (#2544).
   #4420 - Removes this unused old/duplicated define
+  #4488 - preventing crashing when calling TSSslContextFindByName with a 
nullptr or a 0 length string
   #4528 - Removes ref-counting from background_fetch
   #4550 - Doc: Describe parent weight and format
   #4552 - Print error message for unimplemented commands
@@ -21,7 +23,6 @@ Changes with Apache Traffic Server 8.0.3
   #4595 - Doc: getting started case shouldn't used regex_remap
   #4599 - Doc: Remove pipeline references
   #4601 - Update logging.yaml documentation
-  #4602 - New ScheduleOn APIs
   #4610 - Doc: parent config has more features than balancer plugin
   #4619 - Doc: cache.config isn't a substitute for Cache-Control
   #4620 - Doc: removing stale while revalidate plugin doc (marked deprecated 
in 7)
@@ -30,6 +31,7 @@ Changes with Apache Traffic Server 8.0.3
   #4678 - Prevent linking everything against brotli
   #4682 - Finish the config removal started in #4653
   #4685 - Cleans up some plugin READMEs
+  #4689 - Deals better with Cc: max-age=0
   #4693 - Remove ignoring unused variable warning from webp plugin
   #4731 - Acquire a lock before checking H2ConnectionState::ua_session
   #4732 - Make H2 stream counters atomic
@@ -37,6 +39,7 @@ Changes with Apache Traffic Server 8.0.3
   #4759 - Fixes Clang-Analyzer issue of H2 Dependence Tree
   #4773 - Calls SSL child config callback after cert is loaded for both key 
parts
   #4774 - Fixed clang 5.0.0 issue with brace initialization
+  #4778 - This improves on #3008, making the code clearer
   #4780 - Don't allow the old body to be used when refreshing
   #4792 - Validates return values from TSHttpTxnClientAddrGet()
   #4797 - Eliminates frequent librecords lookup
@@ -45,11 +48,16 @@ Changes with Apache Traffic Server 8.0.3
   #4811 - Changes the string_view::length to ::size
   #4812 - Add ifdef so tls test client will compile on non-openssl-1.1.x
   #4820 - Eliminates expensive librecords and malloc on drain
+  #4824 - Fix ATS does not honor proxy.config.body_factory.response_max_size
+  #4839 - Fixes heap-use-after-free in RangeTransform
   #4842 - Doc: minor records.config cleaning
   #4845 - Initialize redir_len, compiler warnings
   #4853 - Various fixes and improvements to background_fetch
+  #4881 - Fix TSHttpTxnEffectiveUrlStringGet to correctly set the port when 
non-standard
   #4885 - Content Length can be trusted when the origin server returns a 304
   #4892 - Use one setting for H2 consistently for header size limit on H2 
connections
   #4918 - Runroot: make traffic_top use runroot
   #4936 - Mark H2 connection inactive only if it is NOT shutting down
   #4943 - Fix to allow runroot to override the configuration directory
+  #4946 - Corrects description for proxy.config.http.origin_max_connections
+  #4949 - Split current active client connections stats into HTTP/1.1 and 
HTTP/2



[trafficserver] 03/05: Fix an failed assertion in HttpSM::parse_range_and_compare

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

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

commit cad19dfd0304e9206e4f1b0d0d7e41c2db081b49
Author: fengshuaitao 
AuthorDate: Wed Jan 17 15:08:29 2018 +0800

Fix an failed assertion in HttpSM::parse_range_and_compare

Signed-off-by: fengshuaitao 
(cherry picked from commit 8046477d6c871be61a9d2ec6b41f2524a3fde699)
---
 proxy/http/HttpSM.cc | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index ccc2d01..8d434d8 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4170,6 +4170,8 @@ HttpSM::parse_range_and_compare(MIMEField *field, int64_t 
content_length)
   const char *s, *e, *tmp;
   RangeRecord *ranges = nullptr;
   int64_t start, end;
+  int64_t cutoff = INT64_MAX / 10;
+  int64_t cutlim = INT64_MAX % 10;
 
   ink_assert(field != nullptr && t_state.range_setup == 
HttpTransact::RANGE_NONE && t_state.ranges == nullptr);
 
@@ -4226,6 +4228,12 @@ HttpSM::parse_range_and_compare(MIMEField *field, 
int64_t content_length)
   start = -1;
 } else {
   for (start = 0; s < e && *s >= '0' && *s <= '9'; ++s) {
+// check the int64 overflow in case of high gcc with O3 option
+// thinking the start is always positive
+if (start >= cutoff && (start > cutoff || *s - '0' > cutlim)) {
+  t_state.range_setup = HttpTransact::RANGE_NONE;
+  goto Lfaild;
+}
 start = start * 10 + (*s - '0');
   }
   // skip last white spaces
@@ -4258,6 +4266,12 @@ HttpSM::parse_range_and_compare(MIMEField *field, 
int64_t content_length)
   end = content_length - 1;
 } else {
   for (end = 0; s < e && *s >= '0' && *s <= '9'; ++s) {
+// check the int64 overflow in case of high gcc with O3 option
+// thinking the start is always positive
+if (end >= cutoff && (end > cutoff || *s - '0' > cutlim)) {
+  t_state.range_setup = HttpTransact::RANGE_NONE;
+  goto Lfaild;
+}
 end = end * 10 + (*s - '0');
   }
   // skip last white spaces



[trafficserver] 01/05: Fixes heap-use-after-free in RangeTransform

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

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

commit 063c4df37a5f325eb40d2c9bdffd675ae1753e4f
Author: scw00 
AuthorDate: Mon Jan 21 20:15:32 2019 +0800

Fixes heap-use-after-free in RangeTransform

(cherry picked from commit fb3eb6913471c0915716c658335b1bdf3b155cba)
---
 proxy/Transform.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/proxy/Transform.cc b/proxy/Transform.cc
index d45d2df..9b7cb7f 100644
--- a/proxy/Transform.cc
+++ b/proxy/Transform.cc
@@ -788,7 +788,11 @@ RangeTransform::handle_event(int event, void *edata)
 
   if (m_closed) {
 if (m_deletable) {
-  Debug("http_trans", "RangeTransform destroy: %p ndone=%" PRId64, this, 
m_output_vio ? m_output_vio->ndone : 0);
+  if (m_output_vc != nullptr) {
+Debug("http_trans", "RangeTransform destroy: %p ndone=%" PRId64, this, 
m_output_vio ? m_output_vio->ndone : 0);
+  } else {
+Debug("http_trans", "RangeTransform destroy");
+  }
   delete this;
 }
   } else {



[trafficserver] branch 8.0.x updated (0f10c1d -> ae79abb)

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

bcall pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from 0f10c1d  Fix TSHttpTxnEffectiveUrlStringGet to correctly set the port 
when it is non-standard.
 new 063c4df  Fixes heap-use-after-free in RangeTransform
 new 0a90b58  Fix ATS does not honor 
proxy.config.body_factory.response_max_size
 new cad19df  Fix an failed assertion in HttpSM::parse_range_and_compare
 new a8d6a17  This improves on #3008, making the code clearer
 new ae79abb  Updated Changelog

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGELOG-8.0.3| 10 +-
 proxy/Transform.cc |  6 +-
 proxy/http/HttpSM.cc   | 20 ++--
 proxy/http/HttpTransact.cc |  6 +++---
 4 files changed, 35 insertions(+), 7 deletions(-)



[trafficserver] 02/05: Fix ATS does not honor proxy.config.body_factory.response_max_size

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

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

commit 0a90b58b8912b6222ee637306fe2d30d72d5696a
Author: Shinya Kawano 
AuthorDate: Thu Jan 17 15:56:10 2019 +0900

Fix ATS does not honor proxy.config.body_factory.response_max_size

(cherry picked from commit 854324af36f615a71ef4265f4a7c6ee8f40f42cd)
---
 proxy/http/HttpTransact.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 64bee4e..10b5548 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7911,9 +7911,9 @@ HttpTransact::build_error_response(State *s, HTTPStatus 
status_code, const char
   int64_t len;
   char *new_msg;
 
-  new_msg = body_factory->fabricate_with_old_api(error_body_type, s, 8192, 
&len, body_language, sizeof(body_language), body_type,
- sizeof(body_type), 
s->internal_msg_buffer_size,
- s->internal_msg_buffer_size ? 
s->internal_msg_buffer : nullptr);
+  new_msg = body_factory->fabricate_with_old_api(
+error_body_type, s, s->http_config_param->body_factory_response_max_size, 
&len, body_language, sizeof(body_language), body_type,
+sizeof(body_type), s->internal_msg_buffer_size, 
s->internal_msg_buffer_size ? s->internal_msg_buffer : nullptr);
 
   // After the body factory is called, a new "body" is allocated, and we must 
replace it. It is
   // unfortunate that there's no way to avoid this fabrication even when there 
is no substitutions...



[trafficserver] 04/05: This improves on #3008, making the code clearer

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

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

commit a8d6a1722e0227f5dab0775b81a0e6323c50d592
Author: Leif Hedstrom 
AuthorDate: Wed Jan 9 09:46:41 2019 -0700

This improves on #3008, making the code clearer

(cherry picked from commit 571d11ecf49c410470e2efbc1eca469618629084)
---
 proxy/http/HttpSM.cc | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 8d434d8..b6d03b5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4170,8 +4170,6 @@ HttpSM::parse_range_and_compare(MIMEField *field, int64_t 
content_length)
   const char *s, *e, *tmp;
   RangeRecord *ranges = nullptr;
   int64_t start, end;
-  int64_t cutoff = INT64_MAX / 10;
-  int64_t cutlim = INT64_MAX % 10;
 
   ink_assert(field != nullptr && t_state.range_setup == 
HttpTransact::RANGE_NONE && t_state.ranges == nullptr);
 
@@ -4230,11 +4228,13 @@ HttpSM::parse_range_and_compare(MIMEField *field, 
int64_t content_length)
   for (start = 0; s < e && *s >= '0' && *s <= '9'; ++s) {
 // check the int64 overflow in case of high gcc with O3 option
 // thinking the start is always positive
-if (start >= cutoff && (start > cutoff || *s - '0' > cutlim)) {
+int64_t new_start = start * 10 + (*s - '0');
+
+if (new_start < start) { // Overflow
   t_state.range_setup = HttpTransact::RANGE_NONE;
   goto Lfaild;
 }
-start = start * 10 + (*s - '0');
+start = new_start;
   }
   // skip last white spaces
   for (; s < e && ParseRules::is_ws(*s); ++s) {
@@ -4268,11 +4268,13 @@ HttpSM::parse_range_and_compare(MIMEField *field, 
int64_t content_length)
   for (end = 0; s < e && *s >= '0' && *s <= '9'; ++s) {
 // check the int64 overflow in case of high gcc with O3 option
 // thinking the start is always positive
-if (end >= cutoff && (end > cutoff || *s - '0' > cutlim)) {
+int64_t new_end = end * 10 + (*s - '0');
+
+if (new_end < end) { // Overflow
   t_state.range_setup = HttpTransact::RANGE_NONE;
   goto Lfaild;
 }
-end = end * 10 + (*s - '0');
+end = new_end;
   }
   // skip last white spaces
   for (; s < e && ParseRules::is_ws(*s); ++s) {



[trafficserver] branch 8.0.x updated: Fix TSHttpTxnEffectiveUrlStringGet to correctly set the port when it is non-standard.

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 0f10c1d  Fix TSHttpTxnEffectiveUrlStringGet to correctly set the port 
when it is non-standard.
0f10c1d is described below

commit 0f10c1d95981a72778777bfece0193d64bcad412
Author: Alan M. Carroll 
AuthorDate: Mon Jan 28 16:31:10 2019 -0600

Fix TSHttpTxnEffectiveUrlStringGet to correctly set the port when it is 
non-standard.

(cherry picked from commit b9f29f0c096e95a621f022c6c30694fd949bd811)
---
 proxy/hdrs/HTTP.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 3858bd0..c30efbe 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1702,6 +1702,7 @@ class UrlPrintHack
 ink_assert(nullptr == ui->m_ptr_port); // shouldn't be set if not in 
URL.
 ui->m_ptr_port= m_port_buff;
 ui->m_len_port= snprintf(m_port_buff, sizeof(m_port_buff), "%d", 
hdr->m_port);
+ui->m_port= hdr->m_port;
 m_port_modified_p = true;
   } else {
 m_port_modified_p = false;
@@ -1725,6 +1726,7 @@ class UrlPrintHack
   if (m_port_modified_p) {
 ui->m_len_port = 0;
 ui->m_ptr_port = nullptr;
+ui->m_port = 0;
   }
   if (m_host_modified_p) {
 ui->m_len_host = 0;



[trafficserver] 02/02: preventing crashing when calling TSSslContextFindByName with a nullptr or a 0 lenght string

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

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

commit 45efe1a494b0257319af0c3d30098963f4139c5e
Author: Daniel Morilha (netlify) 
AuthorDate: Wed Oct 24 14:12:21 2018 -0700

preventing crashing when calling TSSslContextFindByName with a nullptr or a 
0 lenght string

(cherry picked from commit ac61c354acd75cf5ba653c6921c6415d78074134)
---
 src/traffic_server/InkAPI.cc | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 95fa642..1933917 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9163,6 +9163,10 @@ TSVConnSSLConnectionGet(TSVConn sslp)
 tsapi TSSslContext
 TSSslContextFindByName(const char *name)
 {
+  if (nullptr == name || 0 == strlen(name)) {
+// an empty name is an invalid input
+return nullptr;
+  }
   TSSslContext ret  = nullptr;
   SSLCertLookup *lookup = SSLCertificateConfig::acquire();
   if (lookup != nullptr) {



[trafficserver] branch 8.0.x updated (a9a1ebb -> 45efe1a)

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

bcall pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from a9a1ebb  Split current active client connections stats into HTTP/1.1 
and HTTP/2
 new 70f9332  Deals better with Cc: max-age=0
 new 45efe1a  preventing crashing when calling TSSslContextFindByName with 
a nullptr or a 0 lenght string

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http/HttpTransact.cc   | 2 +-
 src/traffic_server/InkAPI.cc | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)



[trafficserver] 01/02: Deals better with Cc: max-age=0

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

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

commit 70f9332b762e28c75c4b5bf4f757b7353690c39a
Author: Leif Hedstrom 
AuthorDate: Thu Dec 6 08:58:00 2018 -0700

Deals better with Cc: max-age=0

There's a small window where we can still serve cached responses even
when they have a Cache-Control: max-age=0.

This fixes the cache-tests checks for id=freshness-max-age-0 and
id=freshness-max-age-0-expires.

(cherry picked from commit 0b80592bc472d5394c777d0fca66f72779276cf2)
---
 proxy/http/HttpTransact.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 62d6ffa..64bee4e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7273,7 +7273,7 @@ HttpTransact::what_is_document_freshness(State *s, 
HTTPHdr *client_request, HTTP
   // now, see if the age is "fresh enough" //
   ///
 
-  if (do_revalidate || current_age > age_limit) { // client-modified limit
+  if (do_revalidate || !age_limit || current_age > age_limit) { // 
client-modified limit
 TxnDebug("http_match", "[..._document_freshness] document needs 
revalidate/too old; "
"returning FRESHNESS_STALE");
 return (FRESHNESS_STALE);



[trafficserver] branch 8.0.x updated: Split current active client connections stats into HTTP/1.1 and HTTP/2

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new a9a1ebb  Split current active client connections stats into HTTP/1.1 
and HTTP/2
a9a1ebb is described below

commit a9a1ebbbdc1a4522ad0a27b4d9f8b2d914f32834
Author: Masaori Koshiba 
AuthorDate: Fri Oct 12 09:22:23 2018 +0900

Split current active client connections stats into HTTP/1.1 and HTTP/2

`proxy.process.http.current_active_client_connections` was stats of active
client connections regardless protocols.
It’s useful that each protocol has its own metrics.

// Before
- `proxy.process.http.current_active_client_connections` for HTTP/1.1 & 
HTTP/2

// After
- `proxy.process.http.current_active_client_connections` for HTTP/1.1
- `proxy.process.http2.current_active_client_connections` for HTTP/2

(cherry picked from commit 4efed05ea8647328444c6c7780f88bf5f9f72575)

Conflicts:
doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
---
 .../statistics/core/http-connection.en.rst |  8 +++
 proxy/ProxyClientSession.cc|  4 ++--
 proxy/ProxyClientSession.h |  2 ++
 proxy/http/Http1ClientSession.cc   | 12 ++
 proxy/http/Http1ClientSession.h|  3 +++
 proxy/http2/HTTP2.cc   | 28 --
 proxy/http2/HTTP2.h|  6 ++---
 proxy/http2/Http2ClientSession.cc  | 12 ++
 proxy/http2/Http2ClientSession.h   |  3 +++
 9 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst 
b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
index 2c55076..736850e 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -45,6 +45,9 @@ HTTP Connection
 .. ts:stat:: global proxy.process.http.current_active_client_connections 
integer
:type: gauge
 
+   Represents the current number of HTTP/1.0 and HTTP/1.1 connections
+   from client to the |TS|.
+
 .. ts:stat:: global proxy.process.http.current_cache_connections integer
:type: gauge
:ungathered:
@@ -132,3 +135,8 @@ HTTP Connection
:type: counter
 
 This tracks the number of origin connections denied due to being over the 
:ts:cv:`proxy.config.http.origin_max_connections` limit.
+
+.. ts:stat:: global proxy.process.http2.current_active_client_connections 
integer
+   :type: gauge
+
+   Represents the current number of HTTP/2 connections from client to the |TS|.
diff --git a/proxy/ProxyClientSession.cc b/proxy/ProxyClientSession.cc
index 8cb61eb..6e06049 100644
--- a/proxy/ProxyClientSession.cc
+++ b/proxy/ProxyClientSession.cc
@@ -37,7 +37,7 @@ ProxyClientSession::set_session_active()
 {
   if (!m_active) {
 m_active = true;
-HTTP_INCREMENT_DYN_STAT(http_current_active_client_connections_stat);
+this->increment_current_active_client_connections_stat();
   }
 }
 
@@ -46,7 +46,7 @@ ProxyClientSession::clear_session_active()
 {
   if (m_active) {
 m_active = false;
-HTTP_DECREMENT_DYN_STAT(http_current_active_client_connections_stat);
+this->decrement_current_active_client_connections_stat();
   }
 }
 
diff --git a/proxy/ProxyClientSession.h b/proxy/ProxyClientSession.h
index 05e3564..1608578 100644
--- a/proxy/ProxyClientSession.h
+++ b/proxy/ProxyClientSession.h
@@ -268,6 +268,8 @@ public:
 
   void set_session_active();
   void clear_session_active();
+  virtual void increment_current_active_client_connections_stat() = 0;
+  virtual void decrement_current_active_client_connections_stat() = 0;
 
   static int64_t next_connection_id();
 
diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 748e601..5f598ad 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -542,3 +542,15 @@ 
Http1ClientSession::attach_server_session(HttpServerSession *ssession, bool tran
 slave_ka_vio = nullptr;
   }
 }
+
+void
+Http1ClientSession::increment_current_active_client_connections_stat()
+{
+  HTTP_INCREMENT_DYN_STAT(http_current_active_client_connections_stat);
+}
+
+void
+Http1ClientSession::decrement_current_active_client_connections_stat()
+{
+  HTTP_DECREMENT_DYN_STAT(http_current_active_client_connections_stat);
+}
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index 4221002..1a30b1c 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -176,6 +176,9 @@ public:
 return f_transparent_passthrough;
   }
 
+  void increment_current_active_client_connections_stat() override;
+  void decrement_current_active_c

[trafficserver] branch 8.0.x updated: Corrects description for proxy.config.http.origin_max_connections

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 7b4211a  Corrects description for 
proxy.config.http.origin_max_connections
7b4211a is described below

commit 7b4211a161da1eafe28dcc5850c70d29f18d0161
Author: Derek Dagit 
AuthorDate: Thu Feb 7 08:53:18 2019 -0800

Corrects description for proxy.config.http.origin_max_connections
---
 doc/admin-guide/files/records.config.en.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 69f3ac9..2cfd2a6 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1360,7 +1360,7 @@ Origin Server Connect Attempts
:reloadable:
:overridable:
 
-   Limits the number of socket connections per origin server to the value 
specified. To enable, set to one (``1``).
+   Limits the number of socket connections per origin server to the value 
specified. To disable, set to zero (``0``).
 
 .. ts:cv:: CONFIG proxy.config.http.origin_max_connections_queue INT -1
:reloadable:



[trafficserver] branch 7.1.x updated: Manually brought in changes from #4797

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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
 new 14963f6  Manually brought in changes from #4797
14963f6 is described below

commit 14963f60987c80e024b5618ebd400ad9aa8a4fad
Author: Evan Zelkowitz <19699200+ezelk...@users.noreply.github.com>
AuthorDate: Wed Jan 30 14:07:20 2019 -0700

Manually brought in changes from #4797

commit 58b154bb6f253ac8660bd778dd2bf43cb7b60687

Updated to use ts::string_view
---
 iocore/net/I_Net.h|  4 
 iocore/net/Net.cc | 18 ++
 iocore/net/P_UnixNetVConnection.h | 35 ---
 iocore/net/UnixNetVConnection.cc  | 30 ++
 mgmt/RecordsConfig.cc |  4 ++--
 5 files changed, 54 insertions(+), 37 deletions(-)

diff --git a/iocore/net/I_Net.h b/iocore/net/I_Net.h
index ef122b8..3848f1d 100644
--- a/iocore/net/I_Net.h
+++ b/iocore/net/I_Net.h
@@ -43,6 +43,7 @@
 #include "ts/I_Version.h"
 #include "I_EventSystem.h"
 #include 
+#include "ts/string_view.h"
 
 #ifndef UIO_MAXIOV
 #define NET_MAX_IOV 16 // UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
@@ -64,6 +65,9 @@ extern int net_accept_period;
 extern int net_retry_delay;
 extern int net_throttle_delay;
 
+extern ts::string_view net_ccp_in;
+extern ts::string_view net_ccp_out;
+
 #define NET_EVENT_OPEN (NET_EVENT_EVENTS_START)
 #define NET_EVENT_OPEN_FAILED (NET_EVENT_EVENTS_START + 1)
 #define NET_EVENT_ACCEPT (NET_EVENT_EVENTS_START + 2)
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 0984df3..c647107 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -40,6 +40,10 @@ int net_accept_period   = 10;
 int net_retry_delay = 10;
 int net_throttle_delay  = 50; /* milliseconds */
 
+// For the in/out congestion control: ToDo: this probably would be better as 
ports: specifications
+ts::string_view net_ccp_in;
+ts::string_view net_ccp_out;
+
 static inline void
 configure_net()
 {
@@ -52,6 +56,20 @@ configure_net()
   // These are not reloadable
   REC_ReadConfigInteger(net_event_period, "proxy.config.net.event_period");
   REC_ReadConfigInteger(net_accept_period, "proxy.config.net.accept_period");
+
+  // This is kinda fugly, but better than it was before (on every connection 
in and out)
+  // Note that these would need to be ats_free()'d if we ever want to clean 
that up, but
+  // we have no good way of dealing with that on such globals I think?
+  RecString ccp;
+
+  REC_ReadConfigStringAlloc(ccp, "proxy.config.net.tcp_congestion_control_in");
+  if (ccp && *ccp != '\0') {
+net_ccp_in = {ccp};
+  }
+  REC_ReadConfigStringAlloc(ccp, 
"proxy.config.net.tcp_congestion_control_out");
+  if (ccp && *ccp != '\0') {
+net_ccp_out = {ccp};
+  }
 }
 
 static inline void
diff --git a/iocore/net/P_UnixNetVConnection.h 
b/iocore/net/P_UnixNetVConnection.h
index 0f557fe..d9fa732 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -454,41 +454,6 @@ UnixNetVConnection::set_tcp_init_cwnd(int init_cwnd)
 #endif
 }
 
-TS_INLINE int
-UnixNetVConnection::set_tcp_congestion_control(int side)
-{
-#ifdef TCP_CONGESTION
-  RecString congestion_control;
-  int ret;
-
-  if (side == CLIENT_SIDE) {
-ret = REC_ReadConfigStringAlloc(congestion_control, 
"proxy.config.net.tcp_congestion_control_in");
-  } else {
-ret = REC_ReadConfigStringAlloc(congestion_control, 
"proxy.config.net.tcp_congestion_control_out");
-  }
-
-  if (ret == REC_ERR_OKAY) {
-int len = strlen(congestion_control);
-if (len > 0) {
-  int rv = 0;
-  rv = setsockopt(con.fd, IPPROTO_TCP, TCP_CONGESTION, 
reinterpret_cast(congestion_control), len);
-  if (rv < 0) {
-Error("Unable to set TCP congestion control on socket %d to \"%.*s\", 
errno=%d (%s)", con.fd, len, congestion_control,
-  errno, strerror(errno));
-  } else {
-Debug("socket", "Setting TCP congestion control on socket [%d] to 
\"%.*s\" -> %d", con.fd, len, congestion_control, rv);
-  }
-}
-ats_free(congestion_control);
-return 0;
-  }
-  return -1;
-#else
-  Debug("socket", "Setting TCP congestion control is not supported on this 
platform.");
-  return -1;
-#endif
-}
-
 TS_INLINE UnixNetVConnection::~UnixNetVConnection()
 {
 }
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index c8953af..7b58165 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -1586,3 +1586,33 @@ UnixNetVConnection::remove_from_active_queue()
 ink_release_assert(!"BUG: It must have acquired the NetHandler's lock 
before doing anything on active_queue.");
   }
 }
+
+int
+UnixNetVConnection::set_tcp_congestion_control(int side)
+{
+#ifdef TCP_CONGESTION
+  ts::string_view ccp;
+
+  if (side == CLIENT_

[trafficserver] branch 7.1.x updated: Mark H2 connection inactive only if it is NOT shutting down

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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
 new 6c315e9  Mark H2 connection inactive only if it is NOT shutting down
6c315e9 is described below

commit 6c315e9df8a8039fc7f984273c21b6a46a212896
Author: Masaori Koshiba 
AuthorDate: Wed Feb 6 15:45:53 2019 +0900

Mark H2 connection inactive only if it is NOT shutting down

Prior this change, HTTP/2 connection is marked as inactive regardless it is 
shutting down or not.

(cherry picked from commit a4227747277759c27c63ba948d96fbd6204dc8db)

Conflicts:
proxy/http2/Http2ConnectionState.cc
---
 proxy/http2/Http2ClientSession.cc   |  2 ++
 proxy/http2/Http2ConnectionState.cc | 38 +++--
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 3de5670..f61cf70 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -282,6 +282,8 @@ Http2ClientSession::do_io_close(int alerrno)
 SCOPED_MUTEX_LOCK(lock, this->connection_state.mutex, this_ethread());
 this->connection_state.release_stream(nullptr);
   }
+
+  this->clear_session_active();
 }
 
 void
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index e1e4c53..a62d386 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1184,26 +1184,28 @@ Http2ConnectionState::release_stream(Http2Stream 
*stream)
   return;
 }
 
-// If the number of clients is 0 and ua_session is active, then mark the 
connection as inactive
-if (total_client_streams_count == 0 && ua_session->is_active()) {
-  ua_session->clear_session_active();
-  UnixNetVConnection *vc = static_cast(ua_session->get_netvc());
-  if (vc) {
-vc->cancel_active_timeout();
-vc->add_to_keep_alive_queue();
+if (total_client_streams_count == 0) {
+  if (fini_received) {
+// We were shutting down, go ahead and terminate the session
+// this is a member of Http2ConnectionState and will be freed
+// when ua_session is destroyed
+ua_session->destroy();
+
+// Can't do this because we just destroyed right here ^,
+// or we can use a local variable to do it.
+// ua_session = nullptr;
+  } else if (ua_session->is_active()) {
+// If the number of clients is 0, HTTP2_SESSION_EVENT_FINI is not 
received or sent, and ua_session is active,
+// then mark the connection as inactive
+ua_session->clear_session_active();
+UnixNetVConnection *vc = static_cast(ua_session->get_netvc());
+if (vc) {
+  vc->cancel_active_timeout();
+  // With heavy traffic, ua_session could be destroyed. Do not touch 
ua_session after this.
+  vc->add_to_keep_alive_queue();
+}
   }
 }
-
-if (fini_received && total_client_streams_count == 0) {
-  // We were shutting down, go ahead and terminate the session
-  // this is a member of Http2ConnectionState and will be freed
-  // when ua_session is destroyed
-  ua_session->destroy();
-
-  // Can't do this because we just destroyed right here ^,
-  // or we can use a local variable to do it.
-  // ua_session = nullptr;
-}
   }
 }
 



[trafficserver] branch 7.1.x updated: Use one setting for H2 consistently for header size limit on H2 connections

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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
 new a446987  Use one setting for H2 consistently for header size limit on 
H2 connections
a446987 is described below

commit a4469875f570a894998084e7c5a0f19e072e0159
Author: Masakazu Kitajo 
AuthorDate: Wed Jan 30 22:21:57 2019 +0900

Use one setting for H2 consistently for header size limit on H2 connections

There were two settings, "proxy.config.http.request_header_max_size" and
"proxy.config.http2.max_header_list_size", for the same purpose.

(cherry picked from commit 4f3b3c3b365737826d883784f9e33b7d287a1ee3)
---
 mgmt/RecordsConfig.cc   | 2 +-
 proxy/http2/HTTP2.cc| 4 +---
 proxy/http2/HTTP2.h | 1 -
 proxy/http2/Http2ConnectionState.cc | 4 ++--
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 6dc16f8..4d0f27b 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1428,7 +1428,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.header_table_size", RECD_INT, "4096", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http2.max_header_list_size", RECD_INT, 
"4294967295", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http2.max_header_list_size", RECD_INT, "131072", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http2.accept_no_activity_timeout", RECD_INT, 
"120", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 85c10b5..7d949e9 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -613,7 +613,7 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t 
*buf_start, const uint32_
   const char *value;
   int len;
   bool is_trailing_header = trailing_header;
-  int64_t result = hpack_decode_header_block(handle, hdr, buf_start, buf_len, 
Http2::max_request_header_size, maximum_table_size);
+  int64_t result = hpack_decode_header_block(handle, hdr, buf_start, buf_len, 
Http2::max_header_list_size, maximum_table_size);
 
   if (result < 0) {
 if (result == HPACK_ERROR_COMPRESSION_ERROR) {
@@ -725,7 +725,6 @@ uint32_t Http2::initial_window_size= 1048576;
 uint32_t Http2::max_frame_size = 16384;
 uint32_t Http2::header_table_size  = 4096;
 uint32_t Http2::max_header_list_size   = 4294967295;
-uint32_t Http2::max_request_header_size= 131072;
 uint32_t Http2::accept_no_activity_timeout = 120;
 uint32_t Http2::no_activity_timeout_in = 120;
 uint32_t Http2::active_timeout_in  = 0;
@@ -742,7 +741,6 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(max_frame_size, 
"proxy.config.http2.max_frame_size");
   REC_EstablishStaticConfigInt32U(header_table_size, 
"proxy.config.http2.header_table_size");
   REC_EstablishStaticConfigInt32U(max_header_list_size, 
"proxy.config.http2.max_header_list_size");
-  REC_EstablishStaticConfigInt32U(max_request_header_size, 
"proxy.config.http.request_header_max_size");
   REC_EstablishStaticConfigInt32U(accept_no_activity_timeout, 
"proxy.config.http2.accept_no_activity_timeout");
   REC_EstablishStaticConfigInt32U(no_activity_timeout_in, 
"proxy.config.http2.no_activity_timeout_in");
   REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index bc8d338..9d94e4f 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -372,7 +372,6 @@ public:
   static uint32_t max_frame_size;
   static uint32_t header_table_size;
   static uint32_t max_header_list_size;
-  static uint32_t max_request_header_size;
   static uint32_t accept_no_activity_timeout;
   static uint32_t no_activity_timeout_in;
   static uint32_t active_timeout_in;
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index dd93558..e1e4c53 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -228,7 +228,7 @@ rcv_headers_frame(Http2ConnectionState &cstate, const 
Http2Frame &frame)
 
   // keep track of how many bytes we get in the frame
   stream->request_header_length += payload_length;
-  if (stream->request_header_length > Http2::max_request_header_size) {
+  if (stream->request_header_length > Http2::max_header_list_size) {
 return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
   "recv headers payload for headers greater than header 
length");
   }
@@ -780,7 +780,7 @@ rcv_continuation_frame(Http2ConnectionState &cstate, const 
Http2Frame &frame)
 
   // keep track of how many bytes w

[trafficserver] branch 8.0.x updated: Updated CHANGELOG

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new b1c3b76  Updated CHANGELOG
b1c3b76 is described below

commit b1c3b763f3e4d912ccd81ceb7eee7ac5a4efede4
Author: Leif Hedstrom 
AuthorDate: Mon Feb 11 14:28:45 2019 -0700

Updated CHANGELOG
---
 CHANGELOG-8.0.3 | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/CHANGELOG-8.0.3 b/CHANGELOG-8.0.3
index 4c8acd0..6a71e0f 100644
--- a/CHANGELOG-8.0.3
+++ b/CHANGELOG-8.0.3
@@ -3,11 +3,16 @@ Changes with Apache Traffic Server 8.0.3
   #4279 - Ensure NOFILES ulimit is set high
   #4297 - Don't update records.config when other configs are reloaded
   #4311 - Fix typo of the nofiles ulimit to a sane number
+  #4354 - Fix logging log file roll issue (#2544).
   #4420 - Removes this unused old/duplicated define
   #4528 - Removes ref-counting from background_fetch
   #4550 - Doc: Describe parent weight and format
   #4552 - Print error message for unimplemented commands
+  #4554 - Make autests friendlier with openssl 1.1.1
+  #4558 - Ignore the entire doc/_build directory that is generated
   #4560 - Add the TLSv1_3 setting to disable TLSv1_3
+  #4572 - Fixes another memory leak related to OCSP
+  #4574 - Allows the use of certs with no commonName, but with subjectAltNames
   #4577 - Doc: change code snippet highlighting scheme
   #4581 - Doc: Add missing overrides and sort
   #4587 - Remove unused code
@@ -15,24 +20,30 @@ Changes with Apache Traffic Server 8.0.3
   #4592 - Doc: sort overrides in table; remove missing references
   #4595 - Doc: getting started case shouldn't used regex_remap
   #4599 - Doc: Remove pipeline references
+  #4601 - Update logging.yaml documentation
   #4602 - New ScheduleOn APIs
   #4610 - Doc: parent config has more features than balancer plugin
   #4619 - Doc: cache.config isn't a substitute for Cache-Control
   #4620 - Doc: removing stale while revalidate plugin doc (marked deprecated 
in 7)
   #4653 - Remove ssl.enable flag
   #4654 - Changes external links to internal
+  #4678 - Prevent linking everything against brotli
+  #4682 - Finish the config removal started in #4653
   #4685 - Cleans up some plugin READMEs
   #4693 - Remove ignoring unused variable warning from webp plugin
   #4731 - Acquire a lock before checking H2ConnectionState::ua_session
   #4732 - Make H2 stream counters atomic
+  #4757 - Add missing manpages to build list
   #4759 - Fixes Clang-Analyzer issue of H2 Dependence Tree
   #4773 - Calls SSL child config callback after cert is loaded for both key 
parts
   #4774 - Fixed clang 5.0.0 issue with brace initialization
   #4780 - Don't allow the old body to be used when refreshing
   #4792 - Validates return values from TSHttpTxnClientAddrGet()
+  #4797 - Eliminates frequent librecords lookup
   #4807 - Allows to run make clean multiple times
   #4810 - Fixes unmatched port when looking up HostDB
   #4811 - Changes the string_view::length to ::size
+  #4812 - Add ifdef so tls test client will compile on non-openssl-1.1.x
   #4820 - Eliminates expensive librecords and malloc on drain
   #4842 - Doc: minor records.config cleaning
   #4845 - Initialize redir_len, compiler warnings



[trafficserver] branch 8.0.x updated (5b8d1d6 -> bcf457f)

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

zwoop pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from 5b8d1d6  Add missing manpages to build list
 new 34856e4  Make autests friendlier with openssl 1.1.1
 new bcf457f  Add ifdef so tls test client will compile on non-openssl-1.1.x

The 11173 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 tests/gold_tests/headers/forwarded.gold  | 6 +++---
 tests/gold_tests/headers/via.gold| 6 +++---
 tests/gold_tests/redirect/gold/redirect.gold | 1 +
 tests/gold_tests/tls/ssl-post.c  | 7 +++
 tests/gold_tests/tls/tls.test.py | 5 +++--
 tests/gold_tests/tls/tls_ticket.test.py  | 4 ++--
 6 files changed, 19 insertions(+), 10 deletions(-)



[trafficserver] branch 8.0.x updated: Add missing manpages to build list

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 5b8d1d6  Add missing manpages to build list
5b8d1d6 is described below

commit 5b8d1d618c280b5c67612ecc744518cf8fb2fd39
Author: Jean Baptiste Favre 
AuthorDate: Mon Jan 7 10:38:19 2019 +0100

Add missing manpages to build list

(cherry picked from commit 3f753bed168ad925639dfce349056e4bde20c635)
---
 doc/manpages.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/manpages.py b/doc/manpages.py
index 8a48500..97f90e3 100644
--- a/doc/manpages.py
+++ b/doc/manpages.py
@@ -33,6 +33,9 @@ man_pages = [
 ('appendices/command-line/traffic_top.en', 'traffic_top', u'Display 
Traffic Server statistics', None, '1'),
 ('appendices/command-line/tsxs.en', 'tsxs', u'Traffic Server plugin tool', 
None, '1'),
 ('appendices/command-line/traffic_via.en', 'traffic_via', u'Traffic Server 
Via header decoder', None, '1'),
+('appendices/command-line/traffic_layout.en', 'traffic_layout', u'Traffic 
Server sandbox management tool', None, '1'),
+('appendices/command-line/traffic_cache_tool.en', 'traffic_cache_tool', 
u'Traffic Server cache management tool', None, '1'),
+('appendices/command-line/traffic_wccp.en', 'traffic_wccp', u'Traffic 
Server WCCP client', None, '1'),
 
 ('admin-guide/files/cache.config.en', 'cache.config', u'Traffic Server 
cache configuration file', None, '5'),
 ('admin-guide/files/hosting.config.en', 'hosting.config', u'Traffic Server 
domain hosting configuration file', None, '5'),



[trafficserver] branch 8.0.x updated: Update logging.yaml documentation

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 60f4a00  Update logging.yaml documentation
60f4a00 is described below

commit 60f4a0065a88c86f80db358b525cd6c40e51369b
Author: Emanuele Rocca 
AuthorDate: Tue Nov 13 13:58:31 2018 +0100

Update logging.yaml documentation

The current logging.yaml documentation still describes the old Lua
format in various parts. Update it to reflect the YAML format and remove
mentions to wipe filters, broken on 8.x.

(cherry picked from commit d41bbedc515290969f35cab37abecf826744382c)
---
 doc/admin-guide/files/logging.yaml.en.rst | 114 ++
 1 file changed, 38 insertions(+), 76 deletions(-)

diff --git a/doc/admin-guide/files/logging.yaml.en.rst 
b/doc/admin-guide/files/logging.yaml.en.rst
index 670a492..d4525c1 100644
--- a/doc/admin-guide/files/logging.yaml.en.rst
+++ b/doc/admin-guide/files/logging.yaml.en.rst
@@ -23,14 +23,15 @@ logging.yaml
 **
 
 The :file:`logging.yaml` file defines all custom log file formats, filters,
-and processing options. The file itself is a Lua script.
+and processing options.
 
 .. important::
 
-   This configuration file replaces the XML based logs_xml.config from past
-   |TS| releases. If you are upgrading from a |TS| release which used that
-   configuration file, and you have created custom log formats, filters, and
-   destinations, you will need to update those settings to this format.
+   This configuration file replaces the XML based logs_xml.config, as well as
+   the Lua based logging.config from past |TS| releases. If you are upgrading
+   from a |TS| release which used either the XML or the Lua configuration file
+   format, and you have created custom log formats, filters, and destinations,
+   you will need to update those settings to this format.
 
 .. _admin-custom-logs:
 
@@ -62,11 +63,10 @@ format. Which approach you use is entirely up to you, 
though it's strongly
 recommended to create an explicit format object if you intend to reuse the same
 format for multiple log files.
 
-To create a format object, store the result of the ``format`` function in a
-variable. The function takes a table with two attributes: a mandatory string
-``Format`` which defines the output format string for every event; and an
-optional number ``Interval`` defining the aggregation interval for summary
-logs.
+Custom formats are defined by choosing a ``name`` to identify the given logging
+format, and a ``format`` string, which defines the output format string for
+every event. An optional ``interval`` attribute can be specified to define the
+aggregation interval for summary logs.
 
 .. code:: yaml
 
@@ -89,8 +89,8 @@ desire.
 Format Specification
 
 
-The format specification provided as the required ``Format`` entry of the table
-passed to the format function is a simple string, containing whatever mixture
+The format specification provided as the required ``format`` attribute of the
+objects listed in ``formats`` is a simple string, containing whatever mixture
 of logging field variables and literal characters meet your needs. Logging
 fields are discussed in great detail in the :ref:`admin-logging-fields`
 section.
@@ -142,7 +142,7 @@ You will find a complete listing of the available fields in
 Aggregation Interval
 
 
-Every format may be given an optional ``Interval`` value, specified as the
+Every format may be given an optional ``interval`` value, specified as the
 number of seconds over which events destined for a log using the format are
 aggregated and summarized. Logs which use formats containing an aggregation
 interval do not behave like regular logs, with a single line for every event.
@@ -159,29 +159,26 @@ given one.
 Filters
 ---
 
-Filters may be used, optionally, to accept or reject logging for matching
-events, or to scrub the values of individual fields from logging output (while
-retaining other information; useful for ensuring that sensitive information
-cannot inadvertently make it into log files).
+Two different type of filters are available: ``accept`` and ``reject``.  They
+may be used, optionally, to accept or reject logging for matching events.
 
-Filter objects are created by calling one of the following functions:
+Filter objects are created by assigning them a ``name`` to be used later to
+refer to the filter, as well as an ``action`` (either ``accept`` or
+``reject``). ``Accept`` and ``reject`` filters require a ``condition`` against
+which to match all events. The ``condition`` fields must be in the following
+format::
 
-filter.accept(string)
-Creates a filter object which accepts events for logging which match the
-rule specified in ``string``. Note that you may only have one accept 
filter.

[trafficserver] branch 8.0.x updated: Allows the use of certs with no commonName, but with subjectAltNames

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 00f66f5  Allows the use of certs with no commonName, but with 
subjectAltNames
00f66f5 is described below

commit 00f66f5186d6993b1f190cbdf6a23c88a232064f
Author: Randall Meyer 
AuthorDate: Wed Nov 7 14:26:32 2018 -0800

Allows the use of certs with no commonName, but with subjectAltNames

(cherry picked from commit 458fdb634211801a59de27d284c729c2f84a6e50)
---
 iocore/net/SSLUtils.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 67aea04..6b9d8c0 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -1486,7 +1486,7 @@ ssl_index_certificate(SSLCertLookup *lookup, 
SSLCertContext const &cc, X509 *cer
   if (name->type == GEN_DNS) {
 ats_scoped_str dns(asn1_strdup(name->d.dNSName));
 // only try to insert if the alternate name is not the main name
-if (strcmp(dns, subj_name) != 0) {
+if (subj_name == nullptr || strcmp(dns, subj_name) != 0) {
   Debug("ssl", "mapping '%s' to certificates %s", (const char *)dns, 
certname);
   if (lookup->insert(dns, cc) >= 0) {
 inserted = true;



[trafficserver] branch 8.0.x updated (33a8ec9 -> 64b4217)

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

zwoop pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from 33a8ec9  Updated CHANGELOG
 new 67975d6  Fix logging log file roll issue (#2544).
 new 2bf380a  Prevent linking everything against brotli
 new 2ff94f7  Fixes another memory leak related to OCSP
 new e336a27  Ignore the entire doc/_build directory that is generated
 new 64b4217  Finish the config removal started in #4653

The 11168 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore|  3 +--
 build/brotli.m4   |  2 +-
 iocore/net/OCSPStapling.cc|  5 -
 lib/perl/lib/Apache/TS/AdminClient.pm |  1 -
 proxy/logging/LogFile.cc  | 15 ++-
 5 files changed, 20 insertions(+), 6 deletions(-)



[trafficserver] branch 8.0.x updated: Updated CHANGELOG

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 33a8ec9  Updated CHANGELOG
33a8ec9 is described below

commit 33a8ec9ba8a201068f09787dcb6bf14e29b98fad
Author: Leif Hedstrom 
AuthorDate: Mon Feb 11 13:34:44 2019 -0700

Updated CHANGELOG
---
 CHANGELOG-8.0.3 | 8 
 1 file changed, 8 insertions(+)

diff --git a/CHANGELOG-8.0.3 b/CHANGELOG-8.0.3
index 5859375..4c8acd0 100644
--- a/CHANGELOG-8.0.3
+++ b/CHANGELOG-8.0.3
@@ -3,9 +3,11 @@ Changes with Apache Traffic Server 8.0.3
   #4279 - Ensure NOFILES ulimit is set high
   #4297 - Don't update records.config when other configs are reloaded
   #4311 - Fix typo of the nofiles ulimit to a sane number
+  #4420 - Removes this unused old/duplicated define
   #4528 - Removes ref-counting from background_fetch
   #4550 - Doc: Describe parent weight and format
   #4552 - Print error message for unimplemented commands
+  #4560 - Add the TLSv1_3 setting to disable TLSv1_3
   #4577 - Doc: change code snippet highlighting scheme
   #4581 - Doc: Add missing overrides and sort
   #4587 - Remove unused code
@@ -25,12 +27,18 @@ Changes with Apache Traffic Server 8.0.3
   #4732 - Make H2 stream counters atomic
   #4759 - Fixes Clang-Analyzer issue of H2 Dependence Tree
   #4773 - Calls SSL child config callback after cert is loaded for both key 
parts
+  #4774 - Fixed clang 5.0.0 issue with brace initialization
   #4780 - Don't allow the old body to be used when refreshing
   #4792 - Validates return values from TSHttpTxnClientAddrGet()
   #4807 - Allows to run make clean multiple times
+  #4810 - Fixes unmatched port when looking up HostDB
+  #4811 - Changes the string_view::length to ::size
+  #4820 - Eliminates expensive librecords and malloc on drain
   #4842 - Doc: minor records.config cleaning
   #4845 - Initialize redir_len, compiler warnings
   #4853 - Various fixes and improvements to background_fetch
   #4885 - Content Length can be trusted when the origin server returns a 304
   #4892 - Use one setting for H2 consistently for header size limit on H2 
connections
+  #4918 - Runroot: make traffic_top use runroot
+  #4936 - Mark H2 connection inactive only if it is NOT shutting down
   #4943 - Fix to allow runroot to override the configuration directory



[trafficserver] branch 8.0.x updated: Removes this unused old/duplicated define

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 6d4f3b7  Removes this unused old/duplicated define
6d4f3b7 is described below

commit 6d4f3b74d749f5e08088933bb626d0dcdb77af5f
Author: Leif Hedstrom 
AuthorDate: Tue Oct 16 14:04:04 2018 -0600

Removes this unused old/duplicated define

(cherry picked from commit 867d9c8527117ba0ac61fc2e282741e720b78cf8)
---
 include/tscore/Diags.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/include/tscore/Diags.h b/include/tscore/Diags.h
index 55d3857..f68cce8 100644
--- a/include/tscore/Diags.h
+++ b/include/tscore/Diags.h
@@ -330,14 +330,6 @@ extern inkcoreapi Diags *diags;
 }  \
   } while (0)
 
-#define DiagSpecific(flag, tag, ...)   
   \
-  do { 
   \
-if (unlikely(diags->on())) {   
   \
-  const SourceLocation loc = MakeSourceLocation(); 
   \
-  flag ? diags->print(tag, DL_Diag, &loc, __VA_ARGS__) : diags->log(tag, 
DL_Diag, &loc, __VA_ARGS__); \
-}  
   \
-  } while (0)
-
 #define SpecificDebug(flag, tag, ...)  
 \
   do { 
 \
 if (unlikely(diags->on())) {   
 \
@@ -356,7 +348,6 @@ extern inkcoreapi Diags *diags;
 
 #define Diag(tag, fmt, ...)
 #define Debug(tag, fmt, ...)
-#define DiagSpecific(flag, tag, ...)
 #define SpecificDebug(flag, tag, ...)
 
 #define is_debug_tag_set(_t) 0



[trafficserver] branch 8.0.x updated (467959f -> 3f6847e)

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

zwoop pushed a change to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from 467959f  Eliminates expensive librecords and malloc on drain
 new 5f3f56e  Eliminates frequent librecords lookup
 new 421de25  Changes the string_view::length to ::size
 new 3f6847e  Add the TLSv1_3 setting to disable TLSv1_3

The 11161 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/admin-guide/files/records.config.en.rst  |  8 +++
 iocore/net/I_Net.h   |  3 +++
 iocore/net/Net.cc| 18 ++
 iocore/net/P_UnixNetVConnection.h| 35 
 iocore/net/SSLConfig.cc  | 11 +
 iocore/net/UnixNetVConnection.cc | 30 
 mgmt/RecordsConfig.cc|  8 +--
 tests/gold_tests/tls_hooks/tls_hooks.test.py |  4 +++-
 8 files changed, 79 insertions(+), 38 deletions(-)



[trafficserver] branch 8.0.x updated: Eliminates expensive librecords and malloc on drain

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 467959f  Eliminates expensive librecords and malloc on drain
467959f is described below

commit 467959f8358fbd317fed8a9360bd10c51ffd42ca
Author: Leif Hedstrom 
AuthorDate: Wed Jan 16 18:46:33 2019 -0700

Eliminates expensive librecords and malloc on drain

(cherry picked from commit d9e01f278424e1b520fa8b805dcc1008d838361d)
---
 proxy/ProxyClientSession.h   | 9 -
 src/traffic_server/traffic_server.cc | 8 ++--
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/proxy/ProxyClientSession.h b/proxy/ProxyClientSession.h
index 98e2e12..05e3564 100644
--- a/proxy/ProxyClientSession.h
+++ b/proxy/ProxyClientSession.h
@@ -69,6 +69,9 @@ struct ProxyError {
   uint32_t code   = 0;
 };
 
+// A little ugly, but this global is tracked by traffic_server.
+extern bool ts_is_draining;
+
 class ProxyClientSession : public VConnection
 {
 public:
@@ -153,11 +156,7 @@ public:
   bool
   is_draining() const
   {
-RecInt draining;
-if (RecGetRecordInt("proxy.node.config.draining", &draining) != 
REC_ERR_OKAY) {
-  return false;
-}
-return draining != 0;
+return ts_is_draining;
   }
 
   // Initiate an API hook invocation.
diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index f9006b4..26fb015 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -170,6 +170,9 @@ static bool signal_received[NSIG];
 // -1: cache is already initialized, don't delay.
 static int delay_listen_for_cache_p;
 
+// Keeps track if the server is in draining state, follows the 
proxy.node.config.draining metric
+bool ts_is_draining = false;
+
 AppVersionInfo appVersionInfo; // Build info for this application
 
 static ArgumentDescription argument_descriptions[] = {
@@ -279,6 +282,7 @@ public:
   RecInt timeout = 0;
   if (RecGetRecordInt("proxy.config.stop.shutdown_timeout", &timeout) == 
REC_ERR_OKAY && timeout) {
 RecSetRecordInt("proxy.node.config.draining", 1, REC_SOURCE_DEFAULT);
+ts_is_draining = true;
 if (!remote_management_flag) {
   // Close listening sockets here only if TS is running standalone
   RecInt close_sockets = 0;
@@ -2036,8 +2040,8 @@ mgmt_restart_shutdown_callback(void *, char *, int /* 
data_len ATS_UNUSED */)
 static void *
 mgmt_drain_callback(void *, char *arg, int len)
 {
-  ink_assert(len > 1 && (arg[0] == '0' || arg[0] == '1'));
-  RecSetRecordInt("proxy.node.config.draining", arg[0] == '1', 
REC_SOURCE_DEFAULT);
+  ts_is_draining = (len == 2 && arg[0] == '1');
+  RecSetRecordInt("proxy.node.config.draining", ts_is_draining ? 1 : 0, 
REC_SOURCE_DEFAULT);
   return nullptr;
 }
 



[trafficserver] branch 8.0.x updated: Fixes unmatched port when looking up HostDB

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 6df3cf0  Fixes unmatched port when looking up HostDB
6df3cf0 is described below

commit 6df3cf009327f6a1ae77c5627ba85cf087c3ffa8
Author: scw00 
AuthorDate: Wed Jan 16 15:01:40 2019 +0800

Fixes unmatched port when looking up HostDB

(cherry picked from commit 646b2d9802202dee850f52a177bb6f6ef870c65b)
---
 proxy/http/HttpSM.cc | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 465e9d6..ccc2d01 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4031,10 +4031,14 @@ HttpSM::do_hostdb_lookup()
 
 // If there is not a current server, we must be looking up the origin
 //  server at the beginning of the transaction
-int server_port = t_state.current.server ?
-t_state.current.server->dst_addr.host_order_port() :
-t_state.server_info.dst_addr.isValid() ? 
t_state.server_info.dst_addr.host_order_port() :
- 
t_state.hdr_info.client_request.port_get();
+int server_port = 0;
+if (t_state.current.server && t_state.current.server->dst_addr.isValid()) {
+  server_port = t_state.current.server->dst_addr.host_order_port();
+} else if (t_state.server_info.dst_addr.isValid()) {
+  server_port = t_state.server_info.dst_addr.host_order_port();
+} else {
+  server_port = t_state.hdr_info.client_request.port_get();
+}
 
 if (t_state.api_txn_dns_timeout_value != -1) {
   SMDebug("http_timeout", "beginning DNS lookup. allowing %d mseconds for 
DNS lookup", t_state.api_txn_dns_timeout_value);



[trafficserver] branch 8.0.x updated: Mark H2 connection inactive only if it is NOT shutting down

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

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


The following commit(s) were added to refs/heads/8.0.x by this push:
 new 6ae6ff2  Mark H2 connection inactive only if it is NOT shutting down
6ae6ff2 is described below

commit 6ae6ff202a664e0e5cf296a930c8697e633601ee
Author: Masaori Koshiba 
AuthorDate: Wed Feb 6 15:45:53 2019 +0900

Mark H2 connection inactive only if it is NOT shutting down

Prior this change, HTTP/2 connection is marked as inactive regardless it is 
shutting down or not.

(cherry picked from commit a4227747277759c27c63ba948d96fbd6204dc8db)
---
 proxy/http2/Http2ClientSession.cc   |  2 ++
 proxy/http2/Http2ConnectionState.cc | 18 ++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 18b671e..7250c9b 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -275,6 +275,8 @@ Http2ClientSession::do_io_close(int alerrno)
 SCOPED_MUTEX_LOCK(lock, this->connection_state.mutex, this_ethread());
 this->connection_state.release_stream(nullptr);
   }
+
+  this->clear_session_active();
 }
 
 void
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 2587a89..37c35e2 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1245,14 +1245,7 @@ Http2ConnectionState::release_stream(Http2Stream *stream)
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
   if (this->ua_session) {
 ink_assert(this->mutex == ua_session->mutex);
-// If the number of clients is 0 and ua_session is active, then mark the 
connection as inactive
-if (total_client_streams_count == 0 && ua_session->is_active()) {
-  ua_session->clear_session_active();
-  UnixNetVConnection *vc = static_cast(ua_session->get_netvc());
-  if (vc && vc->active_timeout_in == 0) {
-vc->add_to_keep_alive_queue();
-  }
-}
+
 if (total_client_streams_count == 0) {
   if (fini_received) {
 // We were shutting down, go ahead and terminate the session
@@ -1265,6 +1258,15 @@ Http2ConnectionState::release_stream(Http2Stream *stream)
 // ua_session = nullptr;
   } else if (shutdown_state == HTTP2_SHUTDOWN_IN_PROGRESS && fini_event == 
nullptr) {
 fini_event = this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+  } else if (ua_session->is_active()) {
+// If the number of clients is 0, HTTP2_SESSION_EVENT_FINI is not 
received or sent, and ua_session is active,
+// then mark the connection as inactive
+ua_session->clear_session_active();
+UnixNetVConnection *vc = static_cast(ua_session->get_netvc());
+if (vc && vc->active_timeout_in == 0) {
+  // With heavy traffic, ua_session could be destroyed. Do not touch 
ua_session after this.
+  vc->add_to_keep_alive_queue();
+}
   } else {
 schedule_zombie_event();
   }



[trafficserver] branch master updated: ssl handshake fix

2019-02-11 Thread duke8253
This is an automated email from the ASF dual-hosted git repository.

duke8253 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 059e92a  ssl handshake fix
059e92a is described below

commit 059e92a2a717a6d44fe553c82f8faf83ca7bcace
Author: Fei Deng 
AuthorDate: Fri Feb 8 14:26:32 2019 -0600

ssl handshake fix
---
 iocore/net/SSLNetVConnection.cc  | 7 +++
 src/traffic_server/traffic_server.cc | 5 +
 2 files changed, 12 insertions(+)

diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 86cc813..14712ee 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -73,6 +73,8 @@ void SSL_set0_rbio(SSL *ssl, BIO *rbio);
 
 ClassAllocator sslNetVCAllocator("sslNetVCAllocator");
 
+bool stop_ssl_handshake = false;
+
 namespace
 {
 /// Callback to get two locks.
@@ -937,9 +939,14 @@ SSLNetVConnection::free(EThread *t)
 THREAD_FREE(this, sslNetVCAllocator, t);
   }
 }
+
 int
 SSLNetVConnection::sslStartHandShake(int event, int &err)
 {
+  if (stop_ssl_handshake) {
+Debug("ssl", "Stopping handshake due to server shutting down.");
+return EVENT_ERROR;
+  }
   if (sslHandshakeBeginTime == 0) {
 sslHandshakeBeginTime = Thread::get_hrtime();
 // net_activity will not be triggered until after the handshake
diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index 712328b..2b9eaaa 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -173,6 +173,9 @@ static int delay_listen_for_cache_p;
 // Keeps track if the server is in draining state, follows the 
proxy.node.config.draining metric
 bool ts_is_draining = false;
 
+// Flag to stop ssl handshakes during shutdown.
+extern bool stop_ssl_handshake;
+
 AppVersionInfo appVersionInfo; // Build info for this application
 
 static ArgumentDescription argument_descriptions[] = {
@@ -222,6 +225,8 @@ struct AutoStopCont : public Continuation {
   int
   mainEvent(int /* event */, Event * /* e */)
   {
+stop_ssl_handshake = true;
+
 APIHook *hook = lifecycle_hooks->get(TS_LIFECYCLE_SHUTDOWN_HOOK);
 while (hook) {
   SCOPED_MUTEX_LOCK(lock, hook->m_cont->mutex, this_ethread());



[trafficserver] branch master updated: Add doc for using relative path to configuration directory for lua script

2019-02-11 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan 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 7a81609  Add doc for using relative path to configuration directory 
for lua script
7a81609 is described below

commit 7a81609082ce887e754bfc358c5654d4045077b6
Author: Kit Chan 
AuthorDate: Sun Feb 10 23:28:21 2019 -0800

Add doc for using relative path to configuration directory for lua script
---
 doc/admin-guide/plugins/lua.en.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/admin-guide/plugins/lua.en.rst 
b/doc/admin-guide/plugins/lua.en.rst
index 624056d..c955b81 100644
--- a/doc/admin-guide/plugins/lua.en.rst
+++ b/doc/admin-guide/plugins/lua.en.rst
@@ -80,7 +80,8 @@ Configuration
 =
 
 This module acts as remap plugin of Traffic Server, so we should realize 
'do_remap' or 'do_os_response' function in each
-lua script. We can write this in remap.config:
+lua script. The path referencing a file with the lua script can be relative to 
the configuration directory or an absolute
+path. We can write this in remap.config:
 
 ::
 



[trafficserver] branch master updated: Optimize: Keep cont->mutex locked, during probe the bucket by hash object within HostDBProcessor::getby

2019-02-11 Thread oknet
This is an automated email from the ASF dual-hosted git repository.

oknet 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 34dcdb2  Optimize: Keep cont->mutex locked, during probe the bucket by 
hash object within HostDBProcessor::getby
34dcdb2 is described below

commit 34dcdb278b92b04f2c19f1cd3a48f94c8ae65dfb
Author: Oknet Xu 
AuthorDate: Sat Feb 2 19:13:33 2019 +0800

Optimize: Keep cont->mutex locked, during probe the bucket by hash object 
within HostDBProcessor::getby
---
 iocore/hostdb/HostDB.cc | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index dd80c58..fbf410c 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -634,19 +634,18 @@ HostDBProcessor::getby(Continuation *cont, const char 
*hostname, int len, sockad
   // Attempt to find the result in-line, for level 1 hits
   //
   if (!aforce_dns) {
-bool loop;
-do {
+MUTEX_TRY_LOCK(lock, cont->mutex, thread);
+bool loop = lock.is_locked();
+while (loop) {
   loop = false; // Only loop on explicit set for retry.
   // find the partition lock
   //
-  // TODO: Could we reuse the "mutex" above safely? I think so but not 
sure.
-  Ptr bmutex = 
hostDB.refcountcache->lock_for_key(hash.hash.fold());
-  MUTEX_TRY_LOCK(lock, bmutex, thread);
-  MUTEX_TRY_LOCK(lock2, cont->mutex, thread);
+  Ptr bucket_mutex = 
hostDB.refcountcache->lock_for_key(hash.hash.fold());
+  MUTEX_TRY_LOCK(lock2, bucket_mutex, thread);
 
-  if (lock.is_locked() && lock2.is_locked()) {
+  if (lock2.is_locked()) {
 // If we can get the lock and a level 1 probe succeeds, return
-Ptr r = probe(bmutex, hash, aforce_dns);
+Ptr r = probe(bucket_mutex, hash, aforce_dns);
 if (r) {
   if (r->is_failed() && hostname) {
 loop = check_for_retry(hash.db_mark, host_res_style);
@@ -662,7 +661,7 @@ HostDBProcessor::getby(Continuation *cont, const char 
*hostname, int len, sockad
   hash.refresh(); // only on reloop, because we've changed the family.
 }
   }
-} while (loop);
+}
   }
   Debug("hostdb", "delaying force %d answer for %s", aforce_dns,
 hostname ? hostname : ats_is_ip(ip) ? ats_ip_ntop(ip, ipb, sizeof ipb) 
: "");