[trafficserver] branch master updated (3d7cdbf -> 0bd26e9)

2016-04-19 Thread briang
This is an automated email from the ASF dual-hosted git repository.

briang pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  3d7cdbf   TS-4147 Allow gzip plugin to be a remap plugin
  adds  24d6365   removing a bad comma
   new  0bd26e9   Merge pull request #587 from zizhong/bad_comma

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


Summary of changes:
 proxy/api/ts/experimental.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] 01/01: Merge pull request #587 from zizhong/bad_comma

2016-04-19 Thread briang
This is an automated email from the ASF dual-hosted git repository.

briang pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 0bd26e984743fa94757e8310dbeea9d3b4463dd8
Merge: 3d7cdbf 24d6365
Author: Brian Geffon 
AuthorDate: Wed Apr 20 10:39:14 2016 +0800

Merge pull request #587 from zizhong/bad_comma

removing a bad comma

 proxy/api/ts/experimental.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" .


[trafficserver] branch master updated: TS-4147 Allow gzip plugin to be a remap plugin

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

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

The following commit(s) were added to refs/heads/master by this push:
   new  3d7cdbf   TS-4147 Allow gzip plugin to be a remap plugin
3d7cdbf is described below

commit 3d7cdbfa1dc52e81c2698dfbac526dec1d336246
Author: Meera Mosale Nataraja 
AuthorDate: Mon Apr 18 12:51:03 2016 -0700

TS-4147 Allow gzip plugin to be a remap plugin
---
 doc/admin-guide/plugins/gzip.en.rst |   9 +-
 plugins/gzip/gzip.cc| 159 +++-
 plugins/gzip/tests/test_gzip.py | 241 
 3 files changed, 375 insertions(+), 34 deletions(-)

diff --git a/doc/admin-guide/plugins/gzip.en.rst 
b/doc/admin-guide/plugins/gzip.en.rst
index 51a55f3..bf84a18 100644
--- a/doc/admin-guide/plugins/gzip.en.rst
+++ b/doc/admin-guide/plugins/gzip.en.rst
@@ -56,7 +56,8 @@ are no special steps necessary for its installation.
 Configuration
 =
 
-This plugin is enabled globally for |TS| by adding the following to your
+This plugin can be used as either global plugin or remap plugin.
+It can be enabled globally for |TS| by adding the following to your
 :file:`plugin.config`::
 
 gzip.so
@@ -80,11 +81,17 @@ configuration provided with the plugin's source)::
 
 gzip.so /sample.gzip.config
 
+This can be used as remap plugin by pointing to config file in remap rule 
+:file:`remap.config`::
+@plugin=gzip.so @pparam=--config=/sample.gzip.config 
+
 The following sections detail the options you may specify in the plugin's
 configuration file. Options may be used globally, or may be specified on a
 per-site basis by preceding them with a `[]` line, where `` is the
 client-facing domain for which the options should apply.
 
+Per site configuration for remap plugin should be ignored.
+
 cache
 -
 
diff --git a/plugins/gzip/gzip.cc b/plugins/gzip/gzip.cc
index 8c978b7..10970c8 100644
--- a/plugins/gzip/gzip.cc
+++ b/plugins/gzip/gzip.cc
@@ -30,6 +30,7 @@
 #include "debug_macros.h"
 #include "misc.h"
 #include "configuration.h"
+#include "ts/remap.h"
 
 using namespace std;
 using namespace Gzip;
@@ -594,18 +595,23 @@ gzip_transform_add(TSHttpTxn txnp, HostConfiguration *hc, 
int compress_type)
 }
 
 HostConfiguration *
-find_host_configuration(TSHttpTxn /* txnp ATS_UNUSED */, TSMBuffer bufp, 
TSMLoc locp)
+find_host_configuration(TSHttpTxn /* txnp ATS_UNUSED */, TSMBuffer bufp, 
TSMLoc locp, Configuration *config)
 {
   TSMLoc fieldp = TSMimeHdrFieldFind(bufp, locp, TS_MIME_FIELD_HOST, 
TS_MIME_LEN_HOST);
   int strl = 0;
   const char *strv = NULL;
+  HostConfiguration *host_configuration;
 
   if (fieldp) {
 strv = TSMimeHdrFieldValueStringGet(bufp, locp, fieldp, -1, );
 TSHandleMLocRelease(bufp, locp, fieldp);
   }
-
-  return cur_config->find(strv, strl);
+  if (config == NULL) {
+host_configuration = cur_config->find(strv, strl);
+  } else {
+host_configuration = config->find(strv, strl);
+  }
+  return host_configuration;
 }
 
 static int
@@ -685,45 +691,67 @@ transform_plugin(TSCont contp, TSEvent event, void *edata)
   return 0;
 }
 
-static int
-transform_global_plugin(TSCont /* contp ATS_UNUSED */, TSEvent event, void 
*edata)
+/**
+ * This handles gzip request
+ * 1. Reads the client request header
+ * 2. For global plugin, get host configuration from global config
+ *For remap plugin, get host configuration from configs populated through 
remap
+ * 3. Check for Accept encoding
+ * 4. Schedules TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK and TS_HTTP_TXN_CLOSE_HOOK 
for
+ *further processing
+ */
+static void
+handle_gzip_request(TSHttpTxn txnp, Configuration *config)
 {
-  TSHttpTxn txnp = (TSHttpTxn)edata;
   TSMBuffer req_buf;
   TSMLoc req_loc;
+  HostConfiguration *hc;
 
-  switch (event) {
-  case TS_EVENT_HTTP_READ_REQUEST_HDR:
-if (TSHttpTxnClientReqGet(txnp, _buf, _loc) == TS_SUCCESS) {
-  HostConfiguration *hc = find_host_configuration(txnp, req_buf, req_loc); 
// Get a lease on the
-  bool allowed = false;
-
-  if (hc->enabled()) {
-if (hc->has_disallows()) {
-  int url_len;
-  char *url = TSHttpTxnEffectiveUrlStringGet(txnp, _len);
-
-  allowed = hc->is_url_allowed(url, url_len);
-  TSfree(url);
-} else {
-  allowed = true;
-}
-  }
-
-  if (allowed) {
-TSCont transform_contp = TSContCreate(transform_plugin, NULL);
+  if (TSHttpTxnClientReqGet(txnp, _buf, _loc) == TS_SUCCESS) {
+if (config == NULL) {
+  hc = find_host_configuration(txnp, req_buf, req_loc, NULL); // Get a 
lease on the global config
+} else {
+  hc = find_host_configuration(txnp, req_buf, req_loc, config); // Get a 
lease on the local config passed through doRemap
+}
+bool allowed = false;
 
-info("Kicking off gzip plugin for request");
+   

[trafficserver] branch master updated: TS-4318 Fix a regression in regex rules

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

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

The following commit(s) were added to refs/heads/master by this push:
   new  431a8f8   TS-4318 Fix a regression in regex rules
431a8f8 is described below

commit 431a8f838e75338cb685b95c213a6140f5cbdcc7
Author: Leif Hedstrom 
AuthorDate: Mon Apr 4 15:06:47 2016 -0600

TS-4318 Fix a regression in regex rules

The refactoring done earlier broke the config loading of rules using
the regular expressions. This restore that functionality, but cleaner.
---
 plugins/experimental/geoip_acl/acl.cc   | 25 -
 plugins/experimental/geoip_acl/acl.h|  8 +---
 plugins/experimental/geoip_acl/geoip_acl.cc |  1 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/plugins/experimental/geoip_acl/acl.cc 
b/plugins/experimental/geoip_acl/acl.cc
index 9b30679..e5e09ff 100644
--- a/plugins/experimental/geoip_acl/acl.cc
+++ b/plugins/experimental/geoip_acl/acl.cc
@@ -120,7 +120,7 @@ Acl::read_html(const char *fn)
 
 // Implementations for the RegexAcl class
 bool
-RegexAcl::parse_line(const char *filename, const std::string , int lineno)
+RegexAcl::parse_line(const char *filename, const std::string , int 
lineno, int )
 {
   static const char _SEPARATOR[] = " \t\n";
   std::string regex, tmp;
@@ -155,6 +155,7 @@ RegexAcl::parse_line(const char *filename, const 
std::string , int lineno)
   pos2 = line.find_first_of(_SEPARATOR, pos1);
   tmp = line.substr(pos1, pos2 - pos1);
   _acl->add_token(tmp);
+  ++tokens;
 }
 compile(regex, filename, lineno);
 TSDebug(PLUGIN_NAME, "Added regex rule for /%s/", regex.c_str());
@@ -220,7 +221,7 @@ CountryAcl::add_token(const std::string )
 }
 
 void
-CountryAcl::read_regex(const char *fn)
+CountryAcl::read_regex(const char *fn, int )
 {
   std::ifstream f;
   int lineno = 0;
@@ -234,7 +235,7 @@ CountryAcl::read_regex(const char *fn)
   getline(f, line);
   ++lineno;
   acl = new RegexAcl(new CountryAcl());
-  if (acl->parse_line(fn, line, lineno)) {
+  if (acl->parse_line(fn, line, lineno, tokens)) {
 if (NULL == _regexes) {
   _regexes = acl;
 } else {
@@ -255,6 +256,9 @@ CountryAcl::read_regex(const char *fn)
 bool
 CountryAcl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp) const
 {
+  bool ret = _allow;
+
+  TSDebug(PLUGIN_NAME, "CountryAcl::eval() called, default ACL is %s", ret ? 
"allow" : "deny");
   // If there are regex rules, they take priority first. If a regex matches, 
we will
   // honor it's eval() rule. If no regexes matches, fall back on the default 
(which is
   // "allow" if nothing else is specified).
@@ -269,16 +273,19 @@ CountryAcl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp) 
const
 return acl->eval(rri, txnp);
   }
 } while ((acl = acl->next()));
+ret = !_allow; // Now we invert the default since no regexes matched
   }
 
   // None of the regexes (if any) matched, so fallback to the remap defaults 
if there are any.
   int iso = country_id_by_addr(TSHttpTxnClientAddrGet(txnp));
 
-  if ((iso <= 0) || (!_iso_country_codes[iso])) {
-return !_allow;
+  if ((iso <= 0) || !_iso_country_codes[iso]) {
+TSDebug(PLUGIN_NAME, "ISO not found in table, returning %d", !ret);
+return !ret;
   }
 
-  return _allow;
+  TSDebug(PLUGIN_NAME, "ISO was found in table, or -1, returning %d", ret);
+  return ret;
 }
 
 int
@@ -288,11 +295,11 @@ CountryAcl::process_args(int argc, char *argv[])
 
   for (int i = 3; i < argc; ++i) {
 if (!strncmp(argv[i], "allow", 5)) {
-  _allow = true;
+  set_allow(true);
 } else if (!strncmp(argv[i], "deny", 4)) {
-  _allow = false;
+  set_allow(false);
 } else if (!strncmp(argv[i], "regex::", 7)) {
-  read_regex(argv[i] + 7);
+  read_regex(argv[i] + 7, tokens);
 } else if (!strncmp(argv[i], "html::", 6)) {
   read_html(argv[i] + 6);
 } else { // ISO codes assumed for the rest
diff --git a/plugins/experimental/geoip_acl/acl.h 
b/plugins/experimental/geoip_acl/acl.h
index 5067a75..45bd500 100644
--- a/plugins/experimental/geoip_acl/acl.h
+++ b/plugins/experimental/geoip_acl/acl.h
@@ -51,7 +51,7 @@ public:
   Acl() : _allow(true), _added_tokens(0) {}
   virtual ~Acl() {}
   // These have to be implemented for each ACL type
-  virtual void read_regex(const char *fn) = 0;
+  virtual void read_regex(const char *fn, int ) = 0;
   virtual int process_args(int argc, char *argv[]) = 0;
   virtual bool eval(TSRemapRequestInfo *rri, TSHttpTxn txnp) const = 0;
   virtual void add_token(const std::string ) = 0;
@@ -83,6 +83,8 @@ protected:
   std::string _html;
   bool _allow;
   int _added_tokens;
+
+  // Class members
   static GeoDBHandle _geoip;
   static GeoDBHandle _geoip6;
 };
@@ -119,7 +121,7 @@ public:
   }
 
   void 

[trafficserver] branch master updated: TS-4361: Remove TS_FETCH_EVENT handlers from Http2ClientSession. This closes #581.

2016-04-19 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  3872a38   TS-4361: Remove TS_FETCH_EVENT handlers from 
Http2ClientSession. This closes #581.
3872a38 is described below

commit 3872a385cac3d43de25bdaf38c56bbcc2cb6f65b
Author: Masaori Koshiba 
AuthorDate: Mon Apr 18 15:16:56 2016 +0900

TS-4361: Remove TS_FETCH_EVENT handlers from Http2ClientSession. This 
closes #581.
---
 proxy/http2/Http2ClientSession.cc | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 8b8427e..d759c84 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -287,13 +287,6 @@ Http2ClientSession::main_event_handler(int event, void 
*edata)
 }
 return 0;
 
-  case TS_FETCH_EVENT_EXT_HEAD_DONE:
-  case TS_FETCH_EVENT_EXT_BODY_READY:
-  case TS_FETCH_EVENT_EXT_BODY_DONE:
-// Process responses from origin server
-send_connection_event(>connection_state, event, edata);
-return 0;
-
   default:
 DebugHttp2Ssn("unexpected event=%d edata=%p", event, edata);
 ink_release_assert(0);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: TS-4046: Clang format fix.

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

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

The following commit(s) were added to refs/heads/master by this push:
   new  f637325   TS-4046: Clang format fix.
f637325 is described below

commit f637325c6fb06b56e54d68115f36ef67aceb2d5b
Author: Alan M. Carroll 
AuthorDate: Tue Apr 19 11:32:05 2016 -0500

TS-4046: Clang format fix.
---
 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 55db874..867ad2a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -936,7 +936,7 @@ done:
 TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   } else {
 s->hdr_info.client_response.destroy(); // release the underlying memory.
-s->hdr_info.client_response.clear(); // clear the pointers.
+s->hdr_info.client_response.clear();   // clear the pointers.
 DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
 
 if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: TS-4046: Better fix for cleaning up the client response for intercept plugins.

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

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

The following commit(s) were added to refs/heads/master by this push:
   new  608775e   TS-4046: Better fix for cleaning up the client response 
for intercept plugins.
608775e is described below

commit 608775e1ceccba64f5dfd75957f4a24276fba755
Author: Alan M. Carroll 
AuthorDate: Tue Apr 19 10:17:22 2016 -0500

TS-4046: Better fix for cleaning up the client response for intercept 
plugins.
---
 proxy/hdrs/HTTP.h  | 7 +++
 proxy/http/HttpTransact.cc | 3 ++-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 878fc83..b32d3ef 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -507,7 +507,7 @@ public:
   int valid() const;
 
   void create(HTTPType polarity, HdrHeap *heap = NULL);
-  void destroy();
+  void clear();
   void reset();
   void copy(const HTTPHdr *hdr);
   void copy_shallow(const HTTPHdr *hdr);
@@ -796,13 +796,12 @@ HTTPHdr::create(HTTPType polarity, HdrHeap *heap)
 }
 
 inline void
-HTTPHdr::destroy()
+HTTPHdr::clear()
 {
   if (m_http && m_http->m_polarity == HTTP_TYPE_REQUEST) {
 m_url_cached.clear();
   }
-  // Removing the only pointers to this data therefore it needs to get cleaned 
up or leak.
-  this->HdrHeapSDKHandle::destroy();
+  this->HdrHeapSDKHandle::clear();
   m_http = NULL;
   m_mime = NULL;
 }
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index c3b345d..55db874 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -935,7 +935,8 @@ done:
 HTTP_INCREMENT_DYN_STAT(http_invalid_client_requests_stat);
 TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   } else {
-s->hdr_info.client_response.destroy(); // anything previously set is 
invalid from this point forward
+s->hdr_info.client_response.destroy(); // release the underlying memory.
+s->hdr_info.client_response.clear(); // clear the pointers.
 DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
 
 if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: TS-4046: Prevent memory leak of HTTP heap for server intercept case. This close #577.

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

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

The following commit(s) were added to refs/heads/master by this push:
   new  5abf6ac   TS-4046: Prevent memory leak of HTTP heap for server 
intercept case. This close #577.
5abf6ac is described below

commit 5abf6aca383e34b5aa1c0e3248936d858806acbe
Author: Alan M. Carroll 
AuthorDate: Mon Apr 18 10:14:24 2016 -0500

TS-4046: Prevent memory leak of HTTP heap for server intercept case.
This close #577.
---
 proxy/hdrs/HTTP.h  | 7 ---
 proxy/http/HttpTransact.cc | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index b32d3ef..878fc83 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -507,7 +507,7 @@ public:
   int valid() const;
 
   void create(HTTPType polarity, HdrHeap *heap = NULL);
-  void clear();
+  void destroy();
   void reset();
   void copy(const HTTPHdr *hdr);
   void copy_shallow(const HTTPHdr *hdr);
@@ -796,12 +796,13 @@ HTTPHdr::create(HTTPType polarity, HdrHeap *heap)
 }
 
 inline void
-HTTPHdr::clear()
+HTTPHdr::destroy()
 {
   if (m_http && m_http->m_polarity == HTTP_TYPE_REQUEST) {
 m_url_cached.clear();
   }
-  this->HdrHeapSDKHandle::clear();
+  // Removing the only pointers to this data therefore it needs to get cleaned 
up or leak.
+  this->HdrHeapSDKHandle::destroy();
   m_http = NULL;
   m_mime = NULL;
 }
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 87763b6..c3b345d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -935,7 +935,7 @@ done:
 HTTP_INCREMENT_DYN_STAT(http_invalid_client_requests_stat);
 TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
   } else {
-s->hdr_info.client_response.clear(); // anything previously set is invalid 
from this point forward
+s->hdr_info.client_response.destroy(); // anything previously set is 
invalid from this point forward
 DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
 
 if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].