trafficserver git commit: [TS-3835]: Make open_write_fail_action setting overridable. Also, do not apply the setting for 3xx redirect follow.

2015-08-12 Thread sudheerv
Repository: trafficserver
Updated Branches:
  refs/heads/master b2006b44f - e381073bd


[TS-3835]: Make open_write_fail_action setting overridable.
Also, do not apply the setting for 3xx redirect follow.


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

Branch: refs/heads/master
Commit: e381073bd1108b3324c6210ceff2f16f764f7d2e
Parents: b2006b4
Author: Sudheer Vinukonda sudhe...@yahoo-inc.com
Authored: Thu Aug 13 00:19:58 2015 +
Committer: Sudheer Vinukonda sudhe...@yahoo-inc.com
Committed: Thu Aug 13 00:19:58 2015 +

--
 proxy/InkAPI.cc  |  8 
 proxy/http/HttpConfig.cc |  4 ++--
 proxy/http/HttpConfig.h  |  7 +++
 proxy/http/HttpSM.cc | 10 --
 4 files changed, 21 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/InkAPI.cc
--
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index f634d52..4f84612 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7891,6 +7891,10 @@ _conf_to_memberp(TSOverridableConfigKey conf, 
OverridableHttpConfigParams *overr
 typ = OVERRIDABLE_TYPE_INT;
 ret = overridableHttpConfig-max_cache_open_read_retries;
 break;
+  case TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION:
+typ = OVERRIDABLE_TYPE_INT;
+ret = overridableHttpConfig-cache_open_write_fail_action;
+break;
   case TS_CONFIG_HTTP_CACHE_RANGE_WRITE:
 ret = overridableHttpConfig-cache_range_write;
 break;
@@ -8429,6 +8433,10 @@ TSHttpTxnConfigFind(const char *name, int length, 
TSOverridableConfigKey *conf,
   if (0 == strncmp(name, proxy.config.http.server_session_sharing.match, 
length))
 cnf = TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH;
   break;
+case 'n':
+  if (!strncmp(name, proxy.config.http.cache.open_write_fail_action, 
length))
+cnf = TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION;
+  break;
 }
 break;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/http/HttpConfig.cc
--
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index b467f2f..e45739c 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1046,7 +1046,7 @@ HttpConfig::startup()
   HttpEstablishStaticConfigByte(c.send_100_continue_response, 
proxy.config.http.send_100_continue_response);
   HttpEstablishStaticConfigByte(c.disallow_post_100_continue, 
proxy.config.http.disallow_post_100_continue);
   HttpEstablishStaticConfigByte(c.parser_allow_non_http, 
proxy.config.http.parse.allow_non_http);
-  HttpEstablishStaticConfigLongLong(c.cache_open_write_fail_action, 
proxy.config.http.cache.open_write_fail_action);
+  HttpEstablishStaticConfigLongLong(c.oride.cache_open_write_fail_action, 
proxy.config.http.cache.open_write_fail_action);
 
   HttpEstablishStaticConfigByte(c.oride.cache_when_to_revalidate, 
proxy.config.http.cache.when_to_revalidate);
   HttpEstablishStaticConfigByte(c.oride.cache_required_headers, 
proxy.config.http.cache.required_headers);
@@ -1308,7 +1308,7 @@ HttpConfig::reconfigure()
   params-send_100_continue_response = 
INT_TO_BOOL(m_master.send_100_continue_response);
   params-disallow_post_100_continue = 
INT_TO_BOOL(m_master.disallow_post_100_continue);
   params-parser_allow_non_http = INT_TO_BOOL(m_master.parser_allow_non_http);
-  params-cache_open_write_fail_action = m_master.cache_open_write_fail_action;
+  params-oride.cache_open_write_fail_action = 
m_master.oride.cache_open_write_fail_action;
 
   params-oride.cache_when_to_revalidate = 
m_master.oride.cache_when_to_revalidate;
   params-max_post_size = m_master.max_post_size;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e381073b/proxy/http/HttpConfig.h
--
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 1722f74..fbedf97 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -388,7 +388,7 @@ struct OverridableHttpConfigParams {
   // Strings / floats must come last
   body_factory_template_base(NULL), body_factory_template_base_len(0), 
proxy_response_server_string(NULL),
   proxy_response_server_string_len(0), global_user_agent_header(NULL), 
global_user_agent_header_size(0),
-  cache_heuristic_lm_factor(0.10), freshness_fuzz_prob(0.005), 
background_fill_threshold(0.5)
+  cache_heuristic_lm_factor(0.10), freshness_fuzz_prob(0.005), 
background_fill_threshold(0.5), cache_open_write_fail_action(0)
   {
   }
 
@@ 

trafficserver git commit: [TS-3835]: commit missed apidefs.in change with the new overridable setting.

2015-08-12 Thread sudheerv
Repository: trafficserver
Updated Branches:
  refs/heads/master e381073bd - b7f431406


[TS-3835]: commit missed apidefs.in change with the new overridable setting.


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

Branch: refs/heads/master
Commit: b7f4314069318c6f3b6ab9fd504e7f5525cbb96c
Parents: e381073
Author: Sudheer Vinukonda sudhe...@yahoo-inc.com
Authored: Thu Aug 13 00:27:39 2015 +
Committer: Sudheer Vinukonda sudhe...@yahoo-inc.com
Committed: Thu Aug 13 00:27:39 2015 +

--
 lib/ts/apidefs.h.in | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b7f43140/lib/ts/apidefs.h.in
--
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index 2237cfe..b6c4bb7 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -675,6 +675,7 @@ typedef enum {
   TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD,
   TS_CONFIG_HTTP_CACHE_GENERATION,
   TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE,
+  TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION,
   TS_CONFIG_LAST_ENTRY
 } TSOverridableConfigKey;
 



trafficserver git commit: Adding testcase for min origin connections

2015-08-12 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master b405bb333 - d2ba4f105


Adding testcase for min origin connections


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

Branch: refs/heads/master
Commit: d2ba4f1058f6b8ee0f310c74cfddf67fa8baa1f0
Parents: b405bb3
Author: Brian Geffon bri...@apache.org
Authored: Wed Aug 12 00:25:43 2015 -0700
Committer: Brian Geffon bri...@apache.org
Committed: Wed Aug 12 00:25:43 2015 -0700

--
 .../test_origin_min_keep_alive_connection.py| 103 +++
 1 file changed, 103 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d2ba4f10/ci/tsqa/tests/test_origin_min_keep_alive_connection.py
--
diff --git a/ci/tsqa/tests/test_origin_min_keep_alive_connection.py 
b/ci/tsqa/tests/test_origin_min_keep_alive_connection.py
new file mode 100644
index 000..741cd56
--- /dev/null
+++ b/ci/tsqa/tests/test_origin_min_keep_alive_connection.py
@@ -0,0 +1,103 @@
+'''
+Test the configure entry : proxy.config.http.origin_min_keep_alive_connections
+'''
+
+#  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.
+
+import os
+import requests
+import time
+import logging
+import SocketServer
+import uuid
+import socket
+import tsqa.test_cases
+import helpers
+import thread
+
+log = logging.getLogger(__name__)
+
+def simple_socket_server(host, port):
+log.info(starting the socket server)
+serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+serv.bind((host, port))
+serv.setblocking(1)
+serv.listen(3)
+conn_id = uuid.uuid4().hex
+while True:
+conn, addr = serv.accept()
+data = conn.recv(4096).strip()
+if data:
+log.info('Sending data back to the client: 
{uid}'.format(uid=conn_id))
+else:
+log.info('Client disconnected: 
{timeout}seconds'.format(timeout=now))
+break
+body = conn_id
+resp = ('HTTP/1.1 200 OK\r\n'
+'Content-Length: {content_length}\r\n'
+'Content-Type: text/html; charset=UTF-8\r\n'
+'Connection: keep-alive\r\n'
+'\r\n'
+'{body}'.format(content_length=len(body), body=body))
+conn.sendall(resp)
+serv.shutdown(socket.SHUT_RDWR)
+serv.close()
+log.info(end the socket server)
+
+
+class TestKeepAlive_Origin_Min_connections(helpers.EnvironmentCase):
+@classmethod
+def setUpEnv(cls, env):
+cls.traffic_server_host = '127.0.0.1'
+cls.traffic_server_port = 
int(cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+cls.socket_server_port = int(tsqa.utils.bind_unused_port()[1])
+log.info(socket_server_port = %d % (cls.socket_server_port))
+thread.start_new_thread(simple_socket_server, 
(cls.traffic_server_host, cls.socket_server_port, ))
+cls.configs['remap.config'].add_line('map / 
http://127.0.0.1:{0}'.format(cls.socket_server_port))
+cls.origin_keep_alive_timeout = 3
+
cls.configs['records.config']['CONFIG']['origin_min_keep_alive_connections'] = 
1 
+cls.configs['records.config']['CONFIG']['keep_alive_enabled_out'] = 1 
+
cls.configs['records.config']['CONFIG']['proxy.config.http.keep_alive_no_activity_timeout_out']
 = cls.origin_keep_alive_timeout
+
+def test_origin_min_connection(self):
+conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+conn.connect((self.traffic_server_host, self.traffic_server_port))
+request_content = 'GET / HTTP/1.1\r\nConnection: keep-alive\r\nHost: 
127.0.0.1\r\n\r\n'
+conn.setblocking(1)
+conn.send(request_content)
+first_resp = None
+second_resp = None
+while 1:
+try:
+resp = conn.recv(4096)
+

Re: trafficserver git commit: Coverity issues: making the sanity check calls useful!

2015-08-12 Thread James Peach
This has multiple, independent changes, so it should have been a series of 
separate commits. I think it is also worth referencing the Coverity CID (I 
assume that this fixes a number of them?)


 On Aug 11, 2015, at 2:18 PM, a...@apache.org wrote:
 
 Repository: trafficserver
 Updated Branches:
  refs/heads/master f65b867bd - 3d0d2564c
 
 
 Coverity issues: making the sanity check calls useful!
 
 
 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
 Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3d0d2564
 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3d0d2564
 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3d0d2564
 
 Branch: refs/heads/master
 Commit: 3d0d2564cc91bcb32174f1b8a61d903a30eda8b5
 Parents: f65b867
 Author: Syeda Persia Aziz persia.a...@yahoo.com
 Authored: Mon Jul 20 18:16:17 2015 -0500
 Committer: Alan M. Carroll a...@apache.org
 Committed: Tue Aug 11 16:00:59 2015 -0500
 
 --
 iocore/cache/RamCacheCLFUS.cc   |  2 +
 lib/atscppapi/src/Plugin.cc |  3 +-
 lib/ts/ParseRules.cc| 83 
 lib/ts/ParseRules.h |  2 -
 mgmt/Alarms.cc  |  1 +
 mgmt/LocalManager.cc|  2 +-
 mgmt/MultiFile.cc   |  1 +
 mgmt/api/EventCallback.cc   | 82 ++-
 .../stale_while_revalidate.c|  1 +
 proxy/InkAPI.cc | 20 ++---
 proxy/SocksProxy.cc |  6 +-
 proxy/congest/CongestionTest.cc |  5 ++
 proxy/http/HttpClientSession.cc |  2 +-
 proxy/http2/Http2ClientSession.cc   |  1 +
 proxy/logging/Log.cc|  1 +
 15 files changed, 72 insertions(+), 140 deletions(-)
 --
 
 
 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3d0d2564/iocore/cache/RamCacheCLFUS.cc
 --
 diff --git a/iocore/cache/RamCacheCLFUS.cc b/iocore/cache/RamCacheCLFUS.cc
 index 0e051b2..8eb72ce 100644
 --- a/iocore/cache/RamCacheCLFUS.cc
 +++ b/iocore/cache/RamCacheCLFUS.cc
 @@ -310,6 +310,8 @@ RamCacheCLFUS::tick()
 return;
   e = lru[1].dequeue();
 Lfree:
 +  if (!e) // e may be NULL after e= lru[1].dequeue()
 +return;
   e-flag_bits.lru = 0;
   history--;
   uint32_t b = e-key.slice32(3) % nbuckets;
 
 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3d0d2564/lib/atscppapi/src/Plugin.cc
 --
 diff --git a/lib/atscppapi/src/Plugin.cc b/lib/atscppapi/src/Plugin.cc
 index 6de4391..176a030 100644
 --- a/lib/atscppapi/src/Plugin.cc
 +++ b/lib/atscppapi/src/Plugin.cc
 @@ -34,5 +34,6 @@ atscppapi::RegisterGlobalPlugin(std::string name, 
 std::string vendor, std::strin
   info.plugin_name = const_castchar *(name.c_str());
   info.vendor_name = const_castchar *(vendor.c_str());
   info.support_email = const_castchar *(email.c_str());
 -  TSPluginRegister(info);
 +  if (TSPluginRegister(info) != TS_SUCCESS)
 +TSError([Plugin.cc] Plugin registration failed.);
 }
 
 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3d0d2564/lib/ts/ParseRules.cc
 --
 diff --git a/lib/ts/ParseRules.cc b/lib/ts/ParseRules.cc
 index ffc4a4e..6bd61b7 100644
 --- a/lib/ts/ParseRules.cc
 +++ b/lib/ts/ParseRules.cc
 @@ -41,89 +41,6 @@ const char parseRulesCTypeToLower[256] = {
 #include ParseRulesCTypeToLower
 };
 
 -unsigned char *
 -ParseRules::scan_while(unsigned char *ptr, unsigned int n, uint32_t bitmask)
 -{
 -  unsigned int i;
 -  uint32_t *wptr;
 -  unsigned char *align_ptr;
 -  uintptr_t f_bytes, b_bytes, words, align_off;
 -
 -  align_off = ((uintptr_t)ptr  3);
 -  align_ptr = (unsigned char *)(((uintptr_t)ptr)  ~3);
 -
 -  f_bytes = (align_off ? 4 - align_off : 0);
 -
 -  words = (n - f_bytes)  2;
 -
 -  if (words == 0) {
 -for (i = 0; i  n; i++)
 -  if (!is_type(ptr[i], bitmask))
 -return (ptr[i]);
 -  } else {
 -wptr = ((uint32_t *)align_ptr) + (align_off ? 1 : 0);
 -switch (align_off) {
 -case 1:
 -  if (!is_type(align_ptr[1], bitmask))
 -return (ptr[1]);
 -case 2:
 -  if (!is_type(align_ptr[2], bitmask))
 -return (ptr[2]);
 -case 3:
 -  if (!is_type(align_ptr[3], bitmask))
 -return (ptr[3]);
 -  break;
 -default:
 -  break;
 -}
 -
 -b_bytes = n - ((words  2) + f_bytes);
 -
 -for (i = 0; i  words; i++) {
 -  uint32_t word = wptr[i];
 -  uint32_t result = (is_type(((word  0)  0xFF), bitmask)  
 is_type(((word  8)  0xFF), bitmask) 
 - 

trafficserver git commit: doc: link the cache promotion plugin

2015-08-12 Thread jpeach
Repository: trafficserver
Updated Branches:
  refs/heads/master d2ba4f105 - d0cc04c2b


doc: link the cache promotion plugin


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

Branch: refs/heads/master
Commit: d0cc04c2b75fa23437637a92db12d621fe5bf3b7
Parents: d2ba4f1
Author: James Peach jpe...@apache.org
Authored: Wed Aug 12 09:25:08 2015 -0700
Committer: James Peach jpe...@apache.org
Committed: Wed Aug 12 09:25:08 2015 -0700

--
 doc/reference/plugins/index.en.rst | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d0cc04c2/doc/reference/plugins/index.en.rst
--
diff --git a/doc/reference/plugins/index.en.rst 
b/doc/reference/plugins/index.en.rst
index 0e43b87..be5b762 100644
--- a/doc/reference/plugins/index.en.rst
+++ b/doc/reference/plugins/index.en.rst
@@ -67,6 +67,8 @@ directory of the Apache Traffic Server source tree. 
Experimental plugins can be
   Background Fetch Plugin: allows you to proactively fetch content from Origin 
in a way that it will fill the object into cache background_fetch.en
   Balancer Plugin: balances requests across multiple origin servers 
balancer.en
   Buffer Upload Plugin: buffers POST data before connecting to the Origin 
server buffer_upload.en
+  Cache Promotion: provides additional control over when an object should be
+  allowed into the cache cache_promote.en
   Combohandler Plugin: provides an intelligent way to combine multiple URLs 
into a single URL, and have Apache Traffic Server combine the components into 
one response combo_handler.en
   Epic Plugin: emits Traffic Server metrics in a format that is consumed tby 
the Epic Network Monitoring System epic.en
   ESI Plugin: implements the ESI specification esi.en



trafficserver git commit: Fix double-free in log object construction

2015-08-12 Thread jpeach
Repository: trafficserver
Updated Branches:
  refs/heads/master d0cc04c2b - b2006b44f


Fix double-free in log object construction


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

Branch: refs/heads/master
Commit: b2006b44fbe7af1edf2686b3248abebd297fac17
Parents: d0cc04c
Author: James Peach jpe...@apache.org
Authored: Wed Aug 12 09:35:02 2015 -0700
Committer: James Peach jpe...@apache.org
Committed: Wed Aug 12 09:35:02 2015 -0700

--
 proxy/logging/Log.cc | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b2006b44/proxy/logging/Log.cc
--
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 03ef392..cad013e 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -1409,19 +1409,17 @@ Log::match_logobject(LogBufferHeader *header)
   if (!obj) {
 // object does not exist yet, create it
 //
-LogFormat *fmt = new LogFormat(__collation_format__, 
header-fmt_fieldlist(), header-fmt_printf());
+LogFormat fmt(__collation_format__, header-fmt_fieldlist(), 
header-fmt_printf());
 
-if (fmt-valid()) {
+if (fmt.valid()) {
   LogFileFormat file_format = header-log_object_flags  LogObject::BINARY 
?
 LOG_FILE_BINARY :
 (header-log_object_flags  
LogObject::WRITES_TO_PIPE ? LOG_FILE_PIPE : LOG_FILE_ASCII);
 
-  obj = new LogObject(fmt, Log::config-logfile_dir, 
header-log_filename(), file_format, NULL,
+  obj = new LogObject(fmt, Log::config-logfile_dir, 
header-log_filename(), file_format, NULL,
   
(Log::RollingEnabledValues)Log::config-rolling_enabled, 
Log::config-collation_preproc_threads,
   Log::config-rolling_interval_sec, 
Log::config-rolling_offset_hr, Log::config-rolling_size_mb, true);
 
-  delete fmt; // This is copy constructed in LogObject.
-
   obj-set_remote_flag();
 
   if (Log::config-log_object_manager.manage_object(obj)) {
@@ -1432,7 +1430,7 @@ Log::match_logobject(LogBufferHeader *header)
 obj = NULL;
   }
 }
-delete fmt;
   }
+
   return obj;
 }