trafficserver git commit: TS-3723: Failed remap should log as ERR_INVALID_URL

2015-06-29 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master a3e83c11d -> 8dbe5601d


TS-3723: Failed remap should log as ERR_INVALID_URL


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

Branch: refs/heads/master
Commit: 8dbe5601d668e183d69a63f041fe10dacd4e3978
Parents: a3e83c1
Author: Brian Geffon 
Authored: Mon Jun 29 00:06:48 2015 -0700
Committer: Brian Geffon 
Committed: Mon Jun 29 00:06:48 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8dbe5601/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index c706c20..59ee0fc 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -845,8 +845,10 @@ HttpTransact::EndRemapRequest(State *s)
 // socket when there is no host. Need to handle DNS failure elsewhere.
   } else if (host == NULL) { /* no host */
 build_error_response(s, HTTP_STATUS_BAD_REQUEST, "Host Header 
Required", "request#no_host", NULL);
+s->squid_codes.log_code = SQUID_LOG_ERR_INVALID_URL;
   } else {
 build_error_response(s, HTTP_STATUS_NOT_FOUND, "Not Found on 
Accelerator", "urlrouting#no_mapping", NULL);
+s->squid_codes.log_code = SQUID_LOG_ERR_INVALID_URL;
   }
   s->reverse_proxy = false;
   goto done;
@@ -859,6 +861,7 @@ HttpTransact::EndRemapRequest(State *s)
 
   SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_NO_FORWARD);
   build_error_response(s, HTTP_STATUS_NOT_FOUND, "Not Found", 
"urlrouting#no_mapping", NULL);
+  s->squid_codes.log_code = SQUID_LOG_ERR_INVALID_URL;
 
   s->reverse_proxy = false;
   goto done;



trafficserver git commit: Fixing debug build issue introduced by github pull request #234

2015-06-29 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master c31e12b49 -> 65fa4ec51


Fixing debug build issue introduced by github pull request #234


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

Branch: refs/heads/master
Commit: 65fa4ec5182bef596b81dc945c1d29a9f13b4360
Parents: c31e12b
Author: Brian Geffon 
Authored: Mon Jun 29 23:14:58 2015 -0700
Committer: Brian Geffon 
Committed: Mon Jun 29 23:14:58 2015 -0700

--
 iocore/hostdb/I_HostDBProcessor.h | 11 ---
 1 file changed, 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/65fa4ec5/iocore/hostdb/I_HostDBProcessor.h
--
diff --git a/iocore/hostdb/I_HostDBProcessor.h 
b/iocore/hostdb/I_HostDBProcessor.h
index 720401b..05112ff 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -271,17 +271,6 @@ struct HostDBInfo {
   //  failure times.  This sets the upper bound that we would ever
   //  consider a server down to 2*down_server_timeout
   if (now + fail_window < last_failure) {
-#ifdef DEBUG
-// because this region is mmaped, I cann't get anything
-//   useful from the structure in core files,  therefore
-//   copy the revelvant info to the stack so it will
-//   be readble in the core
-HostDBInfo current_info;
-HostDBRoundRobin current_rr;
-memcpy(¤t_info, &info[i], sizeof(HostDBInfo));
-memcpy(¤t_rr, this, sizeof(HostDBRoundRobin));
-ink_assert(!"extreme clock skew");
-#endif
 app.http_data.last_failure = 0;
 return false;
   }



[3/3] trafficserver git commit: TS-3440: Update tests

2015-07-02 Thread briang
TS-3440: Update tests


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

Branch: refs/heads/master
Commit: 0b2c2f96d449e4d19858f947fdc2a4bd204631a9
Parents: dc2b07b
Author: Brian Geffon 
Authored: Thu Jul 2 00:10:45 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 2 00:10:45 2015 -0700

--
 ci/tsqa/tests/test_connect_attempts.py | 4 
 1 file changed, 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0b2c2f96/ci/tsqa/tests/test_connect_attempts.py
--
diff --git a/ci/tsqa/tests/test_connect_attempts.py 
b/ci/tsqa/tests/test_connect_attempts.py
index bb5e1a2..d5b7117 100644
--- a/ci/tsqa/tests/test_connect_attempts.py
+++ b/ci/tsqa/tests/test_connect_attempts.py
@@ -183,10 +183,6 @@ class 
TestOriginServerConnectAttempts(helpers.EnvironmentCase):
 ret = requests.get(url)
 self.assertEqual(ret.status_code, 504)
 
-# TODO: FIX THIS!!! The test is correct, ATS isn't!
-# we should fail in this case-- or at least have a config which lets you 
control
-# TODO: remove once TS-3440 is resolved
-@helpers.unittest.expectedFailure
 def test_partial_response_origin(self):
 '''
 Verify that we get 504s from origins that return a partial_response



[2/3] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2015-07-02 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: dc2b07ba90a610024fcf389eb904738f0d80fc80
Parents: 440a145 7b0a57f
Author: Brian Geffon 
Authored: Thu Jul 2 00:08:20 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 2 00:08:20 2015 -0700

--
 Makefile.am |   9 +-
 .../configuration/records.config.en.rst |   6 ++
 iocore/hostdb/I_HostDBProcessor.h   |   1 -
 iocore/hostdb/P_HostDBProcessor.h   |  10 +-
 iocore/net/P_SSLConfig.h|   1 +
 iocore/net/P_SSLNetVConnection.h|  27 +
 iocore/net/SSLConfig.cc |   3 +
 iocore/net/SSLNetVConnection.cc |  65 +++-
 iocore/net/SSLNextProtocolAccept.cc |   3 +-
 iocore/net/UnixNetVConnection.cc|  23 -
 mgmt/RecordsConfig.cc   |  20 +---
 proxy/ProtocolProbeSessionAccept.cc |  33 --
 proxy/http/HttpClientSession.cc |  13 +++
 proxy/http/HttpSM.cc|  60 ++-
 tools/changelog.pl  | 102 +++
 15 files changed, 312 insertions(+), 64 deletions(-)
--




[1/3] trafficserver git commit: TS-3440: Connect retries shouldn't happen if the connection has succeeeded and data has been sent

2015-07-02 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 7b0a57f43 -> 0b2c2f96d


TS-3440: Connect retries shouldn't happen if the connection has succeeeded and 
data has been sent


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

Branch: refs/heads/master
Commit: 440a14513e59baf21e55b07f0dd4aa39bac232de
Parents: 65fa4ec
Author: Brian Geffon 
Authored: Thu Jul 2 00:08:11 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 2 00:08:11 2015 -0700

--
 proxy/http/HttpTransact.cc | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/440a1451/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 59ee0fc..06870ae 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3643,6 +3643,17 @@ HttpTransact::handle_response_from_server(State *s)
 s->current.server->set_connect_fail(EUSERS); // too many users
 handle_server_connection_not_open(s);
 break;
+  case CONNECTION_CLOSED:
+/* fall through */
+  case PARSE_ERROR:
+/* fall through */
+  case BAD_INCOMING_RESPONSE: {
+// this case should not be allowed to retry because we'll end up making 
another request
+DebugTxn("http_trans", "[handle_response_from_server] Transaction received 
a bad response or a partial response, not retrying...");
+SET_VIA_STRING(VIA_DETAIL_SERVER_CONNECT, VIA_DETAIL_SERVER_FAILURE);
+handle_server_connection_not_open(s);
+break;
+  }
   case OPEN_RAW_ERROR:
   /* fall through */
   case CONNECTION_ERROR:
@@ -3650,12 +3661,6 @@ HttpTransact::handle_response_from_server(State *s)
   case STATE_UNDEFINED:
   /* fall through */
   case INACTIVE_TIMEOUT:
-  /* fall through */
-  case PARSE_ERROR:
-  /* fall through */
-  case CONNECTION_CLOSED:
-  /* fall through */
-  case BAD_INCOMING_RESPONSE:
 // Set to generic I/O error if not already set specifically.
 if (!s->current.server->had_connect_fail())
   s->current.server->set_connect_fail(EIO);



trafficserver git commit: HostDB HTTP UI: Add a listall endpoint. This closes #240

2015-07-14 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 44c90698a -> 94f4083d0


HostDB HTTP UI: Add a listall endpoint. This closes #240


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

Branch: refs/heads/master
Commit: 94f4083d02c545275177718a9a6c239de78ce978
Parents: 44c9069
Author: Brian Geffon 
Authored: Wed Jul 8 19:48:45 2015 -0700
Committer: Brian Geffon 
Committed: Tue Jul 14 22:45:39 2015 -0700

--
 iocore/hostdb/HostDB.cc   | 196 +
 iocore/hostdb/I_HostDBProcessor.h |   2 +
 iocore/hostdb/P_HostDBProcessor.h |   4 +-
 3 files changed, 201 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94f4083d/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 9ccd08a..6abb7b0 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1038,6 +1038,61 @@ HostDBProcessor::getbyname_imm(Continuation *cont, 
process_hostdb_info_pfn proce
   return &c->action;
 }
 
+Action *
+HostDBProcessor::getall(Continuation *cont)
+{
+  ink_assert(cont->mutex->thread_holding == this_ethread());
+  EThread *thread = cont->mutex->thread_holding;
+  ProxyMutex *mutex = thread->mutex;
+
+  HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
+
+Action *
+HostDBProcessor::iterate(Continuation *cont)
+{
+  ink_assert(cont->mutex->thread_holding == this_ethread());
+  EThread *thread = cont->mutex->thread_holding;
+  ProxyMutex *mutex = thread->mutex;
+
+  HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
+
+
+  HostDBContinuation *c = hostDBContAllocator.alloc();
+  HostDBContinuation::Options copt;
+  copt.cont = cont;
+  copt.force_dns = false;
+  copt.timeout = 0;
+  copt.host_res_style = HOST_RES_NONE;
+  c->init(HostDBMD5(), copt);
+  c->current_iterate_pos = 0;
+  SET_CONTINUATION_HANDLER(c, 
(HostDBContHandler)&HostDBContinuation::iterateEvent);
+
+  if (thread->mutex == cont->mutex) {
+thread->schedule_in(c, HOST_DB_RETRY_PERIOD);
+  } else {
+dnsProcessor.thread->schedule_imm(c);
+  }
+
+  return &c->action;
+}
+
+  HostDBContinuation *c = hostDBContAllocator.alloc();
+  HostDBContinuation::Options copt;
+  copt.cont = cont;
+  copt.force_dns = false;
+  copt.timeout = 0;
+  copt.host_res_style = HOST_RES_NONE;
+  c->init(HostDBMD5(), copt);
+  SET_CONTINUATION_HANDLER(c, 
(HostDBContHandler)&HostDBContinuation::probeAllEvent);
+
+  if (thread->mutex == cont->mutex) {
+thread->schedule_in(c, HOST_DB_RETRY_PERIOD);
+  } else {
+dnsProcessor.thread->schedule_imm(c);
+  }
+
+  return &c->action;
+}
 
 static void
 do_setby(HostDBInfo *r, HostDBApplicationInfo *app, const char *hostname, 
IpAddr const &ip, bool is_srv = false)
@@ -1789,6 +1844,60 @@ HostDBContinuation::make_put_message(HostDBInfo *r, 
Continuation *c, char *buf,
   return len;
 }
 
+int
+HostDBContinuation::iterateEvent(int event, Event *e)
+{
+  Debug("hostdb", "iterateEvent event=%d eventp=%p", event, e);
+  ink_assert(!link.prev && !link.next);
+  EThread *t = e ? e->ethread : this_ethread();
+
+  MUTEX_TRY_LOCK_FOR(lock, action.mutex, t, action.continuation);
+  if (!lock.is_locked()) {
+Debug("hostdb", "iterateEvent event=%d eventp=%p: reschedule due to not 
getting action mutex", event, e);
+mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
+return EVENT_CONT;
+  }
+
+  if (action.cancelled) {
+hostdb_cont_free(this);
+return EVENT_DONE;
+  }
+
+  // let's iterate through another record and then reschedule ourself.
+  if (current_iterate_pos < hostDB.buckets) {
+ // do 100 at a time
+ int end = min(current_iterate_pos + 100, hostDB.buckets);
+ for (; current_iterate_pos < end; ++current_iterate_pos) {
+   ProxyMutex *bucket_mutex = hostDB.lock_for_bucket(current_iterate_pos);
+   MUTEX_TRY_LOCK_FOR(lock_bucket, bucket_mutex, t, this);
+   if (!lock_bucket.is_locked()) {
+ // we couldn't get the bucket lock, let's just reschedule and try 
later.
+ Debug("hostdb", "iterateEvent event=%d eventp=%p: reschedule due to 
not getting bucket mutex", event, e);
+ mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
+ return EVENT_CONT;
+   }
+
+   for (unsigned int l = 0; l < hostDB.levels; ++l) {
+ HostDBInfo *r = reinterpret_cast(hostDB.data + 
hostDB.level_offset[l] + hostDB.bucketsize[l] * current_iterate_pos);
+ if (!r->deleted && !r->failed()) {
+   action.continuation->handleEvent(EVENT_INTERVAL, 
static_cast(r));
+   

trafficserver git commit: HostDB HTTP UI: Fix merge issue. This closes #240

2015-07-15 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 94f4083d0 -> 3c2f63faf


HostDB HTTP UI: Fix merge issue. This closes #240


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

Branch: refs/heads/master
Commit: 3c2f63faf03b7a2ddd7a73542944e9c21caf2227
Parents: 94f4083
Author: Brian Geffon 
Authored: Wed Jul 15 00:29:55 2015 -0700
Committer: Brian Geffon 
Committed: Wed Jul 15 00:29:55 2015 -0700

--
 iocore/hostdb/HostDB.cc   | 86 --
 iocore/hostdb/I_HostDBProcessor.h |  2 +-
 iocore/hostdb/P_HostDBProcessor.h |  3 +-
 3 files changed, 3 insertions(+), 88 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c2f63fa/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 6abb7b0..0919b00 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1039,15 +1039,6 @@ HostDBProcessor::getbyname_imm(Continuation *cont, 
process_hostdb_info_pfn proce
 }
 
 Action *
-HostDBProcessor::getall(Continuation *cont)
-{
-  ink_assert(cont->mutex->thread_holding == this_ethread());
-  EThread *thread = cont->mutex->thread_holding;
-  ProxyMutex *mutex = thread->mutex;
-
-  HOSTDB_INCREMENT_DYN_STAT(hostdb_total_lookups_stat);
-
-Action *
 HostDBProcessor::iterate(Continuation *cont)
 {
   ink_assert(cont->mutex->thread_holding == this_ethread());
@@ -1076,24 +1067,6 @@ HostDBProcessor::iterate(Continuation *cont)
   return &c->action;
 }
 
-  HostDBContinuation *c = hostDBContAllocator.alloc();
-  HostDBContinuation::Options copt;
-  copt.cont = cont;
-  copt.force_dns = false;
-  copt.timeout = 0;
-  copt.host_res_style = HOST_RES_NONE;
-  c->init(HostDBMD5(), copt);
-  SET_CONTINUATION_HANDLER(c, 
(HostDBContHandler)&HostDBContinuation::probeAllEvent);
-
-  if (thread->mutex == cont->mutex) {
-thread->schedule_in(c, HOST_DB_RETRY_PERIOD);
-  } else {
-dnsProcessor.thread->schedule_imm(c);
-  }
-
-  return &c->action;
-}
-
 static void
 do_setby(HostDBInfo *r, HostDBApplicationInfo *app, const char *hostname, 
IpAddr const &ip, bool is_srv = false)
 {
@@ -1916,40 +1889,6 @@ HostDBContinuation::do_put_response(ClusterMachine *m, 
HostDBInfo *r, Continuati
   clusterProcessor.invoke_remote(m->pop_ClusterHandler(), 
PUT_HOSTINFO_CLUSTER_FUNCTION, (char *)&msg, len);
 }
 
-int
-HostDBContinuation::probeAllEvent(int event, Event *e)
-{
-  Debug("hostdb", "probeAllEvent event=%d eventp=%p", event, e);
-  ink_assert(!link.prev && !link.next);
-  EThread *t = e ? e->ethread : this_ethread();
-
-  MUTEX_TRY_LOCK_FOR(lock, action.mutex, t, action.continuation);
-  if (!lock.is_locked()) {
-mutex->thread_holding->schedule_in(this, HOST_DB_RETRY_PERIOD);
-return EVENT_CONT;
-  }
-
-  if (action.cancelled) {
-hostdb_cont_free(this);
-return EVENT_DONE;
-  }
-
-  for (int i = 0; i < hostDB.buckets; ++i) {
- ProxyMutex *bucket_mutex = hostDB.lock_for_bucket(i);
- SCOPED_MUTEX_LOCK(lock, bucket_mutex, t);
- for (unsigned int l = 0; l < hostDB.levels; ++l) {
-   HostDBInfo *r = reinterpret_cast(hostDB.data + 
hostDB.level_offset[l] + hostDB.bucketsize[l] * i);
-   if (!r->deleted && !r->failed()) {
- action.continuation->handleEvent(EVENT_INTERVAL, 
static_cast(r));
-   }
- }
-   }
-
-  action.continuation->handleEvent(EVENT_DONE, NULL);
-  hostdb_cont_free(this);
-  return EVENT_DONE;
-}
-
 //
 // Probe state
 //
@@ -2479,31 +2418,6 @@ struct ShowHostDB : public ShowCont {
 CHECK_SHOW(begin("HostDB All Records"));
 CHECK_SHOW(show(""));
 SET_HANDLER(&ShowHostDB::showAllEvent);
-hostDBProcessor.getall(this);
-return EVENT_CONT;
-  }
-
-  int
-  showAllEvent(int event, Event *e)
-  {
-HostDBInfo *r = (HostDBInfo *)e;
-if (event == EVENT_INTERVAL) {
-  HostDBInfo *r = reinterpret_cast(e);
-  return showOne(r,false,event,e);
-} else if (event == EVENT_DONE) {
-  return complete(event, e);
-} else {
-  ink_assert(!"unexpected event");
-}
-return EVENT_CONT;
-  }
-
-  int
-  showAll(int event , Event *e)
-  {
-CHECK_SHOW(begin("HostDB All Records"));
-CHECK_SHOW(show(""));
-SET_HANDLER(&ShowHostDB::showAllEvent);
 hostDBProcessor.iterate(this);
 return EVENT_CONT;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c2f63fa/iocore/hostdb/I_HostDBProcessor.h
--
diff --git a/iocore/hostdb/I_HostDBProcessor.h 
b/iocore/hostdb/I_HostDBProcessor.h
index 37719f6..f5acf

trafficserver git commit: HostDB HTTP UI: Fix merge issue. This closes #240

2015-07-15 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 3c2f63faf -> 5a5311bca


HostDB HTTP UI: Fix merge issue. This closes #240


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

Branch: refs/heads/master
Commit: 5a5311bca4f9acaab2a2a286fe635047bf5ae746
Parents: 3c2f63f
Author: Brian Geffon 
Authored: Wed Jul 15 00:33:06 2015 -0700
Committer: Brian Geffon 
Committed: Wed Jul 15 00:33:06 2015 -0700

--
 iocore/hostdb/HostDB.cc | 1 -
 1 file changed, 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5a5311bc/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0919b00..df302d7 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2425,7 +2425,6 @@ struct ShowHostDB : public ShowCont {
   int
   showAllEvent(int event, Event *e)
   {
-HostDBInfo *r = (HostDBInfo *)e;
 if (event == EVENT_INTERVAL) {
   HostDBInfo *r = reinterpret_cast(e);
   return showOne(r,false,event,e);



[1/2] trafficserver git commit: TS-3773: HostDB UI: add endpoint to list all records

2015-07-16 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master bcec70dc8 -> 6c2c31285


TS-3773: HostDB UI: add endpoint to list all records


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

Branch: refs/heads/master
Commit: 4933bad8f9b119fb6774ce2c402c1e1ccbdcab51
Parents: 5a5311b
Author: Brian Geffon 
Authored: Thu Jul 16 19:20:39 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 16 19:20:39 2015 -0700

--
 iocore/hostdb/HostDB.cc | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4933bad8/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index df302d7..aed3896 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2444,6 +2444,9 @@ struct ShowHostDB : public ShowCont {
 CHECK_SHOW(show("\n"));
 CHECK_SHOW(show("%s%s%s\n", "Type", 
r->round_robin ? "Round-Robin" : "",
 r->reverse_dns ? "Reverse DNS" : "DNS"));
+
+// Let's display the MD5.
+CHECK_SHOW(show("%s%0.16llx %0.8x %0.8x\n", 
"MD5 (high, low, low low)", r->md5_high, r->md5_low, r->md5_low_low));
 CHECK_SHOW(show("%s%u\n", "App1", 
r->app.allotment.application1));
 CHECK_SHOW(show("%s%u\n", "App2", 
r->app.allotment.application2));
 CHECK_SHOW(show("%s%u\n", "LastFailure", 
r->app.http_data.last_failure));



[2/2] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2015-07-16 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: 6c2c31285cff51a405d2f3533780460b62fa06d5
Parents: 4933bad bcec70d
Author: Brian Geffon 
Authored: Thu Jul 16 19:20:59 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 16 19:20:59 2015 -0700

--
 build/plugins.mk|   1 -
 ci/jenkins/bin/in_tree.sh   |   3 +-
 ci/jenkins/bin/out_of_tree.sh   |   6 +-
 cmd/traffic_cop/Makefile.am |   2 -
 cmd/traffic_cop/traffic_cop.cc  |  14 ++-
 cmd/traffic_crashlog/Makefile.am|   2 -
 cmd/traffic_crashlog/traffic_crashlog.cc|   9 +-
 cmd/traffic_crashlog/traffic_crashlog.h |   5 +-
 cmd/traffic_ctl/Makefile.am |   2 -
 cmd/traffic_ctl/traffic_ctl.h   |   9 +-
 cmd/traffic_layout/Makefile.am  |   2 -
 cmd/traffic_layout/traffic_layout.cc|   9 +-
 cmd/traffic_line/Makefile.am|   2 -
 cmd/traffic_line/traffic_line.cc|  12 +-
 cmd/traffic_manager/AddConfigFilesHere.cc   |   4 +-
 cmd/traffic_manager/Makefile.am |   5 +-
 cmd/traffic_manager/MgmtHandlers.cc |   5 +-
 cmd/traffic_manager/StatProcessor.cc|   3 +-
 cmd/traffic_manager/StatProcessor.h |   4 +-
 cmd/traffic_manager/StatType.cc |   6 +-
 cmd/traffic_manager/StatXML.cc  |   2 +-
 cmd/traffic_manager/StatXML.h   |   2 +-
 cmd/traffic_manager/WebOverview.cc  |   6 +-
 cmd/traffic_manager/WebOverview.h   |   8 +-
 cmd/traffic_manager/traffic_manager.cc  |  12 +-
 cmd/traffic_top/Makefile.am |   2 -
 cmd/traffic_top/traffic_top.cc  |   2 +-
 cmd/traffic_via/Makefile.am |   2 -
 cmd/traffic_via/traffic_via.cc  |  13 +--
 cmd/traffic_wccp/Makefile.am|   1 -
 cmd/traffic_wccp/wccp_client.cc |   4 +-
 example/session-1/session-1.c   |   2 +-
 example/version/version.c   |   3 +-
 iocore/aio/I_AIO.h  |   2 +-
 iocore/aio/Makefile.am  |   4 +-
 iocore/aio/test_AIO.cc  |   2 +-
 iocore/cache/Cache.cc   |   4 +-
 iocore/cache/CacheDir.cc|   4 +-
 iocore/cache/CacheHosting.cc|   4 +-
 iocore/cache/CacheHttp.cc   |   2 +-
 iocore/cache/I_Cache.h  |   2 +-
 iocore/cache/I_CacheDefs.h  |   2 +
 iocore/cache/I_Store.h  |   2 +-
 iocore/cache/Makefile.am|   2 -
 iocore/cache/P_Cache.h  |   4 +-
 iocore/cache/P_CacheInternal.h  |   3 +-
 iocore/cache/RamCacheCLFUS.cc   |   1 +
 iocore/cache/Store.cc   |   7 +-
 iocore/cluster/ClusterMachine.cc|   5 +-
 iocore/cluster/Makefile.am  |   2 -
 iocore/cluster/P_Cluster.h  |   2 +-
 iocore/dns/Makefile.am  |   2 -
 iocore/dns/P_DNS.h  |   2 +-
 iocore/dns/P_DNSProcessor.h |   1 -
 iocore/dns/SRV.h|   2 +-
 iocore/dns/SplitDNS.cc  |   7 +-
 iocore/eventsystem/IOBuffer.cc  |   2 +-
 iocore/eventsystem/I_Action.h   |   2 +-
 iocore/eventsystem/I_Continuation.h |   3 +-
 iocore/eventsystem/I_EThread.h  |   4 +-
 iocore/eventsystem/I_Event.h|   2 +-
 iocore/eventsystem/I_EventProcessor.h   |   2 +-
 iocore/eventsystem/I_EventSystem.h  |   2 +-
 iocore/eventsystem/I_IOBuffer.h |   8 +-
 iocore/eventsystem/I_Lock.h |   3 +-
 iocore/eventsystem/I_PriorityEventQueue.h   |   2 +-
 iocore/eventsystem/I_Processor.h|   2 +-
 iocore/eventsystem/I_ProtectedQueue.h   |   2 +-
 iocore/eventsystem/I_ProxyAllocator.h   |   2 +-
 iocore/eventsystem/I_SocketManager.h|   2 +-
 iocore/eventsystem/I_Thread.h   |   3 +-
 iocore/eventsystem/I_VConnection.h  |   2 +-
 iocore/eventsystem/I_VIO.h  |   4 +-
 iocore/eventsystem/Lock.cc  |   2 +-
 iocore/eventsystem/Makefile.am   

[3/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip. DOCUMENTATION

2015-07-22 Thread briang
TS-3780: Logs_xml: add logging field for incoming (interface) ip. DOCUMENTATION


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

Branch: refs/heads/master
Commit: 727f6caafb7d492e13c8d6360b958c67256a9dca
Parents: e399791
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:56:11 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:56:11 2015 -0700

--
 doc/admin/event-logging-formats.en.rst | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/727f6caa/doc/admin/event-logging-formats.en.rst
--
diff --git a/doc/admin/event-logging-formats.en.rst 
b/doc/admin/event-logging-formats.en.rst
index cdd7923..b390965 100644
--- a/doc/admin/event-logging-formats.en.rst
+++ b/doc/admin/event-logging-formats.en.rst
@@ -109,6 +109,16 @@ The following list describes Traffic Server custom logging 
fields.
 ``chih``
 The IP address of the client's host machine in hexadecimal.
 
+.. _hii:
+
+``hii``
+This is the incoming (interface) ip for traffic server, in otherwords this 
is the ip address the client connected to.
+
+.. _hiih:
+
+``hiih``
+The the incoming (interface) ip in hexadecimal.
+
 .. _chp:
 
 ``chp``



[5/5] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2015-07-22 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: b2b0040669818a3dc51b71617507b37e5d51d5c8
Parents: aa8170a 404e786
Author: Brian Geffon 
Authored: Wed Jul 22 21:01:19 2015 -0700
Committer: Brian Geffon 
Committed: Wed Jul 22 21:01:19 2015 -0700

--
 iocore/cache/CacheDisk.cc   |1 +
 iocore/net/SSLNetVConnection.cc |  103 +-
 lib/raft/raft_impl.h| 1028 +-
 lib/raft/test_makefile  |   17 +
 .../ssl_cert_loader/ssl-cert-loader.cc  |8 +-
 proxy/http2/test_Huffmancode.cc |   23 +
 proxy/spdy/SpdyClientSession.cc |2 +-
 7 files changed, 610 insertions(+), 572 deletions(-)
--




[1/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip.

2015-07-22 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 404e7866b -> b2b004066


TS-3780: Logs_xml: add logging field for incoming (interface) ip.


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

Branch: refs/heads/master
Commit: 063cb576a753d75dc43f55b0a8438b59e90cc08b
Parents: bb6f9f3
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:41:08 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:41:08 2015 -0700

--
 proxy/logging/Log.cc   | 11 +++
 proxy/logging/LogAccess.cc |  5 +
 proxy/logging/LogAccess.h  |  9 +
 proxy/logging/LogAccessHttp.cc |  6 ++
 proxy/logging/LogAccessHttp.h  |  1 +
 5 files changed, 28 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/Log.cc
--
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 01921f4..6f20b46 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -344,7 +344,18 @@ Log::init_fields()
 new LogField("client_host_ip_hex", "chih", LogField::IP, 
&LogAccess::marshal_client_host_ip, &LogAccess::unmarshal_ip_to_hex);
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "chih", field);
+  
+  // interface ip 
 
+  field = new LogField("host_interface_ip", "hii", LogField::IP, 
&LogAccess::marshal_host_interface_ip, &LogAccess::unmarshal_ip_to_str);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "hii", field);
+
+  field =
+new LogField("host_interface_ip_hex", "hiih", LogField::IP, 
&LogAccess::marshal_host_interface_ip, &LogAccess::unmarshal_ip_to_hex);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "hiih", field);
+  // interface ip end
   field = new LogField("client_auth_user_name", "caun", LogField::STRING, 
&LogAccess::marshal_client_auth_user_name,
(LogField::UnmarshalFunc) & LogAccess::unmarshal_str);
   global_field_list.add(field, false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccess.cc
--
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index bea3b1b..012ec2a 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -92,6 +92,11 @@ LogAccess::marshal_client_host_ip(char *buf)
   DEFAULT_IP_FIELD;
 }
 
+int
+LogAccess::marshal_host_interface_ip(char *buf)
+{
+  DEFAULT_IP_FIELD;
+}
 /*-
   -*/
 int

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccess.h
--
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 143aedf..61f6679 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -170,10 +170,11 @@ public:
   //
   // client -> proxy fields
   //
-  inkcoreapi virtual int marshal_client_host_ip(char *);// STR
-  inkcoreapi virtual int marshal_client_host_port(char *);  // INT
-  inkcoreapi virtual int marshal_client_auth_user_name(char *); // STR
-  int marshal_client_req_timestamp_sec(char *); // INT
+  inkcoreapi virtual int marshal_client_host_ip(char *);// STR
+  inkcoreapi virtual int marshal_host_interface_ip(char *);  // STR
+  inkcoreapi virtual int marshal_client_host_port(char *);  // INT
+  inkcoreapi virtual int marshal_client_auth_user_name(char *); // STR
+  int marshal_client_req_timestamp_sec(char *); // INT
 
   inkcoreapi virtual int marshal_client_req_text(char *);   // STR
   inkcoreapi virtual int marshal_client_req_http_method(char *);// STR

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/063cb576/proxy/logging/LogAccessHttp.cc
--
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index 8d457ab..4eedaa5 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -237,6 +237,12 @@ LogAccessHttp::marshal_client_host_ip(char *buf)
   return marshal_ip(buf, &m_http_sm->t_state.client_info.src_addr.sa);
 }
 
+int
+LogAccessHttp::marshal_host_interface_ip(char *buf)
+{
+  return marshal_ip(buf, &m_http_sm->t_state.client_info.dst_addr.sa);
+}
+
 /*

[2/5] trafficserver git commit: TS-3780: Logs_xml: add logging field for incoming (interface) ip. TESTS

2015-07-22 Thread briang
TS-3780: Logs_xml: add logging field for incoming (interface) ip. TESTS


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

Branch: refs/heads/master
Commit: e39979197066c4e32cfee8dd6ca9301d4fbc02b3
Parents: 063cb57
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:45:16 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:45:16 2015 -0700

--
 ci/tsqa/tests/test_custom_log.py | 71 +++
 1 file changed, 71 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e3997919/ci/tsqa/tests/test_custom_log.py
--
diff --git a/ci/tsqa/tests/test_custom_log.py b/ci/tsqa/tests/test_custom_log.py
new file mode 100644
index 000..37573b7
--- /dev/null
+++ b/ci/tsqa/tests/test_custom_log.py
@@ -0,0 +1,71 @@
+'''
+Test custom log field
+'''
+
+#  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 random
+import tsqa.test_cases
+import helpers
+import json
+
+log = logging.getLogger(__name__)
+
+class TestCustomLogField(helpers.EnvironmentCase):
+'''
+Tests for a customed log field called hii
+'''
+@classmethod
+def setUpEnv(cls, env):
+
+cls.configs['remap.config'].add_line(
+'map / http://www.linkedin.com/ @action=deny'
+)
+cls.log_file_name = 'test_log_field'
+cls.configs['records.config']['CONFIG'].update({
+  'proxy.config.log.custom_logs_enabled': 1,
+})
+
+cls.log_file_path = os.path.join(cls.environment.layout.prefix, 
'var/log/test_log_field.log')
+cls.log_etc_file = os.path.join(cls.environment.layout.prefix, 
'etc/trafficserver/logs_xml.config')
+cls.configs['logs_xml.config'].add_line(' %"/>')
+cls.configs['logs_xml.config'].add_line('')
+
+def ip_to_hex(self, ipstr):
+  num_list = ipstr.split('.')
+  int_value = (int(num_list[0]) << 24) + (int(num_list[1]) << 16) + 
(int(num_list[2]) << 8) + (int(num_list[3]))
+  return hex(int_value).upper()[2:]
+
+def test_log_field(self):
+  random.seed()
+  times = 10
+  for i in xrange(times):
+request_ip = "127.%d.%d.%d" % (random.randint(1, 255), 
random.randint(1, 255), random.randint(1, 255))
+url = 'http://%s:%s' % (request_ip, 
self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+r = requests.get(url)
+#get the last line of the log file
+time.sleep(10)
+with open(self.log_file_path) as f:
+  for line in f:
+pass
+expected_line = "%s %s\n" % (request_ip, self.ip_to_hex(request_ip))
+self.assertEqual(line, expected_line)



[4/5] trafficserver git commit: Merge branch 'customLog' of https://github.com/zizhong/trafficserver

2015-07-22 Thread briang
Merge branch 'customLog' of https://github.com/zizhong/trafficserver


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

Branch: refs/heads/master
Commit: aa8170a4615fa1a721bd4295a3be1b6cb52a488d
Parents: db4029a 727f6ca
Author: Brian Geffon 
Authored: Wed Jul 22 21:00:30 2015 -0700
Committer: Brian Geffon 
Committed: Wed Jul 22 21:00:30 2015 -0700

--
 ci/tsqa/tests/test_custom_log.py   | 71 +
 doc/admin/event-logging-formats.en.rst | 10 
 proxy/logging/Log.cc   | 11 +
 proxy/logging/LogAccess.cc |  5 ++
 proxy/logging/LogAccess.h  |  9 ++--
 proxy/logging/LogAccessHttp.cc |  6 +++
 proxy/logging/LogAccessHttp.h  |  1 +
 7 files changed, 109 insertions(+), 4 deletions(-)
--




[3/4] trafficserver git commit: TS-3779: Body Factory: support per host error pages: DOCUMENTATION

2015-07-22 Thread briang
TS-3779: Body Factory: support per host error pages: DOCUMENTATION


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

Branch: refs/heads/master
Commit: ee92ad2ddb90570a7f2f94bc7f11afed6904268a
Parents: 1ee3c26
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:37:31 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:37:31 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ee92ad2d/doc/reference/configuration/records.config.en.rst
--
diff --git a/doc/reference/configuration/records.config.en.rst 
b/doc/reference/configuration/records.config.en.rst
index 8ada5e1..0b0a150 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -1690,6 +1690,7 @@ Customizable User Response Pages
 
-  ``1`` = enable customizable user response pages in the default directory 
only
-  ``2`` = enable language-targeted user response pages
+   -  ``3`` = enable host-targeted user response pages
 
 .. ts:cv:: CONFIG proxy.config.body_factory.enable_logging INT 0
 



[1/4] trafficserver git commit: TS-3779: Body Factory: support per host error pages

2015-07-22 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master b2b004066 -> f5e521e63


TS-3779: Body Factory: support per host error pages


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

Branch: refs/heads/master
Commit: 09beb115c52802bab2967bde2ac9c7cdc14fd68d
Parents: bb6f9f3
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:28:32 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:28:32 2015 -0700

--
 proxy/http/HttpBodyFactory.cc | 22 +-
 proxy/http/HttpBodyFactory.h  |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/09beb115/proxy/http/HttpBodyFactory.cc
--
diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc
index 51a3e8f..89960b2 100644
--- a/proxy/http/HttpBodyFactory.cc
+++ b/proxy/http/HttpBodyFactory.cc
@@ -419,10 +419,13 @@ HttpBodyFactory::fabricate(StrList *acpt_language_list, 
StrList *acpt_charset_li
 Debug("body_factory", "  customization disabled, returning NULL template");
 return (NULL);
   }
+
   // what set should we use (language target if enable_customizations == 2)
   if (enable_customizations == 2)
 set = determine_set_by_language(acpt_language_list, acpt_charset_list);
-  else
+  else if (enable_customizations == 3) {
+set = determine_set_by_host(context);
+  } else
 set = "default";
 
   if (set_return)
@@ -446,6 +449,23 @@ HttpBodyFactory::fabricate(StrList *acpt_language_list, 
StrList *acpt_charset_li
 
 // LOCKING: must be called with lock taken
 const char *
+HttpBodyFactory::determine_set_by_host(HttpTransact::State *context) {
+  const char *set;
+  RawHashTable_Value v;
+  int host_len = context->hh_info.host_len;
+  char host_buffer[host_len + 1];
+  strncpy(host_buffer, context->hh_info.request_host, host_len);
+  host_buffer[host_len] = '\0';
+  if (table_of_sets->getValue((RawHashTable_Key)host_buffer, &v)) {
+set = 
table_of_sets->getKeyFromBinding(table_of_sets->getCurrentBinding((RawHashTable_Key)host_buffer));
+  } else {
+set = "default";
+  }
+  return set;
+}
+
+// LOCKING: must be called with lock taken
+const char *
 HttpBodyFactory::determine_set_by_language(StrList *acpt_language_list, 
StrList *acpt_charset_list)
 {
   float Q_best;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/09beb115/proxy/http/HttpBodyFactory.h
--
diff --git a/proxy/http/HttpBodyFactory.h b/proxy/http/HttpBodyFactory.h
index 110b0df..f5c4086 100644
--- a/proxy/http/HttpBodyFactory.h
+++ b/proxy/http/HttpBodyFactory.h
@@ -187,6 +187,7 @@ private:
   const char **set_return = NULL);
 
   const char *determine_set_by_language(StrList *acpt_language_list, StrList 
*acpt_charset_list);
+  const char *determine_set_by_host(HttpTransact::State *context);
   HttpBodyTemplate *find_template(const char *set, const char *type, 
HttpBodySet **body_set_return);
   bool is_response_suppressed(HttpTransact::State *context);
   bool



[2/4] trafficserver git commit: TS-3779: Body Factory: support per host error pages: TESTS

2015-07-22 Thread briang
TS-3779: Body Factory: support per host error pages: TESTS


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

Branch: refs/heads/master
Commit: 1ee3c26c19c3952c6249e0ce57e57c444cd07064
Parents: 09beb11
Author: Zizhong Zhang 
Authored: Mon Jul 20 22:34:44 2015 -0700
Committer: Zizhong Zhang 
Committed: Mon Jul 20 22:34:44 2015 -0700

--
 ci/tsqa/tests/test_body_factory.py | 79 +
 1 file changed, 79 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ee3c26c/ci/tsqa/tests/test_body_factory.py
--
diff --git a/ci/tsqa/tests/test_body_factory.py 
b/ci/tsqa/tests/test_body_factory.py
new file mode 100644
index 000..fd8f8b5
--- /dev/null
+++ b/ci/tsqa/tests/test_body_factory.py
@@ -0,0 +1,79 @@
+'''
+Test body_factory
+'''
+
+#  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 random
+import tsqa.test_cases
+import helpers
+import json
+
+log = logging.getLogger(__name__)
+
+class TestDomainSpecificBodyFactory(helpers.EnvironmentCase):
+'''
+Tests for how body factory works with requests of different domains
+'''
+@classmethod
+def setUpEnv(cls, env):
+cls.configs['records.config']['CONFIG'].update({
+'proxy.config.body_factory.enable_customizations': 3,  # enable 
domain specific body factory
+})
+cls.configs['remap.config'].add_line(
+'map / http://www.linkedin.com/ @action=deny'
+)
+cls.body_factory_dir = os.path.join(cls.environment.layout.prefix, 
cls.configs['records.config']['CONFIG']['proxy.config.body_factory.template_sets_dir'])
+cls.domain_directory = ['www.linkedin.com', '127.0.0.1', 
'www.foobar.net']
+for directory_item in cls.domain_directory:
+current_dir = os.path.join(cls.body_factory_dir, directory_item)
+try:
+os.mkdir(current_dir)
+except:
+pass
+fname = os.path.join(current_dir, "access#denied")
+with open(fname, "w") as f:
+  f.write(directory_item)
+fname = os.path.join(current_dir, ".body_factory_info")
+with open(fname, "w") as f:
+  pass
+
+def test_domain_specific_body_factory(self):
+  times = 1000
+  no_dir_domain = 'www.nodir.com'
+  self.domain_directory.append(no_dir_domain)
+  self.assertEqual(4, len(self.domain_directory))
+  url = 
'http://127.1.0.1:{0}'.format(self.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+  for i in xrange(times):
+  domain = random.choice(self.domain_directory)
+  headers = {'Host' : domain}
+  r = requests.get(url, headers = headers)
+  domain_in_response = no_dir_domain
+  for domain_item in self.domain_directory:
+  if domain_item in r.text:
+   domain_in_response = domain_item
+   break
+  self.assertEqual(domain, domain_in_response)
+
+
+
+



[4/4] trafficserver git commit: Merge branch 'bodyFactory' of https://github.com/zizhong/trafficserver

2015-07-22 Thread briang
Merge branch 'bodyFactory' of https://github.com/zizhong/trafficserver


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

Branch: refs/heads/master
Commit: f5e521e630515c7d745e12bc5b71fa049a21f2a7
Parents: b2b0040 ee92ad2
Author: Brian Geffon 
Authored: Wed Jul 22 21:09:11 2015 -0700
Committer: Brian Geffon 
Committed: Wed Jul 22 21:09:11 2015 -0700

--
 ci/tsqa/tests/test_body_factory.py  | 79 
 .../configuration/records.config.en.rst |  1 +
 proxy/http/HttpBodyFactory.cc   | 22 +-
 proxy/http/HttpBodyFactory.h|  1 +
 4 files changed, 102 insertions(+), 1 deletion(-)
--




[1/2] trafficserver git commit: TS-3773: HostDB view all: add more detail for RR records

2015-07-23 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 392d3abc9 -> d3a7f1b2f


TS-3773: HostDB view all: add more detail for RR records


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

Branch: refs/heads/master
Commit: 08b5af2f89f4b05bca7a0b59076eae1c8894e163
Parents: f5e521e
Author: Brian Geffon 
Authored: Thu Jul 23 00:02:27 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 23 00:02:27 2015 -0700

--
 iocore/hostdb/HostDB.cc | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08b5af2f/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 99a8480..0c91ea3 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2430,7 +2430,20 @@ struct ShowHostDB : public ShowCont {
   {
 if (event == EVENT_INTERVAL) {
   HostDBInfo *r = reinterpret_cast(e);
-  return showOne(r, false, event, e);
+  showOne(r,false,event,e);
+  if (r->round_robin) {
+  HostDBRoundRobin *rr_data = r->rr();
+  if (rr_data) {
+CHECK_SHOW(show("\n"));
+CHECK_SHOW(show("%s%d\n", "Total", 
rr_data->rrcount));
+CHECK_SHOW(show("%s%d\n", "Good", 
rr_data->good));
+CHECK_SHOW(show("%s%d\n", 
"Current", rr_data->current));
+CHECK_SHOW(show("\n"));
+
+for (int i = 0; i < rr_data->rrcount; i++)
+  showOne(&rr_data->info[i], true, event, e);
+  }
+ }
 } else if (event == EVENT_DONE) {
   return complete(event, e);
 } else {



[2/2] trafficserver git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2015-07-23 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: d3a7f1b2f847feee3c17f1eaaa91df50ffef5e25
Parents: 08b5af2 392d3ab
Author: Brian Geffon 
Authored: Thu Jul 23 00:02:43 2015 -0700
Committer: Brian Geffon 
Committed: Thu Jul 23 00:02:43 2015 -0700

--
 proxy/hdrs/HdrHeap.cc | 2 +-
 proxy/hdrs/MIME.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--




[2/2] trafficserver git commit: Merge branch 'log-pqsp' of https://github.com/jwendell/trafficserver

2015-07-26 Thread briang
Merge branch 'log-pqsp' of https://github.com/jwendell/trafficserver


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

Branch: refs/heads/master
Commit: aa59a0d5274f54bff23b8af83a6fe020b39cf3df
Parents: a90403e 44da264
Author: Brian Geffon 
Authored: Sun Jul 26 20:31:23 2015 -0700
Committer: Brian Geffon 
Committed: Sun Jul 26 20:31:23 2015 -0700

--
 proxy/logging/Log.cc   |  5 +
 proxy/logging/LogAccess.cc |  9 +
 proxy/logging/LogAccess.h  |  1 +
 proxy/logging/LogAccessHttp.cc | 10 ++
 proxy/logging/LogAccessHttp.h  |  1 +
 5 files changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa59a0d5/proxy/logging/Log.cc
--

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa59a0d5/proxy/logging/LogAccess.cc
--

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa59a0d5/proxy/logging/LogAccess.h
--

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa59a0d5/proxy/logging/LogAccessHttp.cc
--

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa59a0d5/proxy/logging/LogAccessHttp.h
--



[1/2] trafficserver git commit: TS-3781: Add the log field "pqsp" (server port)

2015-07-26 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master a90403e9f -> aa59a0d52


TS-3781: Add the log field "pqsp" (server port)

We already have the server IP available as a field for logging.
This patch adds the server port as well.


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

Branch: refs/heads/master
Commit: 44da26474dece5868f5d49316286ffd3fb2bbe34
Parents: bb6f9f3
Author: Jonh Wendell 
Authored: Mon Jul 20 19:41:59 2015 -0300
Committer: Jonh Wendell 
Committed: Mon Jul 20 19:41:59 2015 -0300

--
 proxy/logging/Log.cc   |  5 +
 proxy/logging/LogAccess.cc |  9 +
 proxy/logging/LogAccess.h  |  1 +
 proxy/logging/LogAccessHttp.cc | 10 ++
 proxy/logging/LogAccessHttp.h  |  1 +
 5 files changed, 26 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44da2647/proxy/logging/Log.cc
--
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 01921f4..617c16c 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -587,6 +587,11 @@ Log::init_fields()
   global_field_list.add(field, false);
   ink_hash_table_insert(field_symbol_hash, "pqsi", field);
 
+  field = new LogField("proxy_req_server_port", "pqsp", LogField::sINT, 
&LogAccess::marshal_proxy_req_server_port,
+   &LogAccess::unmarshal_int_to_str);
+  global_field_list.add(field, false);
+  ink_hash_table_insert(field_symbol_hash, "pqsp", field);
+
   Ptr hierarchy_map = make_ptr(new LogFieldAliasTable);
   hierarchy_map->init(
 36, SQUID_HIER_EMPTY, "EMPTY", SQUID_HIER_NONE, "NONE", SQUID_HIER_DIRECT, 
"DIRECT", SQUID_HIER_SIBLING_HIT, "SIBLING_HIT",

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44da2647/proxy/logging/LogAccess.cc
--
diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index bea3b1b..9e57dca 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -389,6 +389,15 @@ LogAccess::marshal_proxy_req_server_ip(char *buf)
   -*/
 
 int
+LogAccess::marshal_proxy_req_server_port(char *buf)
+{
+  DEFAULT_INT_FIELD;
+}
+
+/*-
+  -*/
+
+int
 LogAccess::marshal_proxy_hierarchy_route(char *buf)
 {
   DEFAULT_INT_FIELD;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44da2647/proxy/logging/LogAccess.h
--
diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h
index 143aedf..15c5181 100644
--- a/proxy/logging/LogAccess.h
+++ b/proxy/logging/LogAccess.h
@@ -213,6 +213,7 @@ public:
   inkcoreapi virtual int marshal_proxy_req_body_len(char *);// INT
   inkcoreapi virtual int marshal_proxy_req_server_name(char *); // STR
   inkcoreapi virtual int marshal_proxy_req_server_ip(char *);   // INT
+  inkcoreapi virtual int marshal_proxy_req_server_port(char *); // INT
   inkcoreapi virtual int marshal_proxy_hierarchy_route(char *); // INT
   inkcoreapi virtual int marshal_proxy_host_name(char *);   // STR
   inkcoreapi virtual int marshal_proxy_host_ip(char *); // STR

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44da2647/proxy/logging/LogAccessHttp.cc
--
diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc
index 8d457ab..40779f4 100644
--- a/proxy/logging/LogAccessHttp.cc
+++ b/proxy/logging/LogAccessHttp.cc
@@ -906,6 +906,16 @@ LogAccessHttp::marshal_proxy_req_server_ip(char *buf)
   return marshal_ip(buf, m_http_sm->t_state.current.server != NULL ? 
&m_http_sm->t_state.current.server->dst_addr.sa : 0);
 }
 
+int
+LogAccessHttp::marshal_proxy_req_server_port(char *buf)
+{
+  if (buf) {
+  uint16_t port = ntohs(m_http_sm->t_state.current.server != NULL ? 
m_http_sm->t_state.current.server->dst_addr.port() : 0);
+  marshal_int(buf, port);
+  }
+  return INK_MIN_ALIGN;
+}
+
 /*-
   -*/
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/44da2647/proxy/logging/LogAccessHttp.h
--
diff --git a/proxy/logging/LogAccessHttp.h b/proxy/logging/LogAccessHttp.h
index 9847

trafficserver git commit: TS-3800: HostDB UI: support json output, improve srv records, add hostnames

2015-07-27 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 95f45d4a7 -> 0e703e1e3


TS-3800: HostDB UI: support json output, improve srv records, add hostnames


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

Branch: refs/heads/master
Commit: 0e703e1e3b7198f5c4b0648971fd35d56421e4fd
Parents: 95f45d4
Author: Brian Geffon 
Authored: Mon Jul 27 22:14:09 2015 -0700
Committer: Brian Geffon 
Committed: Mon Jul 27 22:14:09 2015 -0700

--
 iocore/hostdb/HostDB.cc   | 169 ++---
 iocore/hostdb/I_HostDBProcessor.h |   3 +
 proxy/Show.h  |  16 +++-
 3 files changed, 153 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e703e1e/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 9d5ece3..5a9c85a 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1364,6 +1364,12 @@ HostDBContinuation::lookup_done(IpAddr const &ip, char 
const *aname, bool around
   }
 }
   }
+
+  const size_t s_size = strlen(aname) + 1;
+  void *host_dest = hostDB.alloc(&i->hostname_offset, s_size);
+  ink_strlcpy((char *)host_dest, aname, s_size);
+  *((char *)host_dest + s_size) = '\0';
+
   if (from_cont)
 do_put_response(from, i, from_cont);
   ink_assert(!i->round_robin || !i->reverse_dns);
@@ -2311,6 +2317,17 @@ HostDBInfo::hostname()
   return (char *)hostDB.ptr(&data.hostname_offset, 
hostDB.ptr_to_partition((char *)this));
 }
 
+/*
+ * The perm_hostname exists for all records not just reverse dns records.
+ */
+char *
+HostDBInfo::perm_hostname()
+{
+  if (hostname_offset == 0)
+return NULL;
+
+  return (char *)hostDB.ptr(&hostname_offset, hostDB.ptr_to_partition((char 
*)this));
+}
 
 HostDBRoundRobin *
 HostDBInfo::rr()
@@ -2373,6 +2390,8 @@ struct ShowHostDB : public ShowCont {
   uint16_t port;
   IpEndpoint ip;
   bool force;
+  bool output_json;
+  int records_seen;
 
   int
   showMain(int event, Event *e)
@@ -2412,8 +2431,12 @@ struct ShowHostDB : public ShowCont {
   int
   showAll(int event, Event *e)
   {
-CHECK_SHOW(begin("HostDB All Records"));
-CHECK_SHOW(show(""));
+if (!output_json) {
+  CHECK_SHOW(begin("HostDB All Records"));
+  CHECK_SHOW(show(""));
+} else {
+  CHECK_SHOW(show("["));
+}
 SET_HANDLER(&ShowHostDB::showAllEvent);
 hostDBProcessor.iterate(this);
 return EVENT_CONT;
@@ -2424,22 +2447,54 @@ struct ShowHostDB : public ShowCont {
   {
 if (event == EVENT_INTERVAL) {
   HostDBInfo *r = reinterpret_cast(e);
+  if (output_json && records_seen++ > 0) {
+CHECK_SHOW(show(",")); // we need to seperate records
+  }
   showOne(r, false, event, e);
   if (r->round_robin) {
 HostDBRoundRobin *rr_data = r->rr();
 if (rr_data) {
-  CHECK_SHOW(show("\n"));
-  CHECK_SHOW(show("%s%d\n", "Total", 
rr_data->rrcount));
-  CHECK_SHOW(show("%s%d\n", "Good", 
rr_data->good));
-  CHECK_SHOW(show("%s%d\n", "Current", 
rr_data->current));
-  CHECK_SHOW(show("\n"));
+  if (!output_json) {
+CHECK_SHOW(show("\n"));
+CHECK_SHOW(show("%s%d\n", "Total", 
rr_data->rrcount));
+CHECK_SHOW(show("%s%d\n", "Good", 
rr_data->good));
+CHECK_SHOW(show("%s%d\n", "Current", 
rr_data->current));
+CHECK_SHOW(show("\n"));
+  } else {
+CHECK_SHOW(show(",\"%s\":\"%d\",", "rr_total", rr_data->rrcount));
+CHECK_SHOW(show("\"%s\":\"%d\",", "rr_good", rr_data->good));
+CHECK_SHOW(show("\"%s\":\"%d\",", "rr_current", rr_data->current));
+CHECK_SHOW(show("\"rr_records\":["));
+  }
 
-  for (int i = 0; i < rr_data->rrcount; i++)
-showOne(&rr_data->info[i], true, event, e);
+  for (int i = 0; i < rr_data->rrcount; i++) {
+showOne(&rr_data->info[i], true, event, e, rr_data);
+if (output_json) {
+  CHECK_SHOW(show("}")); // we need to seperate records
+  if (i < (rr_data->rrcount - 1))
+CHECK_SHOW(show(","));
+}
+  }
+
+  if (!output_json) {
+CHECK_SHOW(show("\n\n"));
+  } else {
+CHECK_SHOW(show("]"));
+  }
 }
   }
+
+  if (output_json) {
+CHECK_SHOW(show("}"));
+  }
+
 } else if (event == EVENT_DONE) {
-  return complete(event, e);
+  if (output_json) {
+CHECK_SHOW(show("]"));
+   

trafficserver git commit: TS-3803: CID 1313322 CID 1313322: HostDB memory issues (introduced in TS-3800)

2015-07-28 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master ec7479243 -> 0cd1ef3ed


TS-3803: CID 1313322 CID 1313322: HostDB memory issues (introduced in TS-3800)


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

Branch: refs/heads/master
Commit: 0cd1ef3ed5e4e6e3a332bccdd07220be717f2226
Parents: ec74792
Author: Brian Geffon 
Authored: Tue Jul 28 19:43:35 2015 -0700
Committer: Brian Geffon 
Committed: Tue Jul 28 19:43:35 2015 -0700

--
 iocore/hostdb/HostDB.cc | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0cd1ef3e/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 5a9c85a..0d36fd6 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1365,10 +1365,18 @@ HostDBContinuation::lookup_done(IpAddr const &ip, char 
const *aname, bool around
 }
   }
 
-  const size_t s_size = strlen(aname) + 1;
-  void *host_dest = hostDB.alloc(&i->hostname_offset, s_size);
-  ink_strlcpy((char *)host_dest, aname, s_size);
-  *((char *)host_dest + s_size) = '\0';
+  if (aname) {
+const size_t s_size = strlen(aname) + 1;
+void *host_dest = hostDB.alloc(&i->hostname_offset, s_size);
+if (host_dest) {
+  ink_strlcpy((char *)host_dest, aname, s_size);
+  *((char *)host_dest + s_size) = '\0';
+} else {
+  Warning("Out of room in hostdb for hostname (data area full!)");
+  hostDB.delete_block(i);
+  return NULL;
+}
+  }
 
   if (from_cont)
 do_put_response(from, i, from_cont);



trafficserver git commit: TS-3800: Fix bug in hostdb ui related to missing query

2015-07-28 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 0cd1ef3ed -> fc133036c


TS-3800: Fix bug in hostdb ui related to missing query


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

Branch: refs/heads/master
Commit: fc133036c2e4a6cd8d95c9432cd62e703a3303b1
Parents: 0cd1ef3
Author: Brian Geffon 
Authored: Tue Jul 28 20:20:57 2015 -0700
Committer: Brian Geffon 
Committed: Tue Jul 28 20:20:57 2015 -0700

--
 iocore/hostdb/HostDB.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc133036/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 0d36fd6..984d137 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2672,7 +2672,7 @@ register_ShowHostDB(Continuation *c, HTTPHdr *h)
   } else if (STR_LEN_EQ_PREFIX(path, path_len, "showall")) {
 int query_len = 0;
 const char *query = h->url_get()->query_get(&query_len);
-if (strstr(query, "json")) {
+if (query && query_len && strstr(query, "json")) {
   s->output_json = true;
 }
 Debug("hostdb", "dumping all hostdb records");



trafficserver git commit: TS-3376: traffic_server failed assert s->current.server->had_connect_fail()

2015-08-02 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master a532d6d9d -> 619b0390f


TS-3376: traffic_server failed assert s->current.server->had_connect_fail()


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

Branch: refs/heads/master
Commit: 619b0390f711e77b39b82e8791655f7597abbca3
Parents: a532d6d
Author: Brian Geffon 
Authored: Sun Aug 2 20:35:30 2015 -0700
Committer: Brian Geffon 
Committed: Sun Aug 2 20:35:30 2015 -0700

--
 proxy/http/HttpTransact.cc | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/619b0390/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b63f8bc..48cf2a0 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3651,6 +3651,11 @@ HttpTransact::handle_response_from_server(State *s)
 break;
   case CONNECTION_CLOSED:
   /* fall through */
+DebugTxn("http_trans",
+  "[handle_response_from_server] Transaction received a bad 
response or a partial response, not retrying...");
+ SET_VIA_STRING(VIA_DETAIL_SERVER_CONNECT, VIA_DETAIL_SERVER_FAILURE);
+ handle_server_connection_not_open(s);
+ break;
   case PARSE_ERROR:
   /* fall through */
   case BAD_INCOMING_RESPONSE: {
@@ -3658,7 +3663,8 @@ HttpTransact::handle_response_from_server(State *s)
 DebugTxn("http_trans",
  "[handle_response_from_server] Transaction received a bad 
response or a partial response, not retrying...");
 SET_VIA_STRING(VIA_DETAIL_SERVER_CONNECT, VIA_DETAIL_SERVER_FAILURE);
-handle_server_connection_not_open(s);
+handle_server_died(s);
+s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
 break;
   }
   case OPEN_RAW_ERROR:



trafficserver git commit: TS-3776: traffic_server failed assert s->current.server->had_connect_fail()

2015-08-03 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 2ce049b03 -> 679006e2e


TS-3776: traffic_server failed assert s->current.server->had_connect_fail()


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

Branch: refs/heads/master
Commit: 679006e2e0de239d081268bc61f430f343271516
Parents: 2ce049b
Author: Brian Geffon 
Authored: Mon Aug 3 20:23:03 2015 -0700
Committer: Brian Geffon 
Committed: Mon Aug 3 20:23:03 2015 -0700

--
 proxy/http/HttpTransact.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/679006e2/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b63f8bc..ff82c09 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3658,7 +3658,8 @@ HttpTransact::handle_response_from_server(State *s)
 DebugTxn("http_trans",
  "[handle_response_from_server] Transaction received a bad 
response or a partial response, not retrying...");
 SET_VIA_STRING(VIA_DETAIL_SERVER_CONNECT, VIA_DETAIL_SERVER_FAILURE);
-handle_server_connection_not_open(s);
+handle_server_died(s);
+s->next_action = SM_ACTION_SEND_ERROR_CACHE_NOOP;
 break;
   }
   case OPEN_RAW_ERROR:



[4/4] trafficserver git commit: Merge branch 'TS-3828' of https://github.com/zizhong/trafficserver

2015-08-06 Thread briang
Merge branch 'TS-3828' of https://github.com/zizhong/trafficserver


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

Branch: refs/heads/master
Commit: 2f154297a749bc9da54ce4373ef7198dcd75fb02
Parents: 1bf8746 a0f8567
Author: Brian Geffon 
Authored: Thu Aug 6 18:46:47 2015 -0700
Committer: Brian Geffon 
Committed: Thu Aug 6 18:46:47 2015 -0700

--
 ci/tsqa/tests/test_headrequest.py | 121 +
 proxy/http/HttpTransact.cc|   6 +-
 2 files changed, 126 insertions(+), 1 deletion(-)
--




[2/4] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS

2015-08-06 Thread briang
TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD 
TESTS


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

Branch: refs/heads/master
Commit: d7fa8ccdde14b205ebb6ce423df7313e69574794
Parents: aa9b94f
Author: Zizhong Zhang 
Authored: Thu Aug 6 01:51:54 2015 -0700
Committer: Zizhong Zhang 
Committed: Thu Aug 6 01:51:54 2015 -0700

--
 ci/tsqa/tests/test_headrequest.py | 118 +
 1 file changed, 118 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d7fa8ccd/ci/tsqa/tests/test_headrequest.py
--
diff --git a/ci/tsqa/tests/test_headrequest.py 
b/ci/tsqa/tests/test_headrequest.py
new file mode 100644
index 000..1e75edc
--- /dev/null
+++ b/ci/tsqa/tests/test_headrequest.py
@@ -0,0 +1,118 @@
+'''
+Test Head Request
+'''
+
+#  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 random
+import tsqa.test_cases
+import helpers
+import json
+import select
+import socket
+
+log = logging.getLogger(__name__)
+
+
+class HeadRequestServerHandler(SocketServer.BaseRequestHandler):
+""" 
+A subclass of RequestHandler which will response to head requests
+"""
+
+def handle(self):
+# Receive the data in small chunks and retransmit it
+while True:
+data = self.request.recv(4096).strip()
+if data:
+log.debug('Sending data back to the client')
+else:
+log.debug('Client disconnected')
+break
+if 'TE' in data:
+resp = ('HTTP/1.1 200 OK\r\n'
+'Server: Apache-Coyote/1.1\r\n'
+'Transfer-Encoding: chunked\r\n'
+'Vary: Accept-Encoding\r\n'
+'\r\n'
+)  
+self.request.sendall(resp)
+elif 'CL' in data:
+resp = ('HTTP/1.1 200 OK\r\n'
+'Server: Apache-Coyote/1.1\r\n'
+'Content-Length: 123\r\n'
+'Vary: Accept-Encoding\r\n'
+'\r\n'
+)  
+self.request.sendall(resp)
+else:
+resp = ('HTTP/1.1 200 OK\r\n'
+'Server: Apache-Coyote/1.1\r\n'
+'Vary: Accept-Encoding\r\n'
+'\r\n'
+)  
+self.request.sendall(resp)
+
+
+
+class TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
+'''
+Tests for ATS handling head requests correctly without waiting for the 
http body
+'''
+@classmethod
+def setUpEnv(cls, env):
+cls.timeout = 5
+cls.configs['records.config']['CONFIG'].update({
+'proxy.config.http.transaction_no_activity_timeout_out': 
cls.timeout,
+})
+cls.socket_server = 
tsqa.endpoint.SocketServerDaemon(HeadRequestServerHandler)
+cls.socket_server.start()
+cls.socket_server.ready.wait()
+cls.configs['remap.config'].add_line('map / 
http://127.0.0.1:{0}/'.format(cls.socket_server.port))
+log.info('map / http://127.0.0.1:{0}/'.format(cls.socket_server.port))
+
+cls.proxy_host = '127.0.0.1'
+cls.proxy_port = 
int(cls.configs['records.config']['CONFIG']['proxy.config.http.server_ports'])
+
+def test_head_request_without_timout(cls):
+request_cases = ['TE', 'CL', '']
+for request_case in request_cases:
+begin_time = time.time()
+conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+conn.connect((cls.proxy_host, cls.proxy_port))
+request_content = 'HEAD / HTTP/1.1\r\nConnection: close\r\nHost: 
127.0.0.1\r\nC

[1/4] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked

2015-08-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 1bf8746e0 -> 2f154297a


TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked


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

Branch: refs/heads/master
Commit: aa9b94fab4020798b81a749f6e5994387f7a09c9
Parents: 5597664
Author: Zizhong Zhang 
Authored: Thu Aug 6 01:49:50 2015 -0700
Committer: Zizhong Zhang 
Committed: Thu Aug 6 01:49:50 2015 -0700

--
 proxy/http/HttpTransact.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aa9b94fa/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 3fb42fa..a4d492e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7928,8 +7928,12 @@ HttpTransact::build_response(State *s, HTTPHdr 
*base_response, HTTPHdr *outgoing
 
   // If the response is prohibited from containing a body,
   //  we know the content length is trustable for keep-alive
-  if (is_response_body_precluded(status_code, s->method))
+  if (is_response_body_precluded(status_code, s->method)) {
 s->hdr_info.trust_response_cl = true;
+s->hdr_info.response_content_length = 0;
+s->client_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+s->server_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+  }
 
   handle_response_keep_alive_headers(s, outgoing_version, outgoing_response);
 



[3/4] trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD TESTS. ensure the Content-Length is passed over.

2015-08-06 Thread briang
TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked. ADD 
TESTS. ensure the Content-Length is passed over.


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

Branch: refs/heads/master
Commit: a0f8567a2ad75b8c25781e9e20cdcfb208b1fe6b
Parents: d7fa8cc
Author: Zizhong Zhang 
Authored: Thu Aug 6 17:28:38 2015 -0700
Committer: Zizhong Zhang 
Committed: Thu Aug 6 17:28:38 2015 -0700

--
 ci/tsqa/tests/test_headrequest.py | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a0f8567a/ci/tsqa/tests/test_headrequest.py
--
diff --git a/ci/tsqa/tests/test_headrequest.py 
b/ci/tsqa/tests/test_headrequest.py
index 1e75edc..a636db8 100644
--- a/ci/tsqa/tests/test_headrequest.py
+++ b/ci/tsqa/tests/test_headrequest.py
@@ -107,6 +107,7 @@ class 
TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
 resp = conn.recv(4096)
 if len(resp) == 0: 
 break
+response_content = resp
 log.info(resp)
 except:
 break
@@ -116,3 +117,5 @@ class 
TestHeadRequestWithoutTimeout(helpers.EnvironmentCase):
 log.info("head request with case(%s) costs %f seconds while the 
timout is %f seconds." % (
 request_case, end_time - begin_time, cls.timeout))
 cls.assertGreater(cls.timeout, end_time - begin_time)
+if request_case == 'CL':
+cls.assertIn('Content-Length', response_content)



trafficserver git commit: TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked

2015-08-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/6.0.x fdceeb5f6 -> 8f89e542c


TS-3828: HEAD requests hang when origin returns Transfer-Encoding: Chunked


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

Branch: refs/heads/6.0.x
Commit: 8f89e542cd7e3927153b01b792d5e56e2b282029
Parents: fdceeb5
Author: Zizhong Zhang 
Authored: Thu Aug 6 01:49:50 2015 -0700
Committer: Brian Geffon 
Committed: Thu Aug 6 18:49:03 2015 -0700

--
 proxy/http/HttpTransact.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8f89e542/proxy/http/HttpTransact.cc
--
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 3fb42fa..a4d492e 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7928,8 +7928,12 @@ HttpTransact::build_response(State *s, HTTPHdr 
*base_response, HTTPHdr *outgoing
 
   // If the response is prohibited from containing a body,
   //  we know the content length is trustable for keep-alive
-  if (is_response_body_precluded(status_code, s->method))
+  if (is_response_body_precluded(status_code, s->method)) {
 s->hdr_info.trust_response_cl = true;
+s->hdr_info.response_content_length = 0;
+s->client_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+s->server_info.transfer_encoding = HttpTransact::NO_TRANSFER_ENCODING;
+  }
 
   handle_response_keep_alive_headers(s, outgoing_version, outgoing_response);
 



[1/2] trafficserver git commit: TS-3792: Pointing proxy.config.dns.resolv_conf at an empty (or nonexistant) file causes crashes.

2015-08-10 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master b597f9cfa -> cc6233173


TS-3792: Pointing proxy.config.dns.resolv_conf at an empty (or nonexistant) 
file causes crashes.


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

Branch: refs/heads/master
Commit: 576c2de9d2e17f6930e718ec34f8fb3baba692d1
Parents: b597f9c
Author: Zizhong Zhang 
Authored: Sun Jul 26 21:46:52 2015 -0700
Committer: Brian Geffon 
Committed: Mon Aug 10 19:40:18 2015 -0700

--
 lib/ts/ink_res_init.cc | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/576c2de9/lib/ts/ink_res_init.cc
--
diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index 958f2dd..00dc938 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -432,7 +432,7 @@ ink_res_init(ink_res_state statp, ///< State object 
to update.
 
 #define MATCH(line, name) \
   (!strncmp(line, name, sizeof(name) - 1) && (line[sizeof(name) - 1] == ' ' || 
line[sizeof(name) - 1] == '\t'))
-
+retry_load_resolve_conf:
   if ((fp = fopen(pResolvConf, "r")) != NULL) {
 /* read the config file */
 while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -521,8 +521,17 @@ ink_res_init(ink_res_state statp, ///< State 
object to update.
 (void)fclose(fp);
   }
 
-  if (nserv > 0)
-statp->nscount = nserv;
+  if (nserv == 0 && strcmp(pResolvConf, "/etc/resolv.conf") != 0) {
+syslog(LOG_WARNING, "WARNING: trying default because user specified did 
not have any resolvers");
+pResolvConf = "/etc/resolv.conf";
+goto retry_load_resolve_conf;
+  }
+  if (nserv == 0) {
+syslog(LOG_ERR, "ERR: aborting the traffic server because it did not have 
any resolvers");
+abort();
+  }
+
+  statp->nscount = nserv;
 
   if (statp->defdname[0] == 0 && gethostname(buf, sizeof(statp->defdname) - 1) 
== 0 && (cp = strchr(buf, '.')) != NULL)
 ink_strlcpy(statp->defdname, cp + 1, sizeof(statp->defdname));



[2/2] trafficserver git commit: TS-3792: Pointing proxy.config.dns.resolv_conf at an empty (or nonexistant) file causes crashes. Prevent ATS from crashing.

2015-08-10 Thread briang
TS-3792: Pointing proxy.config.dns.resolv_conf at an empty (or nonexistant) 
file causes crashes. Prevent ATS from crashing.


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

Branch: refs/heads/master
Commit: cc6233173338d6304b89b959d35a6eda01f98e7c
Parents: 576c2de
Author: Zizhong Zhang 
Authored: Tue Jul 28 22:21:30 2015 -0700
Committer: Brian Geffon 
Committed: Mon Aug 10 19:40:19 2015 -0700

--
 iocore/dns/DNS.cc  |  7 +++
 lib/ts/ink_res_init.cc | 15 +++
 2 files changed, 10 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc623317/iocore/dns/DNS.cc
--
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index 4601147..1cb5698 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -883,6 +883,13 @@ write_dns(DNSHandler *h)
   int max_nscount = h->m_res->nscount;
   if (max_nscount > MAX_NAMED)
 max_nscount = MAX_NAMED;
+  if (max_nscount <= 0) {
+Warning("There is no name server found in the resolv.conf");
+if (h->entries.head) {
+  dns_result(h, h->entries.head, NULL, false);
+}
+return;
+  }
 
   if (h->in_write_dns)
 return;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cc623317/lib/ts/ink_res_init.cc
--
diff --git a/lib/ts/ink_res_init.cc b/lib/ts/ink_res_init.cc
index 00dc938..958f2dd 100644
--- a/lib/ts/ink_res_init.cc
+++ b/lib/ts/ink_res_init.cc
@@ -432,7 +432,7 @@ ink_res_init(ink_res_state statp, ///< State object 
to update.
 
 #define MATCH(line, name) \
   (!strncmp(line, name, sizeof(name) - 1) && (line[sizeof(name) - 1] == ' ' || 
line[sizeof(name) - 1] == '\t'))
-retry_load_resolve_conf:
+
   if ((fp = fopen(pResolvConf, "r")) != NULL) {
 /* read the config file */
 while (fgets(buf, sizeof(buf), fp) != NULL) {
@@ -521,17 +521,8 @@ retry_load_resolve_conf:
 (void)fclose(fp);
   }
 
-  if (nserv == 0 && strcmp(pResolvConf, "/etc/resolv.conf") != 0) {
-syslog(LOG_WARNING, "WARNING: trying default because user specified did 
not have any resolvers");
-pResolvConf = "/etc/resolv.conf";
-goto retry_load_resolve_conf;
-  }
-  if (nserv == 0) {
-syslog(LOG_ERR, "ERR: aborting the traffic server because it did not have 
any resolvers");
-abort();
-  }
-
-  statp->nscount = nserv;
+  if (nserv > 0)
+statp->nscount = nserv;
 
   if (statp->defdname[0] == 0 && gethostname(buf, sizeof(statp->defdname) - 1) 
== 0 && (cp = strchr(buf, '.')) != NULL)
 ink_strlcpy(statp->defdname, cp + 1, sizeof(statp->defdname));



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 
Authored: Wed Aug 12 00:25:43 2015 -0700
Committer: Brian Geffon 
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)
+resp = resp.split('\r\n\r

trafficserver git commit: TS-3942: Crash when enumerating HostDB records in HostDB UI

2015-09-24 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master f68e950f3 -> 89606cb54


TS-3942: Crash when enumerating HostDB records in HostDB UI


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

Branch: refs/heads/master
Commit: 89606cb540b026cc238adf78f393221335d69599
Parents: f68e950
Author: Brian Geffon 
Authored: Thu Sep 24 00:49:30 2015 -0700
Committer: Brian Geffon 
Committed: Thu Sep 24 00:49:30 2015 -0700

--
 iocore/hostdb/HostDB.cc | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/89606cb5/iocore/hostdb/HostDB.cc
--
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 984d137..eb5b541 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1598,6 +1598,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
 item.md5_low = r->md5_low;
 item.md5_low_low = r->md5_low_low;
 item.full = 1;
+item.hostname_offset = 0;
 
 item.app.allotment.application1 = 0;
 item.app.allotment.application2 = 0;
@@ -1623,6 +1624,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
   for (ii = 0; ii < nn; ++ii) {
 if (is_addr_valid(af, e->ent.h_addr_list[ii])) {
   HostDBInfo &item = rr_data->info[i];
+  memset(&item, 0, sizeof(item));
   ip_addr_set(item.ip(), af, e->ent.h_addr_list[ii]);
   item.full = 1;
   item.round_robin = 0;
@@ -1632,6 +1634,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
   item.md5_high = r->md5_high;
   item.md5_low = r->md5_low;
   item.md5_low_low = r->md5_low_low;
+  item.hostname_offset = 0;
   if (!restore_info(&item, old_r, old_info, old_rr_data)) {
 item.app.allotment.application1 = 0;
 item.app.allotment.application2 = 0;



trafficserver git commit: TS-3956: Header_rewrite applies strange logic with = operator, this closes #300

2015-10-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 370ad860d -> 8c148c9e8


TS-3956: Header_rewrite applies strange logic with = operator, this
closes #300


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

Branch: refs/heads/master
Commit: 8c148c9e885ea28ead4d46f49350256602b84d82
Parents: 370ad86
Author: Brian Geffon 
Authored: Tue Oct 6 00:06:49 2015 -0700
Committer: Brian Geffon 
Committed: Tue Oct 6 00:15:20 2015 -0700

--
 plugins/header_rewrite/Makefile.am|   6 +-
 plugins/header_rewrite/header_rewrite_test.cc | 225 +
 plugins/header_rewrite/parser.cc  | 141 -
 plugins/header_rewrite/parser.h   |   5 +-
 4 files changed, 323 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8c148c9e/plugins/header_rewrite/Makefile.am
--
diff --git a/plugins/header_rewrite/Makefile.am 
b/plugins/header_rewrite/Makefile.am
index 8a1abf6..5a7acd3 100644
--- a/plugins/header_rewrite/Makefile.am
+++ b/plugins/header_rewrite/Makefile.am
@@ -31,5 +31,9 @@ header_rewrite_la_SOURCES = \
   resources.cc \
   ruleset.cc \
   statement.cc
-
+  
 header_rewrite_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
+
+bin_PROGRAMS = header_rewrite_test
+header_rewrite_test_SOURCES = parser.cc header_rewrite_test.cc
+header_rewrite_test_CXXFLAGS = $(AM_CXXFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8c148c9e/plugins/header_rewrite/header_rewrite_test.cc
--
diff --git a/plugins/header_rewrite/header_rewrite_test.cc 
b/plugins/header_rewrite/header_rewrite_test.cc
new file mode 100644
index 000..ebc9e2b
--- /dev/null
+++ b/plugins/header_rewrite/header_rewrite_test.cc
@@ -0,0 +1,225 @@
+/*
+  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.
+*/
+
+/*
+ * These are misc unit tests for header rewrite
+ */
+
+#include 
+#include 
+#include 
+
+const char PLUGIN_NAME[] = "TEST_header_rewrite";
+const char PLUGIN_NAME_DBG[] = "TEST_dbg_header_rewrite";
+
+extern "C" void TSError(const char* fmt, ...) {
+  char buf[2048];
+  int bytes = 0;
+  va_list args;
+  va_start (args, fmt);
+  if((bytes = vsnprintf (buf, sizeof(buf), fmt, args)) > 0) {
+fprintf(stderr, "TSError: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
+  }
+}
+
+extern "C" void TSDebug(const char *tag, const char* fmt, ...) {
+  char buf[2048];
+  int bytes = 0;
+  va_list args;
+  va_start (args, fmt);
+  if((bytes = vsnprintf (buf, sizeof(buf), fmt, args)) > 0) {
+fprintf(stdout, "TSDebug: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
+  }
+}
+
+#define CHECK_EQ(x, y) \
+  do { \
+   if ( (x) != (y) ) { \
+fprintf(stderr, "CHECK FAILED " #x " != " #y "\n"); \
+return 1; \
+   } \
+  } while (false);
+
+class ParserTest : public Parser {
+public:
+  ParserTest(std::string line) : Parser(line) { }
+
+  std::vector getTokens() {
+return _tokens;
+  }
+};
+
+int test_parsing() {
+
+  {
+ParserTest p("cond  %{READ_REQUEST_HDR_HOOK}");
+CHECK_EQ(p.getTokens().size(), 2);
+CHECK_EQ(p.getTokens()[0], "cond");
+CHECK_EQ(p.getTokens()[1], "%{READ_REQUEST_HDR_HOOK}");
+  }
+
+  {
+ParserTest p("cond %{CLIENT-HEADER:Host}=a");
+CHECK_EQ(p.getTokens().size(), 4);
+CHECK_EQ(p.getTokens()[0], "cond");
+CHECK_EQ(p.getTokens()[1], "%{CLIENT-HEADER:Host}");
+CHECK_EQ(p.getTokens()[2], "=");
+CHECK_EQ(p.getTokens()[3], "a");
+  }
+
+  {
+ParserTest p(" # COMMENT!");
+CHECK_EQ(p.getTokens().size(), 0);
+CHECK_EQ(p.empty(), true);
+  }
+
+  {
+ParserTest p("# COMMENT");
+CHECK_EQ(p.getTokens().size(), 0);
+CHECK_EQ(p.empty(), true);
+  }
+
+  {
+ParserTest p("cond %{Client-HEADER:Foo} =b");
+CHECK_EQ(p.getTokens().size(), 4);
+CHECK_EQ(p.getTokens()

trafficserver git commit: TS-3956: Header_rewrite applies strange logic with = operator, remove %{} which breaks printf

2015-10-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 8c148c9e8 -> 147b9668e


TS-3956: Header_rewrite applies strange logic with = operator, remove %{} which 
breaks printf


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

Branch: refs/heads/master
Commit: 147b9668eea55354b063ba6f77b48b34b65247c9
Parents: 8c148c9
Author: Brian Geffon 
Authored: Tue Oct 6 00:20:26 2015 -0700
Committer: Brian Geffon 
Committed: Tue Oct 6 00:20:26 2015 -0700

--
 plugins/header_rewrite/header_rewrite_test.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/147b9668/plugins/header_rewrite/header_rewrite_test.cc
--
diff --git a/plugins/header_rewrite/header_rewrite_test.cc 
b/plugins/header_rewrite/header_rewrite_test.cc
index ebc9e2b..f4fdabd 100644
--- a/plugins/header_rewrite/header_rewrite_test.cc
+++ b/plugins/header_rewrite/header_rewrite_test.cc
@@ -50,7 +50,7 @@ extern "C" void TSDebug(const char *tag, const char* fmt, 
...) {
 #define CHECK_EQ(x, y) \
   do { \
if ( (x) != (y) ) { \
-fprintf(stderr, "CHECK FAILED " #x " != " #y "\n"); \
+fprintf(stderr, "CHECK FAILED\n"); \
 return 1; \
} \
   } while (false);



trafficserver git commit: TS-3956: clang format (sorry zwoop ;/)

2015-10-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 147b9668e -> 61cbc5b95


TS-3956: clang format (sorry zwoop ;/)


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

Branch: refs/heads/master
Commit: 61cbc5b95a2d0ebbb1247d10628115112eac8827
Parents: 147b966
Author: Brian Geffon 
Authored: Tue Oct 6 00:24:52 2015 -0700
Committer: Brian Geffon 
Committed: Tue Oct 6 00:24:52 2015 -0700

--
 plugins/header_rewrite/header_rewrite_test.cc | 59 +-
 plugins/header_rewrite/parser.cc  |  9 ++--
 2 files changed, 38 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/61cbc5b9/plugins/header_rewrite/header_rewrite_test.cc
--
diff --git a/plugins/header_rewrite/header_rewrite_test.cc 
b/plugins/header_rewrite/header_rewrite_test.cc
index f4fdabd..4c836e4 100644
--- a/plugins/header_rewrite/header_rewrite_test.cc
+++ b/plugins/header_rewrite/header_rewrite_test.cc
@@ -27,45 +27,53 @@
 const char PLUGIN_NAME[] = "TEST_header_rewrite";
 const char PLUGIN_NAME_DBG[] = "TEST_dbg_header_rewrite";
 
-extern "C" void TSError(const char* fmt, ...) {
+extern "C" void
+TSError(const char *fmt, ...)
+{
   char buf[2048];
   int bytes = 0;
   va_list args;
-  va_start (args, fmt);
-  if((bytes = vsnprintf (buf, sizeof(buf), fmt, args)) > 0) {
+  va_start(args, fmt);
+  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
 fprintf(stderr, "TSError: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
   }
 }
 
-extern "C" void TSDebug(const char *tag, const char* fmt, ...) {
+extern "C" void
+TSDebug(const char *tag, const char *fmt, ...)
+{
   char buf[2048];
   int bytes = 0;
   va_list args;
-  va_start (args, fmt);
-  if((bytes = vsnprintf (buf, sizeof(buf), fmt, args)) > 0) {
+  va_start(args, fmt);
+  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
 fprintf(stdout, "TSDebug: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
   }
 }
 
-#define CHECK_EQ(x, y) \
-  do { \
-   if ( (x) != (y) ) { \
-fprintf(stderr, "CHECK FAILED\n"); \
-return 1; \
-   } \
+#define CHECK_EQ(x, y)   \
+  do {   \
+if ((x) != (y)) {\
+  fprintf(stderr, "CHECK FAILED\n"); \
+  return 1;  \
+}\
   } while (false);
 
-class ParserTest : public Parser {
+class ParserTest : public Parser
+{
 public:
-  ParserTest(std::string line) : Parser(line) { }
+  ParserTest(std::string line) : Parser(line) {}
 
-  std::vector getTokens() {
+  std::vector
+  getTokens()
+  {
 return _tokens;
   }
 };
 
-int test_parsing() {
-
+int
+test_parsing()
+{
   {
 ParserTest p("cond  %{READ_REQUEST_HDR_HOOK}");
 CHECK_EQ(p.getTokens().size(), 2);
@@ -177,8 +185,9 @@ int test_parsing() {
   return 0;
 }
 
-int test_processing() {
-
+int
+test_processing()
+{
   /*
* These tests are designed to verify that the processing of the parsed 
input is correct.
*/
@@ -210,16 +219,18 @@ int test_processing() {
   return 0;
 }
 
-int tests() {
-  if (test_parsing() ||
-  test_processing()) {
+int
+tests()
+{
+  if (test_parsing() || test_processing()) {
 return 1;
   }
 
   return 0;
 }
 
-int main () {
+int
+main()
+{
   return tests();
 }
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/61cbc5b9/plugins/header_rewrite/parser.cc
--
diff --git a/plugins/header_rewrite/parser.cc b/plugins/header_rewrite/parser.cc
index e7e32c3..43ead4a 100644
--- a/plugins/header_rewrite/parser.cc
+++ b/plugins/header_rewrite/parser.cc
@@ -36,9 +36,7 @@ Parser::Parser(const std::string &line) : _cond(false), 
_empty(false)
   off_t cur_token_start = 0;
   size_t cur_token_length = 0;
   for (size_t i = 0; i < line.size(); ++i) {
-
-if (!inquote &&
-(std::isspace(line[i]) || (line[i] == '=' || line[i] == '>' || line[i] 
== '<'))) {
+if (!inquote && (std::isspace(line[i]) || (line[i] == '=' || line[i] == 
'>' || line[i] == '<'))) {
   if (extracting_token) {
 cur_token_length = i - cur_token_start;
 
@@ -129,9 +127,8 @@ Parser::preprocess(std::vector tokens)
   std::string s = tokens[0].substr(2, tokens[0].size() - 3);
 
   _op = s;
-  if (tokens.size() > 2
-  && (tokens[1][0] == '=' || tokens[1][0] == '>' || tokens[1][0] == 
'<')) { // cond + (=/) + argument
- _arg = tokens[1] + tokens[2];
+  if (tokens.size() > 2 && (tokens[1][0] == '=' || tokens[1][0] == '>' ||

trafficserver git commit: Resolve coverity #1325735, #1325734, #1325736

2015-10-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 61cbc5b95 -> e71350b4b


Resolve coverity #1325735, #1325734, #1325736


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

Branch: refs/heads/master
Commit: e71350b4b9c8abc3a81432c203accca03ed172e1
Parents: 61cbc5b
Author: Brian Geffon 
Authored: Tue Oct 6 06:43:58 2015 -0700
Committer: Brian Geffon 
Committed: Tue Oct 6 06:49:31 2015 -0700

--
 plugins/header_rewrite/header_rewrite_test.cc | 2 ++
 plugins/header_rewrite/parser.cc  | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e71350b4/plugins/header_rewrite/header_rewrite_test.cc
--
diff --git a/plugins/header_rewrite/header_rewrite_test.cc 
b/plugins/header_rewrite/header_rewrite_test.cc
index 4c836e4..ff78beb 100644
--- a/plugins/header_rewrite/header_rewrite_test.cc
+++ b/plugins/header_rewrite/header_rewrite_test.cc
@@ -37,6 +37,7 @@ TSError(const char *fmt, ...)
   if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
 fprintf(stderr, "TSError: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
   }
+  va_end(args);
 }
 
 extern "C" void
@@ -49,6 +50,7 @@ TSDebug(const char *tag, const char *fmt, ...)
   if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
 fprintf(stdout, "TSDebug: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
   }
+  va_end(args);
 }
 
 #define CHECK_EQ(x, y)   \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e71350b4/plugins/header_rewrite/parser.cc
--
diff --git a/plugins/header_rewrite/parser.cc b/plugins/header_rewrite/parser.cc
index 43ead4a..609b5be 100644
--- a/plugins/header_rewrite/parser.cc
+++ b/plugins/header_rewrite/parser.cc
@@ -69,9 +69,6 @@ Parser::Parser(const std::string &line) : _cond(false), 
_empty(false)
 return;
   }
 } else if (!extracting_token) {
-  if (inquote)
-continue; /* just keep eating until we hit the closing quote */
-
   if (_tokens.empty() && line[i] == '#') {
 // this is a comment line (it may have had leading whitespace before 
the #)
 _empty = true;



git commit: TS-1742: Freelists to use 64bit version w/ Double Word Compare and Swap

2013-03-11 Thread briang
Updated Branches:
  refs/heads/master bd5816b4b -> 9ddf58ba2


TS-1742: Freelists to use 64bit version w/ Double Word Compare and Swap


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

Branch: refs/heads/master
Commit: 9ddf58ba29288b5315c2effe62de2d0c22d7b1d3
Parents: bd5816b
Author: Brian Geffon 
Authored: Mon Mar 11 16:15:11 2013 -0700
Committer: Brian Geffon 
Committed: Mon Mar 11 16:15:11 2013 -0700

--
 CHANGES|2 +
 configure.ac   |   26 +++
 lib/ts/ink_config.h.in |1 +
 lib/ts/ink_queue.cc|   52 --
 lib/ts/ink_queue.h |   29 ++---
 proxy/logging/LogObject.cc |   24 +
 6 files changed, 110 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ddf58ba/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 68485be..35cc93d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
  -*- coding: utf-8 -*-
   Changes with Apache Traffic Server 3.3.2
+  
+  *) [TS-1742] Freelists to use 64bit version w/ Double Word Compare and Swap
 
   *) [TS-1744] ats run with 1 less event thread then it is supposed to, for
   both auto and manual thread config

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ddf58ba/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 2bef703..86476e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1105,6 +1105,32 @@ AC_MSG_RESULT([$msg])
 
 AC_SUBST(need_union_semun)
 
+
+
+has_128bit_cas=0
+__saved_CFLAGS="${CFLAGS}"
+CFLAGS=-mcx16
+AC_MSG_CHECKING(for 128bit CAS support)
+AC_LANG_PUSH([C])
+AC_RUN_IFELSE(
+  [
+int main() { 
+  __int128_t x = 0;
+  __sync_bool_compare_and_swap(&x,0,10); 
+  return 0;
+}
+  ],
+  [ has_128bit_cas="1" ]
+AC_MSG_RESULT(yes)
+CXXFLAGS+=" -mcx16"
+  ,
+  [ has_128bit_cas="0" ]
+AC_MSG_RESULT(no)
+  )
+AC_LANG_POP
+CFLAGS="${__saved_CFLAGS}"
+AC_SUBST([has_128bit_cas])
+
 # Check for POSIX capabilities library.
 # If we don't find it, disable checking for header.
 use_posix_cap=0

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ddf58ba/lib/ts/ink_config.h.in
--
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 274308c..6b0525c 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -129,6 +129,7 @@
 #define NEED_UNION_SEMUN   @need_union_semun@
 #define SIZEOF_VOID_POINTER@ac_cv_sizeof_voidp@
 #define TS_IP_TRANSPARENT  @ip_transparent@
+#define TS_HAS_128BIT_CAS  @has_128bit_cas@
 
 /* API */
 #define TS_IS_MICRO_BUILD  @is_micro_build@

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ddf58ba/lib/ts/ink_queue.cc
--
diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc
index d62bd43..f467a63 100644
--- a/lib/ts/ink_queue.cc
+++ b/lib/ts/ink_queue.cc
@@ -132,7 +132,6 @@ int fake_global_for_ink_queue = 0;
 #endif
 
 int fastmemtotal = 0;
-
 void *
 ink_freelist_new(InkFreeList * f)
 {
@@ -145,7 +144,7 @@ ink_freelist_new(InkFreeList * f)
   int result = 0;
 
   do {
-INK_QUEUE_LD64(item, f->head);
+INK_QUEUE_LD(item, f->head);
 if (TO_PTR(FREELIST_POINTER(item)) == NULL) {
   uint32_t type_size = f->type_size;
   uint32_t i;
@@ -202,7 +201,11 @@ ink_freelist_new(InkFreeList * f)
 } else {
   SET_FREELIST_POINTER_VERSION(next, 
*ADDRESS_OF_NEXT(TO_PTR(FREELIST_POINTER(item)), 0),
FREELIST_VERSION(item) + 1);
-  result = ink_atomic_cas((int64_t *) & f->head.data, item.data, 
next.data);
+#if TS_HAS_128BIT_CAS
+   result = ink_atomic_cas((__int128_t*)&f->head.data, item.data, 
next.data);
+#else
+   result = ink_atomic_cas((int64_t *) & f->head.data, item.data, 
next.data);
+#endif
 
 #ifdef SANITY
   if (result) {
@@ -263,7 +266,7 @@ ink_freelist_free(InkFreeList * f, void *item)
 
   result = 0;
   do {
-INK_QUEUE_LD64(h, f->head);
+INK_QUEUE_LD(h, f->head);
 #ifdef SANITY
 if (TO_PTR(FREELIST_POINTER(h)) == item)
   ink_fatal(1, "ink_freelist_free: trying to free item twice");
@@ -275,7 +278,12 @@ ink_freelist_free(InkFreeList * f, void *item)
 *adr_of_next = FREELIST_POINTER(h);
 SET_FREELIST_POINTER_VERSION(item_pair, FROM_PTR(item

git commit: TS-1742: correct 32bit freelist case

2013-03-26 Thread briang
Updated Branches:
  refs/heads/master cf0e2f115 -> ca7a84eeb


TS-1742: correct 32bit freelist case


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

Branch: refs/heads/master
Commit: ca7a84eebd0711c254959fc723d9de73f10aef68
Parents: cf0e2f1
Author: Brian Geffon 
Authored: Tue Mar 26 11:26:36 2013 -0700
Committer: Brian Geffon 
Committed: Tue Mar 26 11:26:36 2013 -0700

--
 lib/ts/ink_queue_utils.cc |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ca7a84ee/lib/ts/ink_queue_utils.cc
--
diff --git a/lib/ts/ink_queue_utils.cc b/lib/ts/ink_queue_utils.cc
index c249e77..bea41e2 100644
--- a/lib/ts/ink_queue_utils.cc
+++ b/lib/ts/ink_queue_utils.cc
@@ -71,7 +71,7 @@ ink_queue_load_64(void *dst, void *src)
 {
 #if (defined(__i386__) || defined(__arm__)) && (SIZEOF_VOIDP == 4)
   volatile int32_t src_version = (*(head_p *) src).s.version;
-  volatile void *src_pointer = (*(head_p *) src).s.pointer;
+  void *src_pointer = (*(head_p *) src).s.pointer;
 
   (*(head_p *) dst).s.version = src_version;
   (*(head_p *) dst).s.pointer = src_pointer;



git commit: [TS-2052] ET_SSL thread spinning

2013-08-02 Thread briang
Updated Branches:
  refs/heads/master b91279d99 -> 94e9830c2


[TS-2052] ET_SSL thread spinning


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

Branch: refs/heads/master
Commit: 94e9830c21f046aafe0247fb9c95198fc0902144
Parents: b91279d
Author: Brian Geffon 
Authored: Fri Aug 2 17:43:41 2013 -0700
Committer: Brian Geffon 
Committed: Fri Aug 2 17:43:41 2013 -0700

--
 CHANGES  | 4 +++-
 proxy/http/HttpSM.cc | 6 +-
 2 files changed, 8 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94e9830c/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 3cc9cd7..c8fde03 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.5
-
+  
+  *) [TS-2052] ET_SSL thread spinning
+   Author: Can Selcik 
 
   *) [TS-2090 Make proxy.config.allocator.enable_reclaim default based on
build instructions.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/94e9830c/proxy/http/HttpSM.cc
--
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 5b879bc..7bba241 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -741,7 +741,8 @@ HttpSM::state_read_client_request_header(int event, void 
*data)
   }
 
   // Check to see if we are done parsing the header
-  if (state != PARSE_CONT || ua_entry->eos) {
+  if (state != PARSE_CONT || ua_entry->eos ||
+   (state == PARSE_CONT && event == VC_EVENT_READ_COMPLETE)) {
 if (ua_raw_buffer_reader != NULL) {
 ua_raw_buffer_reader->dealloc();
 ua_raw_buffer_reader = NULL;
@@ -771,6 +772,9 @@ HttpSM::state_read_client_request_header(int event, void 
*data)
 
   call_transact_and_set_next_state(HttpTransact::BadRequest);
   break;
+} else if (event == VC_EVENT_READ_COMPLETE) {
+   DebugSM("http_parse", "[%" PRId64 "] VC_EVENT_READ_COMPLETE and PARSE 
CONT state", sm_id);
+   break;
 } else {
   if (is_transparent_passthrough_allowed() &&
   ua_raw_buffer_reader != NULL &&



git commit: Fixing license and updating notice

2013-10-18 Thread briang
Updated Branches:
  refs/heads/master 7b2ea5f89 -> 6958d0564


Fixing license and updating notice


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

Branch: refs/heads/master
Commit: 6958d056469698a4850d7019259912bec6eb23cb
Parents: 7b2ea5f
Author: Brian Geffon 
Authored: Fri Oct 18 14:54:08 2013 -0700
Committer: Brian Geffon 
Committed: Fri Oct 18 14:54:08 2013 -0700

--
 NOTICE  |  5 ++
 configure.ac| 58 
 lib/Makefile.am |  6 +-
 .../NullTransformationPlugin.cc | 26 +
 4 files changed, 72 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6958d056/NOTICE
--
diff --git a/NOTICE b/NOTICE
index 849f001..b486b5e 100644
--- a/NOTICE
+++ b/NOTICE
@@ -38,3 +38,8 @@ Copyright (C) 2012 Oregon Health & Science University
 
 healthcheck Plugin developed by GoDaddy.
 Copyright (C) 2012 GoDaddy.
+
+~~~
+
+lib/atscppapi developed by LinkedIn
+Copyright (c) 2013 LinkedIn
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6958d056/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 8023755..bb2f373 100644
--- a/configure.ac
+++ b/configure.ac
@@ -480,6 +480,19 @@ AC_ARG_ENABLE([experimental-plugins],
 AC_MSG_RESULT([$enable_experimental_plugins])
 AM_CONDITIONAL([BUILD_EXPERIMENTAL_PLUGINS], [ test 
"x${enable_experimental_plugins}" = "xyes" ])
 
+
+#
+# build c++ api
+#
+AC_MSG_CHECKING([whether to build c++ api])
+AC_ARG_ENABLE([cppapi],
+  [AS_HELP_STRING([--enable-cppapi],[Build the c++ api])],
+  [],
+  [enable_cppapi="no"]
+)
+AC_MSG_RESULT([$enable_cppapi])
+AM_CONDITIONAL([ENABLE_CPPAPI], [ test "x${enable_cppapi}" = "xyes" ])
+
 #
 # Installation directories
 # For each var the following is evaluated
@@ -996,15 +1009,17 @@ AC_MSG_NOTICE([Build for host OS: $host_os, arch: 
$host_cpu, optimization: $host
 
 #
 # CPP 11 API
-#
-AC_MSG_CHECKING([whether to enable c++11 api])
-AC_ARG_WITH([cpp11api],
-  [AS_HELP_STRING([--with-cpp11api],[enable support for cpp11api 
[default=auto]])],
-  [cpp11api=$withval],
-  [cpp11api=$enable_cxx_11_support]
-)
-AC_MSG_RESULT([$cpp11api])
-AM_CONDITIONAL([BUILD_CPP11API], [test "$cpp11api" = yes])
+# TODO: briang, this needs to be translated to a define
+# that can be used in the c++ api to enable c++11 api features.
+#
+#AC_MSG_CHECKING([whether to enable c++11 api])
+#AC_ARG_WITH([cpp11api],
+#  [AS_HELP_STRING([--with-cpp11api],[enable support for cpp11api 
[default=auto]])],
+#  [cpp11api=$withval],
+#  [cpp11api=$enable_cxx_11_support]
+#)
+#AC_MSG_RESULT([$cpp11api])
+#AM_CONDITIONAL([BUILD_CPP11API], [test "$cpp11api" = yes])
 
 # Check for ccache (if explicitly enabled)
 if test "x$enable_ccache" = "xyes"; then
@@ -1825,11 +1840,34 @@ AC_CONFIG_FILES([
   iocore/net/Makefile
   iocore/utils/Makefile
   lib/Makefile
-  lib/cpp11api/Makefile
   lib/records/Makefile
   lib/ts/Makefile
   lib/ts/ink_config.h
   lib/tsconfig/Makefile
+  lib/atscppapi/Makefile
+  lib/atscppapi/src/Makefile
+  lib/atscppapi/examples/Makefile
+  lib/atscppapi/examples/helloworld/Makefile
+  lib/atscppapi/examples/globalhook/Makefile
+  lib/atscppapi/examples/transactionhook/Makefile
+  lib/atscppapi/examples/multiple_transaction_hooks/Makefile
+  lib/atscppapi/examples/clientrequest/Makefile
+  lib/atscppapi/examples/data_caching/Makefile
+  lib/atscppapi/examples/serverresponse/Makefile
+  lib/atscppapi/examples/clientredirect/Makefile
+  lib/atscppapi/examples/customresponse/Makefile
+  lib/atscppapi/examples/null_transformation_plugin/Makefile
+  lib/atscppapi/examples/post_buffer/Makefile
+  lib/atscppapi/examples/logger_example/Makefile
+  lib/atscppapi/examples/detachedrequest/Makefile
+  lib/atscppapi/examples/stat_example/Makefile
+  lib/atscppapi/examples/async_http_fetch/Makefile
+  lib/atscppapi/examples/remap_plugin/Makefile
+  lib/atscppapi/examples/gzip_transformation/Makefile
+  lib/atscppapi/examples/timeout_example/Makefile
+  lib/atscppapi/examples/internal_transaction_handling/Makefile
+  lib/atscppapi/examples/async_timer/Makefile
+  lib/atscppapi/examples/request_cookies/Makefile
   lib/wccp/Makefile
   lib/perl/Makefile
   mgmt/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6958d056/lib/Makefile.am

git commit: Fix g++ compiler warnings

2013-10-21 Thread briang
Updated Branches:
  refs/heads/master 64b5a6fca -> 1f829e268


Fix g++ compiler warnings


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

Branch: refs/heads/master
Commit: 1f829e268620ae0181c7542d6e7b253b71a40ddc
Parents: 64b5a6f
Author: Brian Geffon 
Authored: Mon Oct 21 11:54:36 2013 -0700
Committer: Brian Geffon 
Committed: Mon Oct 21 11:54:36 2013 -0700

--
 lib/atscppapi/src/AsyncHttpFetch.cc|  2 +-
 lib/atscppapi/src/GlobalPlugin.cc  |  3 ++-
 lib/atscppapi/src/GzipDeflateTransformation.cc | 14 +++---
 lib/atscppapi/src/GzipInflateTransformation.cc |  4 ++--
 lib/atscppapi/src/Headers.cc   |  6 +++---
 lib/atscppapi/src/Logger.cc|  6 --
 lib/atscppapi/src/TransformationPlugin.cc  | 16 
 lib/atscppapi/src/utils_internal.cc|  4 +---
 8 files changed, 28 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1f829e26/lib/atscppapi/src/AsyncHttpFetch.cc
--
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc 
b/lib/atscppapi/src/AsyncHttpFetch.cc
index 51ca95d..3fd798d 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -82,7 +82,7 @@ static int handleFetchEvents(TSCont cont, TSEvent event, void 
*edata) {
   state->body_ = data_start; // data_start will now be pointing to body
   state->body_size_ = data_end - data_start;
   utils::internal::initResponse(state->response_, state->hdr_buf_, 
state->hdr_loc_);
-  LOG_DEBUG("Fetch result had a status code of %d with a body length of 
%d", status, state->body_size_);
+  LOG_DEBUG("Fetch result had a status code of %d with a body length of 
%ld", status, state->body_size_);
 } else {
   LOG_ERROR("Unable to parse response; Request URL [%s]; transaction %p",
 state->request_.getUrl().getUrlString().c_str(), txn);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1f829e26/lib/atscppapi/src/GlobalPlugin.cc
--
diff --git a/lib/atscppapi/src/GlobalPlugin.cc 
b/lib/atscppapi/src/GlobalPlugin.cc
index 40cd9e8..b2d8581 100644
--- a/lib/atscppapi/src/GlobalPlugin.cc
+++ b/lib/atscppapi/src/GlobalPlugin.cc
@@ -34,8 +34,9 @@ using namespace atscppapi;
  */
 struct atscppapi::GlobalPluginState : noncopyable {
   TSCont cont_;
-  bool ignore_internal_transactions_;
   GlobalPlugin *global_plugin_;
+  bool ignore_internal_transactions_;
+
   GlobalPluginState(GlobalPlugin *global_plugin, bool 
ignore_internal_transactions)
 : global_plugin_(global_plugin), 
ignore_internal_transactions_(ignore_internal_transactions) { }
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1f829e26/lib/atscppapi/src/GzipDeflateTransformation.cc
--
diff --git a/lib/atscppapi/src/GzipDeflateTransformation.cc 
b/lib/atscppapi/src/GzipDeflateTransformation.cc
index 5d701c8..40d0d94 100644
--- a/lib/atscppapi/src/GzipDeflateTransformation.cc
+++ b/lib/atscppapi/src/GzipDeflateTransformation.cc
@@ -43,8 +43,8 @@ const int ONE_KB = 1024;
 struct atscppapi::transformations::GzipDeflateTransformationState: noncopyable 
{
   z_stream z_stream_;
   bool z_stream_initialized_;
-  int64_t bytes_produced_;
   TransformationPlugin::Type transformation_type_;
+  int64_t bytes_produced_;
 
   GzipDeflateTransformationState(TransformationPlugin::Type type) :
 z_stream_initialized_(false), transformation_type_(type), 
bytes_produced_(0) {
@@ -93,29 +93,29 @@ void GzipDeflateTransformation::consume(const string &data) 
{
 
   // For small payloads the size can actually be greater than the original 
input
   // so we'll use twice the original size to avoid needless repeated calls to 
deflate.
-  unsigned long buffer_size = data.length() < ONE_KB ? 2 * ONE_KB : 
data.length();
+  unsigned long buffer_size = data.length() < 
static_cast(ONE_KB ? 2 * ONE_KB : data.length());
   vector buffer(buffer_size);
 
   do {
-LOG_DEBUG("Iteration %d: Deflate will compress %d bytes", ++iteration, 
data.size());
+LOG_DEBUG("Iteration %d: Deflate will compress %ld bytes", ++iteration, 
data.size());
 state_->z_stream_.avail_out = buffer_size;
 state_->z_stream_.next_out = &buffer[0];
 
 int err = deflate(&state_->z_stream_, Z_SYNC_FLUSH);
 if (Z_OK != err) {
-  LOG_ERROR("Iteration %d: Deflate failed to compress %d bytes with error 
code '%d'", iteration, data.size(), err);
+

[1/2] git commit: Fixing build for os x

2013-10-21 Thread briang
Updated Branches:
  refs/heads/master 3775c866c -> 199b6b846


Fixing build for os x


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

Branch: refs/heads/master
Commit: e6e999e782f0b8c43deafb0befbfabe324670f9f
Parents: 1f829e2
Author: Brian Geffon 
Authored: Mon Oct 21 17:55:53 2013 -0700
Committer: Brian Geffon 
Committed: Mon Oct 21 17:55:53 2013 -0700

--
 lib/atscppapi/Makefile.am |  1 -
 lib/atscppapi/src/Makefile.am | 14 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e6e999e7/lib/atscppapi/Makefile.am
--
diff --git a/lib/atscppapi/Makefile.am b/lib/atscppapi/Makefile.am
index 028d09c..166edb9 100644
--- a/lib/atscppapi/Makefile.am
+++ b/lib/atscppapi/Makefile.am
@@ -14,6 +14,5 @@
 #  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.
-includedir=$(prefix)/include/ts
 
 SUBDIRS = src

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e6e999e7/lib/atscppapi/src/Makefile.am
--
diff --git a/lib/atscppapi/src/Makefile.am b/lib/atscppapi/src/Makefile.am
index 52085d0..4e7d204 100644
--- a/lib/atscppapi/src/Makefile.am
+++ b/lib/atscppapi/src/Makefile.am
@@ -15,11 +15,19 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CXXFLAGS = -Iinclude
+TS_PLUGIN_CPPFLAGS = \
+  -D__STDC_LIMIT_MACROS=1 \
+  -D__STDC_FORMAT_MACROS=1 \
+  -I$(top_builddir)/proxy/api \
+  -I$(top_srcdir)/proxy/api \
+  -I$(top_builddir)/lib/ts \
+  -I$(top_srcdir)/lib/ts
+
+AM_CXXFLAGS = -Iinclude $(TS_PLUGIN_CPPFLAGS)
 
 # build the library
 lib_LTLIBRARIES = libatscppapi.la
-libatscppapi_la_LDFLAGS=-lz -lpthread -lrt -version-info @TS_LIBTOOL_VERSION@
+libatscppapi_la_LDFLAGS=-lz -lpthread -version-info @TS_LIBTOOL_VERSION@
 
 libatscppapi_la_SOURCES = GlobalPlugin.cc \
  Plugin.cc \
@@ -74,4 +82,4 @@ library_include_HEADERS = 
$(base_include_folder)/GlobalPlugin.h \
  $(base_include_folder)/AsyncHttpFetch.h \
  $(base_include_folder)/GzipDeflateTransformation.h \
  $(base_include_folder)/GzipInflateTransformation.h \
- $(base_include_folder)/AsyncTimer.h
\ No newline at end of file
+ $(base_include_folder)/AsyncTimer.h



[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2013-10-21 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: 199b6b846a970d40b4146c55c65e11b2b59d6db7
Parents: e6e999e 3775c86
Author: Brian Geffon 
Authored: Mon Oct 21 17:56:21 2013 -0700
Committer: Brian Geffon 
Committed: Mon Oct 21 17:56:21 2013 -0700

--
 CHANGES|  3 ++
 plugins/experimental/remap_stats/remap_stats.c |  6 +--
 proxy/logging/LogAccessHttp.cc | 42 +++--
 3 files changed, 28 insertions(+), 23 deletions(-)
--




git commit: TS-2280 Fix OS X build on atscppapi

2013-10-21 Thread briang
Updated Branches:
  refs/heads/master 199b6b846 -> 739a9c42e


TS-2280 Fix OS X build on atscppapi


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

Branch: refs/heads/master
Commit: 739a9c42e2185180035f49a641b2556b6a7c64f5
Parents: 199b6b8
Author: Brian Geffon 
Authored: Mon Oct 21 18:23:13 2013 -0700
Committer: Brian Geffon 
Committed: Mon Oct 21 18:23:13 2013 -0700

--
 lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h  |  2 +-
 lib/atscppapi/src/include/atscppapi/AsyncTimer.h  |  2 +-
 lib/atscppapi/src/include/atscppapi/GlobalPlugin.h|  2 +-
 .../src/include/atscppapi/GzipDeflateTransformation.h |  2 +-
 .../src/include/atscppapi/GzipInflateTransformation.h |  2 +-
 lib/atscppapi/src/include/atscppapi/Logger.h  |  2 +-
 .../src/include/atscppapi/TransformationPlugin.h  |  2 +-
 lib/atscppapi/src/include/atscppapi/Url.h | 10 +-
 8 files changed, 12 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h 
b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
index cb05ca6..5355e41 100644
--- a/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
+++ b/lib/atscppapi/src/include/atscppapi/AsyncHttpFetch.h
@@ -33,7 +33,7 @@
 namespace atscppapi {
 
 // forward declarations
-class AsyncHttpFetchState;
+struct AsyncHttpFetchState;
 namespace utils { class internal; }
 
 /**

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/AsyncTimer.h 
b/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
index b076eda..d0a756d 100644
--- a/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
+++ b/lib/atscppapi/src/include/atscppapi/AsyncTimer.h
@@ -33,7 +33,7 @@
 namespace atscppapi {
 
 // forward declarations
-class AsyncTimerState;
+struct AsyncTimerState;
 
 /**
  * @brief This class provides an implementation of AsyncProvider that

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h 
b/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
index cff431d..2c77769 100644
--- a/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/GlobalPlugin.h
@@ -29,7 +29,7 @@
 
 namespace atscppapi {
 
-class GlobalPluginState;
+struct GlobalPluginState;
 
 /**
  * @brief The interface used when creating a GlobalPlugin.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h 
b/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
index a7e6923..6a6443f 100644
--- a/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
+++ b/lib/atscppapi/src/include/atscppapi/GzipDeflateTransformation.h
@@ -36,7 +36,7 @@ namespace transformations {
  * Internal state for Deflate Transformations
  * @private
  */
-class GzipDeflateTransformationState;
+struct GzipDeflateTransformationState;
 
 /**
  * @brief A TransformationPlugin to easily add gzip deflate to your 
TransformationPlugin chain.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h 
b/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
index 412af91..1c32663 100644
--- a/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
+++ b/lib/atscppapi/src/include/atscppapi/GzipInflateTransformation.h
@@ -36,7 +36,7 @@ namespace transformations {
  * Internal state for Inflate Transformations
  * @private
  */
-class GzipInflateTransformationState;
+struct GzipInflateTransformationState;
 
 /**
  * @brief A TransformationPlugin to easily add gzip inflate to your 
TransformationPlugin chain.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/739a9c42/lib/atscppapi/src/include/atscppapi/Logger.h
---

git commit: TS-2280 Fix OS X build on atscppapi (missed two)

2013-10-21 Thread briang
Updated Branches:
  refs/heads/master 739a9c42e -> 6c5955a9e


TS-2280 Fix OS X build on atscppapi (missed two)


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

Branch: refs/heads/master
Commit: 6c5955a9eabce806ec9dba30a67dbb557c3edbad
Parents: 739a9c4
Author: Brian Geffon 
Authored: Mon Oct 21 18:27:05 2013 -0700
Committer: Brian Geffon 
Committed: Mon Oct 21 18:27:05 2013 -0700

--
 lib/atscppapi/src/include/atscppapi/Transaction.h   | 2 +-
 lib/atscppapi/src/include/atscppapi/TransactionPlugin.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6c5955a9/lib/atscppapi/src/include/atscppapi/Transaction.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h 
b/lib/atscppapi/src/include/atscppapi/Transaction.h
index 3610d1b..13def37 100644
--- a/lib/atscppapi/src/include/atscppapi/Transaction.h
+++ b/lib/atscppapi/src/include/atscppapi/Transaction.h
@@ -35,7 +35,7 @@ namespace atscppapi {
 
 // forward declarations
 class TransactionPlugin;
-class TransactionState;
+struct TransactionState;
 namespace utils { class internal; }
 
 /**

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6c5955a9/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h 
b/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
index d473827..3987927 100644
--- a/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
+++ b/lib/atscppapi/src/include/atscppapi/TransactionPlugin.h
@@ -38,7 +38,7 @@ namespace utils {
 /**
  * @private
  */
-class TransactionPluginState;
+struct TransactionPluginState;
 
 /**
  * @brief The interface used when creating a TransactionPlugin.



[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2013-10-22 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: e265ff890ad49bd1dd58984fd8ff982125f5487e
Parents: 9c918b6 bb5f909
Author: Brian Geffon 
Authored: Tue Oct 22 14:22:21 2013 -0700
Committer: Brian Geffon 
Committed: Tue Oct 22 14:22:21 2013 -0700

--
 doc/reference/configuration/records.config.en.rst | 8 
 1 file changed, 8 insertions(+)
--




[1/2] git commit: fixing minor build issues with examples

2013-10-22 Thread briang
Updated Branches:
  refs/heads/master bb5f90963 -> e265ff890


fixing minor build issues with examples


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

Branch: refs/heads/master
Commit: 9c918b68cc1720228b2d2370f01187d7ae182bf6
Parents: 6c5955a
Author: Brian Geffon 
Authored: Tue Oct 22 14:21:33 2013 -0700
Committer: Brian Geffon 
Committed: Tue Oct 22 14:21:33 2013 -0700

--
 lib/atscppapi/examples/async_http_fetch/Makefile.am | 4 ++--
 lib/atscppapi/examples/async_timer/Makefile.am  | 5 ++---
 lib/atscppapi/examples/clientredirect/Makefile.am   | 5 ++---
 lib/atscppapi/examples/clientrequest/Makefile.am| 4 ++--
 lib/atscppapi/examples/customresponse/Makefile.am   | 4 ++--
 lib/atscppapi/examples/data_caching/Makefile.am | 5 ++---
 lib/atscppapi/examples/detachedrequest/Makefile.am  | 4 ++--
 lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc   | 5 +
 lib/atscppapi/examples/globalhook/Makefile.am   | 4 ++--
 lib/atscppapi/examples/gzip_transformation/Makefile.am  | 4 ++--
 lib/atscppapi/examples/helloworld/Makefile.am   | 4 ++--
 .../examples/internal_transaction_handling/Makefile.am  | 4 ++--
 lib/atscppapi/examples/logger_example/Makefile.am   | 4 ++--
 lib/atscppapi/examples/multiple_transaction_hooks/Makefile.am   | 5 ++---
 lib/atscppapi/examples/null_transformation_plugin/Makefile.am   | 4 ++--
 lib/atscppapi/examples/post_buffer/Makefile.am  | 4 ++--
 lib/atscppapi/examples/remap_plugin/Makefile.am | 4 ++--
 lib/atscppapi/examples/request_cookies/Makefile.am  | 5 ++---
 lib/atscppapi/examples/serverresponse/Makefile.am   | 4 ++--
 lib/atscppapi/examples/stat_example/Makefile.am | 4 ++--
 lib/atscppapi/examples/timeout_example/Makefile.am  | 4 ++--
 lib/atscppapi/examples/transactionhook/Makefile.am  | 4 ++--
 22 files changed, 43 insertions(+), 51 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9c918b68/lib/atscppapi/examples/async_http_fetch/Makefile.am
--
diff --git a/lib/atscppapi/examples/async_http_fetch/Makefile.am 
b/lib/atscppapi/examples/async_http_fetch/Makefile.am
index dd1dd94..8dbb281 100644
--- a/lib/atscppapi/examples/async_http_fetch/Makefile.am
+++ b/lib/atscppapi/examples/async_http_fetch/Makefile.am
@@ -15,13 +15,13 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
+AM_CPPFLAGS = -I$(top_srcdir)/lib/atscppapi/src/include
 
 target=AsyncHttpFetch.so
 pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = AsyncHttpFetch.la
 AsyncHttpFetch_la_SOURCES = AsyncHttpFetch.cc
-AsyncHttpFetch_la_LDFLAGS = -module -avoid-version -shared -L$(top_srcdir) 
-latscppapi
+AsyncHttpFetch_la_LDFLAGS = -module -avoid-version -shared 
-L$(top_srcdir)/lib/atscppapi/src/ -latscppapi
 
 all:
ln -sf .libs/$(target)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9c918b68/lib/atscppapi/examples/async_timer/Makefile.am
--
diff --git a/lib/atscppapi/examples/async_timer/Makefile.am 
b/lib/atscppapi/examples/async_timer/Makefile.am
index 577d8d7..1a48970 100644
--- a/lib/atscppapi/examples/async_timer/Makefile.am
+++ b/lib/atscppapi/examples/async_timer/Makefile.am
@@ -15,13 +15,12 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
+AM_CPPFLAGS = -I$(top_srcdir)/lib/atscppapi/src/include
 target=AsyncTimer.so
 pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = AsyncTimer.la
 AsyncTimer_la_SOURCES = AsyncTimer.cc
-AsyncTimer_la_LDFLAGS = -module -avoid-version -shared -L$(top_srcdir) 
-latscppapi
+AsyncTimer_la_LDFLAGS =  -module -avoid-version -shared 
-L$(top_srcdir)/lib/atscppapi/src/ -latscppapi
 
 all:
ln -sf .libs/$(target)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9c918b68/lib/atscppapi/examples/clientredirect/Makefile.am
--
diff --git a/lib/atscppapi/examples/clientredirect/Makefile.am 
b/lib/atscppapi/examples/clientredirect/Makefile.am
index ec1629c..dde30ef 100644
--- a/lib/atscppapi/examples/clientredirect/Makefile.am
+++ b/lib/atscppapi/examples/clientredirect/Makefile.am
@@ -14,13 +14,12 

git commit: Cleaning up build of atscppapi

2013-10-29 Thread briang
Updated Branches:
  refs/heads/master e0e64ba62 -> 086906ae3


Cleaning up build of atscppapi


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

Branch: refs/heads/master
Commit: 086906ae3328a8c97b95ab3181376e7ab2e19074
Parents: e0e64ba
Author: Brian Geffon 
Authored: Tue Oct 29 15:03:34 2013 -0700
Committer: Brian Geffon 
Committed: Tue Oct 29 15:03:34 2013 -0700

--
 lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc| 2 +-
 lib/atscppapi/examples/async_http_fetch/Makefile.am  | 2 +-
 lib/atscppapi/examples/async_timer/AsyncTimer.cc | 4 ++--
 lib/atscppapi/examples/async_timer/Makefile.am   | 2 +-
 lib/atscppapi/examples/clientredirect/ClientRedirect.cc  | 2 +-
 lib/atscppapi/examples/clientredirect/Makefile.am| 2 +-
 lib/atscppapi/examples/clientrequest/ClientRequest.cc| 2 +-
 lib/atscppapi/examples/clientrequest/Makefile.am | 2 +-
 lib/atscppapi/examples/customresponse/CustomResponse.cc  | 2 +-
 lib/atscppapi/examples/customresponse/Makefile.am| 2 +-
 lib/atscppapi/examples/data_caching/Makefile.am  | 8 +++-
 lib/atscppapi/examples/data_caching/data_caching.cc  | 4 ++--
 lib/atscppapi/examples/detachedrequest/DetachedRequest.cc| 2 +-
 lib/atscppapi/examples/detachedrequest/Makefile.am   | 2 +-
 lib/atscppapi/examples/globalhook/GlobalHookPlugin.cc| 2 +-
 lib/atscppapi/examples/globalhook/Makefile.am| 2 +-
 .../examples/gzip_transformation/GzipTransformationPlugin.cc | 2 +-
 lib/atscppapi/examples/gzip_transformation/Makefile.am   | 2 +-
 lib/atscppapi/examples/helloworld/HelloWorldPlugin.cc| 2 +-
 lib/atscppapi/examples/helloworld/Makefile.am| 2 +-
 .../InternalTransactionHandling.cc   | 4 ++--
 .../examples/internal_transaction_handling/Makefile.am   | 2 +-
 lib/atscppapi/examples/logger_example/LoggerExample.cc   | 2 +-
 lib/atscppapi/examples/logger_example/Makefile.am| 2 +-
 .../examples/multiple_transaction_hooks/Makefile.am  | 2 +-
 .../MultipleTransactionHookPlugins.cc| 2 +-
 .../examples/null_transformation_plugin/Makefile.am  | 2 +-
 .../null_transformation_plugin/NullTransformationPlugin.cc   | 2 +-
 lib/atscppapi/examples/post_buffer/Makefile.am   | 2 +-
 lib/atscppapi/examples/post_buffer/PostBuffer.cc | 2 +-
 lib/atscppapi/examples/remap_plugin/Makefile.am  | 2 +-
 lib/atscppapi/examples/remap_plugin/RemapPlugin.cc   | 2 +-
 lib/atscppapi/examples/request_cookies/Makefile.am   | 2 +-
 lib/atscppapi/examples/request_cookies/RequestCookies.cc | 2 +-
 lib/atscppapi/examples/serverresponse/Makefile.am| 2 +-
 lib/atscppapi/examples/serverresponse/ServerResponse.cc  | 2 +-
 lib/atscppapi/examples/stat_example/Makefile.am  | 2 +-
 lib/atscppapi/examples/stat_example/StatExample.cc   | 4 ++--
 lib/atscppapi/examples/timeout_example/Makefile.am   | 2 +-
 .../examples/timeout_example/TimeoutExamplePlugin.cc | 2 +-
 lib/atscppapi/examples/transactionhook/Makefile.am   | 2 +-
 .../examples/transactionhook/TransactionHookPlugin.cc| 2 +-
 lib/atscppapi/src/Headers.cc | 1 +
 lib/atscppapi/src/include/atscppapi/AsyncTimer.h | 2 +-
 lib/atscppapi/src/include/atscppapi/PluginInit.h | 2 ++
 lib/atscppapi/src/include/atscppapi/RemapPlugin.h| 5 +++--
 lib/atscppapi/src/include/atscppapi/utils.h  | 4 
 47 files changed, 63 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/086906ae/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
--
diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc 
b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
index c98e658..d8bce6b 100644
--- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
+++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
@@ -137,7 +137,7 @@ public:
   }
 };
 
-void TSPluginInit(int argc, const char *argv[]) {
+void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] 
ATSCPPAPI_UNUSED) {
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
   GlobalPlugin *instance = new GlobalHookPlugin();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/086906ae/lib/atscppapi/examples/async_http_fetch/Makefile.am
--

[1/2] [TS-2321] C++ API: Clean up header code to no longer use intermediate data structures

2013-11-05 Thread briang
Updated Branches:
  refs/heads/master b984db31f -> 83d43ab13


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/83d43ab1/lib/atscppapi/src/include/atscppapi/Headers.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/Headers.h 
b/lib/atscppapi/src/include/atscppapi/Headers.h
index af02707..c83c5c8 100644
--- a/lib/atscppapi/src/include/atscppapi/Headers.h
+++ b/lib/atscppapi/src/include/atscppapi/Headers.h
@@ -24,218 +24,580 @@
 #ifndef ATSCPPAPI_HEADERS_H_
 #define ATSCPPAPI_HEADERS_H_
 
-#include 
-#include 
-#include 
 #include 
+#include 
 
 namespace atscppapi {
 
 struct HeadersState;
+struct HeaderFieldIteratorState;
+struct HeaderFieldState;
+struct HeaderFieldValueIteratorState;
 class Request;
 class ClientRequest;
 class Response;
 
 /**
- * @brief Encapsulates the headers portion of a request or response.
+ * @brief A HeaderFieldName is a lightweight wrapper around a string that 
allows for case insensitive comparisons.
+ * Because header field names must be case insensitive this allows easy case 
insentive comparisons of names.
+ *
  */
-class Headers: noncopyable {
+class HeaderFieldName {
+ private:
+   std::string name_;
+ public:
+   typedef std::string::size_type size_type;
+
+   /**
+* Constructor: build a new HeaderField name with the given string
+*/
+   HeaderFieldName(const std::string &name);
+
+   /**
+* std::string conversion
+* @return a string which is this HeaderFieldName
+*/
+   operator std::string();
+
+   /**
+ * const char * conversion
+ * @return a const char * which is this HeaderFieldName
+ */
+   operator const char*();
+
+   /**
+* @return the length of this HeaderFieldName
+*/
+   size_type length();
+
+   /**
+* @return a string which is this HeaderFieldName
+*/
+   std::string str();
+
+   /**
+* @return a const char * which points to the name of this HeaderFIeldName
+*/
+   const char *c_str();
+
+   /**
+* Case insensitive comparison of this HeaderFieldName
+* @return true if the two strings are equal.
+*/
+   bool operator==(const char *field_name);
+
+   /**
+ * Case insensitive comparison of this HeaderFieldName
+ * @return true if the two strings are equal.
+ */
+   bool operator==(const std::string &field_name);
+
+   /**
+ * Case insensitive comparison of this HeaderFieldName
+ * @return true if the two strings are not equal.
+ */
+   bool operator!=(const char *field_name);
+
+   /**
+ * Case insensitive comparison of this HeaderFieldName
+ * @return true if the two strings are not equal.
+ */
+   bool operator!=(const std::string &field_name);
+};
+
+class HeaderField;
+
+/**
+ * @brief A header field value iterator iterates through all header fields.
+ */
+class header_field_value_iterator : public 
std::iterator
+{
+  private:
+HeaderFieldValueIteratorState *state_;
+  public:
+/**
+  * Constructor for header_field_value_iterator, this shouldn't need to be 
used directly.
+  * @param bufp the TSMBuffer associated with the headers
+  * @param mloc the TSMLoc associated with the headers.
+  * @param field_loc the TSMLoc assocated with the field.
+  * @param index the index of the value in the HeaderField
+  * @warning This shouldn't need to be used directly!
+  */
+header_field_value_iterator(void *bufp, void *hdr_loc, void *field_loc, 
int index);
+
+/**
+  * Copy Constructor for header_field_value_iterator, this shouldn't need 
to be used directly.
+  * @param header_field_value_iterator an existing iterator to copy
+  * @warning This shouldn't need to be used directly!
+  */
+header_field_value_iterator(const header_field_value_iterator& it);
+~header_field_value_iterator();
+
+/**
+ * Dereference this iterator into a string (get the value pointed to by 
this iterator)
+ * @return a string which is the value pointed to by this iterator
+ */
+std::string operator*();
+
+/**
+ * Advance the iterator to the next header field value
+ * @return a reference to a the next iterator
+ */
+header_field_value_iterator& operator++();
+
+/**
+ * Advance the current iterator to the next header field
+ * @return a new iterator which points to the next element
+ */
+header_field_value_iterator operator++(int);
+
+/**
+ * Compare two iterators returning true if they are equal
+ * @return true if two iterators are equal
+ */
+bool operator==(const header_field_value_iterator& rhs) const;
+
+/**
+ * Compare two iterators returning true if they are NOT equal
+ * @return true if two iterators are not equal.
+ */
+bool operator!=(const header_field_value_iterator& rhs) const;
+
+friend class HeaderField;
+};
+class header_field_iterator;
+
+/**
+ * @brief A HeaderField is a class that contains the header field name and all 
o

[01/10] git commit: TS-2316: header_rewrite: added cookie-based conditions

2013-11-12 Thread briang
Updated Branches:
  refs/heads/master 9335e5c24 -> 752e01e07


TS-2316: header_rewrite: added cookie-based conditions

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 3d37f51d1b1be4222dbb33afd2692e4a6ab11de7
Parents: b79c907
Author: Alexey Ivanov 
Authored: Tue Nov 5 12:55:10 2013 -0800
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/conditions.cc | 65 +++
 plugins/header_rewrite/conditions.h  | 60 
 plugins/header_rewrite/factory.cc|  2 +
 3 files changed, 127 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3d37f51d/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index fdbb309..25bbae6 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -385,3 +385,68 @@ ConditionDBM::eval(const Resources& res)
 
   return static_cast*>(_matcher)->test(s);
 }
+
+
+// ConditionCookie: request or response header
+void ConditionCookie::initialize(Parser& p)
+{
+  Condition::initialize(p);
+
+  Matchers* match = new Matchers(_cond_op);
+  match->set(p.get_arg());
+
+  _matcher = match;
+
+  require_resources(RSRC_CLIENT_REQUEST_HEADERS);
+}
+
+void ConditionCookie::append_value(std::string& s, const Resources& res)
+{
+  TSMBuffer bufp = res.client_bufp;
+  TSMLoc hdr_loc = res.client_hdr_loc;
+  TSMLoc field_loc;
+  int error;
+  int cookies_len;
+  int cookie_value_len;
+  const char *cookies;
+  const char *cookie_value;
+  const char * const cookie_name = _qualifier.c_str();
+  const int cookie_name_len = _qualifier.length();
+
+  // Sanity
+  if (bufp == NULL || hdr_loc == NULL)
+return;
+
+  // Find Cookie
+  field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, TS_MIME_FIELD_COOKIE, 
TS_MIME_LEN_COOKIE);
+  if (field_loc == NULL)
+return;
+
+  // Get all cookies
+  // NB! Cookie field does not support commas, so we use index == 0
+  cookies = TSMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, 
&cookies_len);
+  if (cookies == NULL || cookies_len <= 0)
+goto out_release_field;
+
+  // Find particular cookie's value
+  error = get_cookie_value(cookies, cookies_len, cookie_name, cookie_name_len, 
&cookie_value, &cookie_value_len);
+  if (error == TS_ERROR)
+goto out_release_field;
+
+  TSDebug(PLUGIN_NAME, "Appending COOKIE(%s) to evaluation value -> %.*s", 
cookie_name, cookie_value_len, cookie_value);
+  s.append(cookie_value, cookie_value_len);
+
+  // Unwind
+out_release_field:
+  TSHandleMLocRelease(bufp, hdr_loc, field_loc);
+}
+
+bool ConditionCookie::eval(const Resources& res)
+{
+  std::string s;
+
+  append_value(s, res);
+  bool rval = static_cast*>(_matcher)->test(s);
+  TSDebug(PLUGIN_NAME, "Evaluating COOKIE(%s): %s: rval: %d", 
_qualifier.c_str(), s.c_str(), rval);
+  return rval;
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3d37f51d/plugins/header_rewrite/conditions.h
--
diff --git a/plugins/header_rewrite/conditions.h 
b/plugins/header_rewrite/conditions.h
index 96d1db4..2f4d093 100644
--- a/plugins/header_rewrite/conditions.h
+++ b/plugins/header_rewrite/conditions.h
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "condition.h"
 #include "matcher.h"
@@ -146,6 +147,65 @@ private:
 };
 
 
+// cookie(name)
+class ConditionCookie: public Condition
+{
+public:
+  ConditionCookie()
+  {
+TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for ConditionCookie");
+  }
+  void initialize(Parser& p);
+  void append_value(std::string& s, const Resources& res);
+
+protected:
+  bool eval(const Resources& res);
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(ConditionCookie);
+
+  // Nginx-style cookie parsing:
+  //   nginx/src/http/ngx_http_parse.c:ngx_http_parse_multi_header_lines()
+  inline int
+  get_cookie_value(const char *buf, int buf_len, const char *name, int 
name_len,
+const char **value, int *value_len)
+  {
+const char *start, *last, *end;
+
+// Sanity
+if (buf == NULL || name == NULL || value == NULL || value_len == NULL)
+  return TS_ERROR;
+
+start = buf;
+end = buf + buf_len;
+
+while (start < end) {
+  if (strncasecmp(start, name, name_len) != 0)
+goto skip;
+
+  for (start += name_len; start < end && *start == ' '; start++);
+
+  if (start == end || *s

[05/10] git commit: TS-2316: header_rewrite: added optional counter to each rule

2013-11-12 Thread briang
TS-2316: header_rewrite: added optional counter to each rule

Now you can count each rule's tripping by providing one or more "counter"
statements e.g::

cond %{SEND_RESPONSE_HDR_HOOK} [AND]
add-header X-DC "DC1"
counter plugins.header_rewrite.POP
counter plugins.header_rewrite.ALL

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: b79c9074455e4634d2a809a71e6cc6122567f610
Parents: 8e2cc15
Author: Alexey Ivanov 
Authored: Tue Nov 5 11:14:06 2013 -0800
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/factory.cc   |  2 ++
 plugins/header_rewrite/operators.cc | 37 
 plugins/header_rewrite/operators.h  | 19 
 3 files changed, 58 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b79c9074/plugins/header_rewrite/factory.cc
--
diff --git a/plugins/header_rewrite/factory.cc 
b/plugins/header_rewrite/factory.cc
index 7810c8c..9af8f25 100644
--- a/plugins/header_rewrite/factory.cc
+++ b/plugins/header_rewrite/factory.cc
@@ -53,6 +53,8 @@ operator_factory(const std::string& op)
 o = new OperatorSetTimeoutOut();
   } else if (op == "no-op") {
 o = new OperatorNoOp();
+  } else if (op == "counter") {
+o = new OperatorCounter();
   } else {
 TSError("%s: unknown operator: %s", PLUGIN_NAME, op.c_str());
 return NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b79c9074/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 881e058..f06b1d0 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -466,3 +466,40 @@ OperatorSetHeader::exec(const Resources& res) const
 }
   }
 }
+
+// OperatorCounter
+void
+OperatorCounter::initialize(Parser& p) {
+  Operator::initialize(p);
+
+  _counter_name = p.get_arg();
+
+  // Sanity
+  if (_counter_name.length() == 0) {
+TSError("%s: counter name is empty", PLUGIN_NAME);
+return;
+  }
+
+  // Check if counter already created by another rule
+  if (TSStatFindName(_counter_name.c_str(), &_counter) == TS_ERROR) {
+_counter = TSStatCreate(_counter_name.c_str(), TS_RECORDDATATYPE_INT, 
TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_COUNT);
+if (_counter == TS_ERROR) {
+  TSError("%s: TSStatCreate() failed. Can't create counter: %s", 
PLUGIN_NAME, _counter_name.c_str());
+  return;
+}
+TSDebug(PLUGIN_NAME, "OperatorCounter::initialize(%s) created counter with 
id: %d", _counter_name.c_str(), _counter);
+  } else {
+TSDebug(PLUGIN_NAME, "OperatorCounter::initialize(%s) reusing id: %d", 
_counter_name.c_str(), _counter);
+  }
+}
+
+void
+OperatorCounter::exec(const Resources& res) const
+{
+  // Sanity
+  if (_counter == TS_ERROR)
+return;
+
+  TSDebug(PLUGIN_NAME, "OperatorCounter::exec() invoked on counter %s", 
_counter_name.c_str());
+  TSStatIntIncrement(_counter, 1);
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b79c9074/plugins/header_rewrite/operators.h
--
diff --git a/plugins/header_rewrite/operators.h 
b/plugins/header_rewrite/operators.h
index 65bbcb4..6ab67ff 100644
--- a/plugins/header_rewrite/operators.h
+++ b/plugins/header_rewrite/operators.h
@@ -240,5 +240,24 @@ private:
   Value _value;
 };
 
+class OperatorCounter : public Operator
+{
+public:
+  OperatorCounter()
+: _counter_name(""), _counter(TS_ERROR)
+  {
+TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for OperatorCounter");
+  }
+  void initialize(Parser& p);
+
+protected:
+  void exec(const Resources& res) const;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(OperatorCounter);
+
+  std::string _counter_name;
+  int _counter;
+};
 
 #endif // __OPERATORS_H



[02/10] git commit: TS-2316: header_rewrite: fix for crash in client header condition

2013-11-12 Thread briang
TS-2316: header_rewrite: fix for crash in client header condition

Submitted by: Manjesh Nilange 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 8e2cc15fe2315107357970f63477fa99cb6cd04e
Parents: 3f4e1c7
Author: Alexey Ivanov 
Authored: Mon Nov 4 20:46:57 2013 -0800
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8e2cc15f/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 17d1ad5..fdbb309 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -192,10 +192,10 @@ ConditionHeader::append_value(std::string& s, const 
Resources& res)
 field_loc = TSMimeHdrFieldFind(bufp, hdr_loc, _qualifier.c_str(), 
_qualifier.size());
 TSDebug(PLUGIN_NAME, "Getting Header: %s, field_loc: %p", 
_qualifier.c_str(), field_loc);
 if (field_loc != NULL) {
-  value = TSMimeHdrFieldValueStringGet(res.bufp, res.hdr_loc, field_loc, 
0, &len);
+  value = TSMimeHdrFieldValueStringGet(bufp, res.hdr_loc, field_loc, 0, 
&len);
   TSDebug(PLUGIN_NAME, "Appending HEADER(%s) to evaluation value -> %.*s", 
_qualifier.c_str(), len, value);
   s.append(value, len);
-  TSHandleMLocRelease(res.bufp, res.hdr_loc, field_loc);
+  TSHandleMLocRelease(bufp, res.hdr_loc, field_loc);
 }
   }
 }



[07/10] git commit: TS-2316: header_rewrite: fixed segfaults in ConditionPath::append_value()

2013-11-12 Thread briang
TS-2316: header_rewrite: fixed segfaults in ConditionPath::append_value()

Submitted by: Manjesh Nilange 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 236c52cf2bb4d6831494fe4bddfba8b9acff68e3
Parents: 38b05cd
Author: Alexey Ivanov 
Authored: Sat Nov 2 21:08:17 2013 -0700
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/conditions.cc | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/236c52cf/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 40f92ef..17d1ad5 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -224,13 +224,19 @@ ConditionPath::initialize(Parser& p)
   _matcher = match;
 }
 
-void
-ConditionPath::append_value(std::string& s, const Resources& res)
-{
-  int path_len = 0;
-  const char *path = TSUrlPathGet(res._rri->requestBufp, res._rri->requestUrl, 
&path_len);
-  TSDebug(PLUGIN_NAME, "Appending PATH to evaluation value: %.*s", path_len, 
path);
-  s.append(path, path_len);
+void ConditionPath::append_value(std::string& s, const Resources& res) {
+  TSMBuffer bufp;
+  TSMLoc url_loc;
+
+  if (TSHttpTxnPristineUrlGet(res.txnp, &bufp, &url_loc) == TS_SUCCESS) {
+int path_length;
+const char *path = TSUrlPathGet(bufp, url_loc, &path_length);
+
+if (path && path_length)
+  s.append(path, path_length);
+
+TSHandleMLocRelease(bufp, TS_NULL_MLOC, url_loc);
+  }
 }
 
 bool



[04/10] git commit: TS-2316: header_rewrite: removed trailing spaces

2013-11-12 Thread briang
TS-2316: header_rewrite: removed trailing spaces

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 38b05cd4e9b96ba920f9f61a988e037251853c25
Parents: f1ea0d7
Author: Alexey Ivanov 
Authored: Sat Nov 2 19:34:13 2013 -0700
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/README  |  8 
 plugins/header_rewrite/condition.h |  2 +-
 plugins/header_rewrite/conditions.cc   |  2 +-
 plugins/header_rewrite/conditions.h|  6 +++---
 plugins/header_rewrite/factory.h   |  2 +-
 plugins/header_rewrite/lulu.h  |  2 +-
 plugins/header_rewrite/matcher.h   |  8 
 plugins/header_rewrite/operators.cc| 10 +-
 plugins/header_rewrite/operators.h |  2 +-
 plugins/header_rewrite/parser.h|  2 +-
 plugins/header_rewrite/regex_helper.cc | 10 +-
 plugins/header_rewrite/regex_helper.h  |  4 ++--
 plugins/header_rewrite/resources.cc|  4 ++--
 plugins/header_rewrite/resources.h |  2 +-
 plugins/header_rewrite/ruleset.h   |  2 +-
 plugins/header_rewrite/statement.h |  2 +-
 plugins/header_rewrite/value.h |  2 +-
 17 files changed, 35 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/38b05cd4/plugins/header_rewrite/README
--
diff --git a/plugins/header_rewrite/README b/plugins/header_rewrite/README
index 6b5f535..f90d62a 100644
--- a/plugins/header_rewrite/README
+++ b/plugins/header_rewrite/README
@@ -28,7 +28,7 @@ during the origin response header parsing, using 
READ_RESPONSE_HDR_HOOK.
 
 Operators
 -
-The following operators are available: 
+The following operators are available:
 
   rm-header header-name [flags]
   add-header header  [flags]
@@ -164,13 +164,13 @@ Version 1.6.9 (10,17,11,cdoshi)
  - Support for PATH condition
 
 Version 1.6.8 (10/17/11,cdoshi)
- -  Replace the INKHttpHdrStatusSet with INKHttptxnSetHttpRetStatus 
+ -  Replace the INKHttpHdrStatusSet with INKHttptxnSetHttpRetStatus
 
 Version 1.6.7 (07/21/11, bcall)
   - [bug 4699620] - Removed some extra printf()'s
 
 Version 1.6.6 (cdoshi)
-  - when Host adder is added setHostChange will be called 
+  - when Host adder is added setHostChange will be called
 
 Version 1.6.5 (cdoshi)
   - fix QSA for set-destination
@@ -185,7 +185,7 @@ Version 1.6.2 (cdoshi)
   - Support for regex matcher
 
 Version 1.6.1 (09/15/10, leif)
-  - [bug 3985913] 
+  - [bug 3985913]
 
 Version 1.6.0 (07/14/10, leif)
   - Added support for the timeout-out operator.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/38b05cd4/plugins/header_rewrite/condition.h
--
diff --git a/plugins/header_rewrite/condition.h 
b/plugins/header_rewrite/condition.h
index e832a87..a33786c 100644
--- a/plugins/header_rewrite/condition.h
+++ b/plugins/header_rewrite/condition.h
@@ -16,7 +16,7 @@
   limitations under the License.
 */
 
//
-// 
+//
 // Implement the classes for the various types of hash keys we support.
 //
 #ifndef __CONDITION_H__

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/38b05cd4/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 173f94e..40f92ef 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -226,7 +226,7 @@ ConditionPath::initialize(Parser& p)
 
 void
 ConditionPath::append_value(std::string& s, const Resources& res)
-{ 
+{
   int path_len = 0;
   const char *path = TSUrlPathGet(res._rri->requestBufp, res._rri->requestUrl, 
&path_len);
   TSDebug(PLUGIN_NAME, "Appending PATH to evaluation value: %.*s", path_len, 
path);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/38b05cd4/plugins/header_rewrite/conditions.h
--
diff --git a/plugins/header_rewrite/conditions.h 
b/plugins/header_rewrite/conditions.h
index 1123100..96d1db4 100644
--- a/plugins/header_rewrite/conditions.h
+++ b/plugins/header_rewrite/conditions.h
@@ -16,7 +16,7 @@
   limitations under the License.
 */
 
//
-// 
+//
 // Declarations for 

[08/10] git commit: TS-2316: header_rewrite: improved documentation

2013-11-12 Thread briang
TS-2316: header_rewrite: improved documentation

Added variable expansion, counter operation and cookie condition.
Removed non-existient METHOD condition example.

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: c83a52937791827a949d4b8469c7a4439860f6bb
Parents: 3d37f51
Author: Alexey Ivanov 
Authored: Sun Nov 10 18:23:39 2013 -0800
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:23:39 2013 -0800

--
 plugins/header_rewrite/README | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c83a5293/plugins/header_rewrite/README
--
diff --git a/plugins/header_rewrite/README b/plugins/header_rewrite/README
index f90d62a..fba6693 100644
--- a/plugins/header_rewrite/README
+++ b/plugins/header_rewrite/README
@@ -4,9 +4,6 @@ perform various header "rewrite" rules (operations) on a 
request or
 response. Currently, only one operation is supported, since we had to get
 this rolling asap.
 
-Note that currently only static string "values" are supported. We'll add
-advanced features to allow for expansions in a future release.
-
 Using the plugin
 
 
@@ -36,6 +33,7 @@ The following operators are available:
   set-status-reason  [flags]
   set-config config  [flags]
   no-op [flags]
+  counter counter-name  [flags]
 
 The following operator(s) currently only works when instantiating the
 plugin as a remap plugin:
@@ -60,6 +58,18 @@ Operator flags
   [L]   Last rule, do not continue
 
 
+Variable expansion
+--
+Currntly only limited variable expansion is supported in add-header. Supported
+substitutions include:
+  %  Protocol
+  %   Port
+  %Client IP
+  %   Client request length
+  %   Client HTTP method
+  %  Client unmapped URI
+
+
 Conditions
 --
 The conditions are used as qualifiers: The operators specified will
@@ -71,8 +81,8 @@ only be evaluated if the condition(s) are met.
   cond %{TRUE}  [flags]
   cond %{FALSE} [flags]
   cond %{HEADER:header-name} operand[flags]
+  cond %{COOKIE:cookie-name} operand[flags]
   cond %{CLIENT-HEADER:header-name} operand [flags]
-  cond %{METHOD} operand[flags]
   cond %{PROTOCOL} operand  [flags]
   cond %{PORT} operand  [flags]
   cond %{HOST} operand  [flags]
@@ -103,7 +113,7 @@ configuration, but being the default it is also optional.
 
 Condition flags
 ---
-  [NC]  Not ase sensitive condition (when applicable)
+  [NC]  Not case sensitive condition (when applicable)
   [AND] AND with next condition (default)
   [OR]  OR with next condition
   [NOT] Invert this condition
@@ -133,11 +143,12 @@ Examples
 
 
 cond %{HEADER:X-Y-Foobar}
-cond %{METHOD} =GET [OR]
-cond %{METHOD} =POST
+cond %{COOKIE:X-DC}  =DC1
 add-header X-Y-Fiefum %{HEADER:X-Y-Foobar}
+add-header X-Forwarded-For %
 rm-header X-Y-Foobar
 rm-header Set-Cookie
+counter plugin.header_rewrite.x-y-foobar-dc1
 
 cond %{HEADER:X-Y-Foobar} "Some string" [AND,NC]
 



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

2013-11-12 Thread briang
Merge branch 'master' of https://github.com/SaveTheRbtz/trafficserver


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

Branch: refs/heads/master
Commit: bd24f125ddbaaa26220083107c5e55095d9d92b9
Parents: ddfbd59 c83a529
Author: Brian Geffon 
Authored: Tue Nov 12 14:19:52 2013 -0800
Committer: Brian Geffon 
Committed: Tue Nov 12 14:19:52 2013 -0800

--
 plugins/header_rewrite/README  |  33 ---
 plugins/header_rewrite/condition.cc|  10 +-
 plugins/header_rewrite/condition.h |   2 +-
 plugins/header_rewrite/conditions.cc   | 104 ++---
 plugins/header_rewrite/conditions.h|  80 
 plugins/header_rewrite/factory.cc  |  18 ++--
 plugins/header_rewrite/factory.h   |   2 +-
 plugins/header_rewrite/lulu.h  |   2 +-
 plugins/header_rewrite/matcher.h   |  29 +++---
 plugins/header_rewrite/operator.cc |   9 +-
 plugins/header_rewrite/operator.h  | 139 +++-
 plugins/header_rewrite/operators.cc|  59 ++--
 plugins/header_rewrite/operators.h |  21 -
 plugins/header_rewrite/parser.h|   2 +-
 plugins/header_rewrite/regex_helper.cc |  10 +-
 plugins/header_rewrite/regex_helper.h  |   7 +-
 plugins/header_rewrite/resources.cc|   4 +-
 plugins/header_rewrite/resources.h |   2 +-
 plugins/header_rewrite/ruleset.cc  |   9 +-
 plugins/header_rewrite/ruleset.h   |  14 ++-
 plugins/header_rewrite/statement.cc|   9 +-
 plugins/header_rewrite/statement.h |   2 +-
 plugins/header_rewrite/value.h |   2 +-
 23 files changed, 464 insertions(+), 105 deletions(-)
--




[06/10] git commit: TS-2316: header_rewrite: unify style

2013-11-12 Thread briang
TS-2316: header_rewrite: unify style

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: f1ea0d7ca95d03c2676ff12e764aa8702bb46bdc
Parents: d314e59
Author: Alexey Ivanov 
Authored: Sat Nov 2 19:33:07 2013 -0700
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/condition.cc   | 10 +-
 plugins/header_rewrite/conditions.cc  | 15 ++-
 plugins/header_rewrite/conditions.h   | 14 +-
 plugins/header_rewrite/factory.cc | 14 +++---
 plugins/header_rewrite/matcher.h  | 21 ++---
 plugins/header_rewrite/operator.cc|  9 ++---
 plugins/header_rewrite/operator.h |  2 +-
 plugins/header_rewrite/operators.cc   |  9 ++---
 plugins/header_rewrite/regex_helper.h |  3 ++-
 plugins/header_rewrite/ruleset.cc |  9 ++---
 plugins/header_rewrite/ruleset.h  | 12 
 plugins/header_rewrite/statement.cc   |  9 ++---
 12 files changed, 72 insertions(+), 55 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1ea0d7c/plugins/header_rewrite/condition.cc
--
diff --git a/plugins/header_rewrite/condition.cc 
b/plugins/header_rewrite/condition.cc
index d7c05eb..bcece21 100644
--- a/plugins/header_rewrite/condition.cc
+++ b/plugins/header_rewrite/condition.cc
@@ -30,20 +30,20 @@ parse_matcher_op(std::string& arg)
 {
   switch (arg[0]) {
   case '=':
-arg.erase(0,1);
+arg.erase(0, 1);
 return MATCH_EQUAL;
 break;
   case '<':
-arg.erase(0,1);
+arg.erase(0, 1);
 return MATCH_LESS_THEN;
 break;
   case '>':
-arg.erase(0,1);
+arg.erase(0, 1);
 return MATCH_GREATER_THEN;
 break;
   case '/':
-arg.erase(0,1);
-arg.erase(arg.length() -1 , arg.length());
+arg.erase(0, 1);
+arg.erase(arg.length() - 1, arg.length());
 return MATCH_REGULAR_EXPRESSION;
 break;
   default:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1ea0d7c/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 6faac6f..173f94e 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -46,21 +46,24 @@ ConditionStatus::initialize(Parser& p)
 
 
 void
-ConditionStatus::initialize_hooks() {
+ConditionStatus::initialize_hooks()
+{
   add_allowed_hook(TS_HTTP_READ_RESPONSE_HDR_HOOK);
   add_allowed_hook(TS_HTTP_SEND_RESPONSE_HDR_HOOK);
 }
 
 
 bool
-ConditionStatus::eval(const Resources& res) {
+ConditionStatus::eval(const Resources& res)
+{
   TSDebug(PLUGIN_NAME, "Evaluating STATUS()"); // TODO: It'd be nice to get 
the args here ...
   return static_cast*>(_matcher)->test(res.resp_status);
 }
 
 
 void
-ConditionStatus::append_value(std::string& s, const Resources& res) {
+ConditionStatus::append_value(std::string& s, const Resources& res)
+{
   s += boost::lexical_cast(res.resp_status);
   TSDebug(PLUGIN_NAME, "Appending STATUS(%d) to evaluation value -> %s", 
res.resp_status, s.c_str());
 }
@@ -86,7 +89,8 @@ ConditionRandom::initialize(Parser& p)
 
 
 bool
-ConditionRandom::eval(const Resources& /* res ATS_UNUSED */) {
+ConditionRandom::eval(const Resources& /* res ATS_UNUSED */)
+{
   TSDebug(PLUGIN_NAME, "Evaluating RANDOM(%d)", _max);
   return static_cast*>(_matcher)->test(rand_r(&_seed) % _max);
 }
@@ -288,7 +292,8 @@ ConditionUrl::initialize(Parser& /* p ATS_UNUSED */)
 
 
 void
-ConditionUrl::set_qualifier(const std::string& q) {
+ConditionUrl::set_qualifier(const std::string& q)
+{
   Condition::set_qualifier(q);
 
   _url_qual = parse_url_qualifier(q);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1ea0d7c/plugins/header_rewrite/conditions.h
--
diff --git a/plugins/header_rewrite/conditions.h 
b/plugins/header_rewrite/conditions.h
index 904533d..1123100 100644
--- a/plugins/header_rewrite/conditions.h
+++ b/plugins/header_rewrite/conditions.h
@@ -188,19 +188,7 @@ private:
 };
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
+// query
 class ConditionQuery : public Condition
 {
 public:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f1ea0d7c/plugins/header_rewrite/factory.cc
--
diff --git a/plugins/header_rewrite/factory.cc 
b/plugins/header_rewrite/factory.cc
index d7f0d6d..7810

[03/10] git commit: TS-2316: header_rewrite: added variable expansion support to add-header

2013-11-12 Thread briang
TS-2316: header_rewrite: added variable expansion support to add-header

Submitted by: Thomas Jackson 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 3f4e1c74527f5ecaed0b9f1d116ba29dd6c419f5
Parents: 236c52c
Author: Alexey Ivanov 
Authored: Mon Nov 4 20:29:19 2013 -0800
Committer: Alexey Ivanov 
Committed: Sun Nov 10 18:07:53 2013 -0800

--
 plugins/header_rewrite/operator.h   | 137 +++
 plugins/header_rewrite/operators.cc |   3 +
 2 files changed, 140 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3f4e1c74/plugins/header_rewrite/operator.h
--
diff --git a/plugins/header_rewrite/operator.h 
b/plugins/header_rewrite/operator.h
index aba2f11..5c24925 100644
--- a/plugins/header_rewrite/operator.h
+++ b/plugins/header_rewrite/operator.h
@@ -29,6 +29,9 @@
 #include "statement.h"
 #include "parser.h"
 
+#include 
+#include 
+#include 
 
 // Operator modifiers
 enum OperModifiers {
@@ -94,4 +97,138 @@ private:
 };
 
 
+class VariableExpander {
+private:
+  std::string _source;
+public:
+  VariableExpander(const std::string &source) :
+  _source(source) {
+  }
+
+  std::string expand(const Resources& res) {
+std::string result;
+result.reserve(512); // TODO: Can be optimized
+result.assign(_source);
+
+while (true) {
+  std::string::size_type start = result.find("%<");
+  if (start == std::string::npos)
+break;
+
+  std::string::size_type end = result.find(">", start);
+  if (end == std::string::npos)
+break;
+
+  std::string first_part = result.substr(0, start);
+  std::string last_part = result.substr(end + 1);
+
+  // Now evaluate the variable
+  std::string variable = result.substr(start, end - start + 1);
+
+  // This will be the value to replace the "variable" section of the 
string with
+  std::string resolved_variable = "";
+
+  // Initialize some stuff
+  TSMBuffer bufp;
+  TSMLoc hdr_loc;
+  TSMLoc url_loc;
+
+  if (variable == "%") {
+// Protocol of the incoming request
+if (TSHttpTxnPristineUrlGet(res.txnp, &bufp, &url_loc) == TS_SUCCESS) {
+  int len;
+  resolved_variable = TSUrlSchemeGet(bufp, url_loc, &len);
+}
+  } else if (variable == "%") {
+// Original port of the incoming request
+if (TSHttpTxnClientReqGet(res.txnp, &bufp, &hdr_loc) == TS_SUCCESS) {
+  if (TSHttpHdrUrlGet(bufp, hdr_loc, &url_loc) == TS_SUCCESS) {
+std::stringstream out;
+out << TSUrlPortGet(bufp, url_loc);
+resolved_variable = out.str();
+TSHandleMLocRelease(bufp, hdr_loc, url_loc);
+  }
+  TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
+}
+  } else if (variable == "%") {
+// IP address of the client's host machine
+resolved_variable = getIP(TSHttpTxnClientAddrGet(res.txnp));
+  } else if (variable == "%") {
+// The client request header length; the header length in the client 
request to Traffic Server.
+std::stringstream out;
+out << TSHttpHdrLengthGet(res.client_bufp, res.client_hdr_loc);
+resolved_variable = out.str();
+  } else if (variable == "%") {
+// The HTTP method in the client request to Traffic Server: GET, POST, 
and so on (subset of cqtx).
+int method_len;
+const char *methodp = TSHttpHdrMethodGet(res.client_bufp, 
res.client_hdr_loc, &method_len);
+if (methodp && method_len) {
+  resolved_variable.assign(methodp, method_len);
+}
+  } else if (variable == "%") {
+// The client request unmapped URL path. This field records a URL path
+// before it is remapped (reverse proxy mode).
+if (TSHttpTxnPristineUrlGet(res.txnp, &bufp, &url_loc) == TS_SUCCESS) {
+  int path_len;
+  const char *path = TSUrlPathGet(bufp, url_loc, &path_len);
+
+  if (path && path_len) {
+resolved_variable.assign(path, path_len);
+  }
+  TSHandleMLocRelease(bufp, TS_NULL_MLOC, url_loc);
+}
+  }
+
+  // TODO(SaveTheRbtz): Can be optimized
+  result.assign(first_part);
+  result.append(resolved_variable);
+  result.append(last_part);
+}
+
+return result;
+  }
+
+private:
+  std::string getIP(sockaddr const * s_sockaddr) {
+const struct sockaddr_in *s_sockaddr_in;
+const struct sockaddr_in6 *s_sockaddr_in6;
+
+if (s_sockaddr 

[10/10] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2013-11-12 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: 752e01e0710fa7cfb07d3c8ee2fd9effa3613120
Parents: bd24f12 9335e5c
Author: Brian Geffon 
Authored: Tue Nov 12 14:26:49 2013 -0800
Committer: Brian Geffon 
Committed: Tue Nov 12 14:26:49 2013 -0800

--
 CHANGES|   1 +
 cop/Makefile.am|   2 +
 iocore/aio/Makefile.am |   7 ++-
 iocore/cache/Makefile.am   |   7 +--
 iocore/cluster/Makefile.am |   7 ++-
 iocore/dns/Makefile.am |   7 ++-
 iocore/eventsystem/Makefile.am |  35 -
 iocore/hostdb/Makefile.am  |   8 ++-
 iocore/net/Makefile.am |  30 +++
 iocore/utils/Makefile.am   |   1 -
 lib/ts/Makefile.am | 100 +---
 lib/tsconfig/Makefile.am   |  13 +++--
 lib/wccp/Makefile.am   |  10 ++--
 mgmt/Makefile.am   |   1 +
 mgmt/cli/Makefile.am   |   1 -
 mgmt/preparse/Makefile.am  |   1 +
 proxy/Makefile.am  |   2 -
 proxy/hdrs/Makefile.am |  19 ---
 proxy/http/Makefile.am |  15 --
 proxy/logging/Makefile.am  |   4 ++
 20 files changed, 173 insertions(+), 98 deletions(-)
--




git commit: Updating changes for TS-2316

2013-11-12 Thread briang
Updated Branches:
  refs/heads/master 5059398f4 -> 81cf29c9a


Updating changes for TS-2316


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

Branch: refs/heads/master
Commit: 81cf29c9a0ab8970e270fcba805f8527d2e56993
Parents: 5059398
Author: bgaff 
Authored: Tue Nov 12 15:08:51 2013 -0800
Committer: bgaff 
Committed: Tue Nov 12 15:08:51 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cf29c9/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 98efc8e..b7415b4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
+  *) [TS-2316] header_rewrite: numerous improvements: cookie based conditions,
+   rule counters, improved documentation.
+   Author: Alexey Ivanov 
 
   *) [TS-2338] Remove IPRange.cc and .h, and SocksParser.cc.
 



[1/2] git commit: header_rewrite: remove RemapAPI-only restriction for PATH conditions

2013-12-06 Thread briang
Updated Branches:
  refs/heads/master 8dbf06bf3 -> eaaf88959


header_rewrite: remove RemapAPI-only restriction for PATH conditions

Segfault in PATH condition was already fixed in 236c52cf:
"TS-2316: header_rewrite: fixed segfaults in ConditionPath::append_value()"

Submitted by: Alexey Ivanov 
Sponsored by: LinkedIn


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

Branch: refs/heads/master
Commit: 6f6f05c5e826005cbd619d989746ebd27ebd19d9
Parents: 2b6a5f6
Author: Alexey Ivanov 
Authored: Tue Dec 3 19:28:51 2013 -0800
Committer: Alexey Ivanov 
Committed: Tue Dec 3 20:42:01 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6f6f05c5/plugins/header_rewrite/conditions.cc
--
diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 4ff38b6..46be14a 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -244,10 +244,6 @@ ConditionPath::eval(const Resources& res)
 {
   std::string s;
 
-  if (NULL == res._rri) {
-TSDebug(PLUGIN_NAME, "PATH requires remap initialization! Evaluating to 
false!");
-return false;
-  }
   append_value(s, res);
   TSDebug(PLUGIN_NAME, "Evaluating PATH");
 



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

2013-12-06 Thread briang
Merge branch 'master' of https://github.com/SaveTheRbtz/trafficserver


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

Branch: refs/heads/master
Commit: eaaf88959d27b46cfa3c4a17d31a934836198fee
Parents: 8dbf06b 6f6f05c
Author: Brian Geffon 
Authored: Fri Dec 6 11:07:46 2013 -0800
Committer: Brian Geffon 
Committed: Fri Dec 6 11:07:46 2013 -0800

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




git commit: [TS-2475] Adding new transaction methods to C++ API

2014-01-03 Thread briang
Updated Branches:
  refs/heads/master 0373ca358 -> daa10ebce


[TS-2475] Adding new transaction methods to C++ API


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

Branch: refs/heads/master
Commit: daa10ebce3fbde1ef640af0a9f9040418a4e45cf
Parents: 0373ca3
Author: Brian Geffon 
Authored: Fri Jan 3 10:43:15 2014 -0800
Committer: Brian Geffon 
Committed: Fri Jan 3 10:43:15 2014 -0800

--
 CHANGES |  2 ++
 lib/atscppapi/src/Transaction.cc| 22 +
 .../src/include/atscppapi/Transaction.h | 34 
 proxy/http/HttpSM.cc|  1 +
 4 files changed, 59 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/daa10ebc/CHANGES
--
diff --git a/CHANGES b/CHANGES
index b00bbf4..2759e63 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2475] Adding new transaction methods in C++ API
+
   *) [TS-2474] Change proxy.config.net.poll_timeout to 10ms consistently.
 
   *) [TS-2473] Fix C++ API includes for FreeBSD.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/daa10ebc/lib/atscppapi/src/Transaction.cc
--
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index e3be20f..df3f852 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -217,6 +217,28 @@ bool Transaction::setIncomingPort(uint16_t port) {
   return true; // In reality TSHttpTxnClientIncomingPortSet should return 
SUCCESS or ERROR.
 }
 
+/*
+ * Note: The following methods cannot be attached to a Response
+ * object because that would require the Response object to
+ * know that it's a server or client response because of the
+ * TS C api which is TSHttpTxnServerRespBodyBytesGet.
+ */
+size_t Transaction::getServerResponseBodySize() {
+  return static_cast(TSHttpTxnServerRespBodyBytesGet(state_->txn_));
+}
+
+size_t Transaction::getServerResponseHeaderSize() {
+  return static_cast(TSHttpTxnServerRespHdrBytesGet(state_->txn_));
+}
+
+size_t Transaction::getClientResponseBodySize() {
+  return static_cast(TSHttpTxnClientRespBodyBytesGet(state_->txn_));
+}
+
+size_t Transaction::getClientResponseHeaderSize() {
+  return static_cast(TSHttpTxnClientRespHdrBytesGet(state_->txn_));
+}
+
 void Transaction::setTimeout(Transaction::TimeoutType type, int time_ms) {
   switch (type) {
 case TIMEOUT_DNS:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/daa10ebc/lib/atscppapi/src/include/atscppapi/Transaction.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/Transaction.h 
b/lib/atscppapi/src/include/atscppapi/Transaction.h
index 13def37..1e6014f 100644
--- a/lib/atscppapi/src/include/atscppapi/Transaction.h
+++ b/lib/atscppapi/src/include/atscppapi/Transaction.h
@@ -264,6 +264,40 @@ public:
*/
   void addPlugin(TransactionPlugin *);
 
+
+  /*
+   * Note: The following methods cannot be attached to a Response
+   * object because that would require the Response object to
+   * know that it's a server or client response because of the
+   * TS C api which is TSHttpTxnServerRespBodyBytesGet.
+   */
+
+  /**
+   * Get the number of bytes for the response body as returned by the server
+   *
+   * @return server response body size */
+  size_t getServerResponseBodySize();
+
+  /**
+   * Get the nubmber of bytes for the response headers as returned by the 
server
+   *
+   * @return server response header size */
+  size_t getServerResponseHeaderSize();
+
+  /**
+   * Get the number of bytes for the client response.
+   * This can differ from the server response size because of transformations.
+   *
+   * @return client response body size */
+  size_t getClientResponseBodySize();
+
+  /**
+   * Get the number of bytes for the response headers.
+   * This can differ from the server response because headers can be modified.
+   *
+   * @return client response header size */
+  size_t getClientResponseHeaderSize();
+
 private:
   TransactionState *state_; //!< The internal TransactionState object tied to 
the current Transaction
   friend class TransactionPlugin; //!< TransactionPlugin is a friend so it can 
call addPlugin()

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

git commit: [TS-2497] Failed post results in tunnel buffers being returned to freelist prematurely, Reporter: Thomas Jackson

2014-01-15 Thread briang
Updated Branches:
  refs/heads/master 3fa5b0319 -> 5eab1b838


[TS-2497] Failed post results in tunnel buffers being returned to freelist 
prematurely, Reporter: Thomas Jackson 


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

Branch: refs/heads/master
Commit: 5eab1b838c0bc449f6e0ed881da40e6e832c8ee5
Parents: 3fa5b03
Author: Brian Geffon 
Authored: Wed Jan 15 14:43:14 2014 -0800
Committer: Brian Geffon 
Committed: Wed Jan 15 14:43:14 2014 -0800

--
 CHANGES  | 4 
 proxy/http/HttpSM.cc | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5eab1b83/CHANGES
--
diff --git a/CHANGES b/CHANGES
index a688aea..38ebf8d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2497] Failed post results in tunnel buffers being returned to
+   freelist prematurely.
+   Reporter: Thomas Jackson 
+
   *) [TS-1668] Added HSTS configuration options to ATS
 
   *) [TS-2495] Reduce the size of HttpVCTableEntry.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5eab1b83/proxy/http/HttpSM.cc
--
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index eff3260..2d6324a 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4957,7 +4957,6 @@ HttpSM::handle_post_failure()
   }
   ua_entry->in_tunnel = false;
   server_entry->in_tunnel = false;
-  tunnel.deallocate_buffers();
 
   // disable redirection in case we got a partial response and then EOS, 
because the buffer might not
   // have the full post and it's deallocating the post buffers here



git commit: [TS-1648] Segmentation fault in dir_clear_range()

2014-01-16 Thread briang
Updated Branches:
  refs/heads/master 4c6845994 -> fed6a5b8e


[TS-1648] Segmentation fault in dir_clear_range()


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

Branch: refs/heads/master
Commit: fed6a5b8e622303a2528dba64869aac6bfe9e28b
Parents: 4c68459
Author: Brian Geffon 
Authored: Thu Jan 16 15:38:15 2014 -0800
Committer: Brian Geffon 
Committed: Thu Jan 16 15:38:15 2014 -0800

--
 CHANGES  | 2 ++
 iocore/cache/CacheDir.cc | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fed6a5b8/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 221ebf2..8929fbd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-1648] Segmentation fault in dir_clear_range()
+
   *) [TS-2500] Fix handling of cache stripe assignment when a disk is
taken offline.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fed6a5b8/iocore/cache/CacheDir.cc
--
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index e00930e..f1ba72c 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -466,7 +466,7 @@ dir_clean_range_interimvol(off_t start, off_t end, 
InterimCacheVol *svol)
 void
 dir_clear_range(off_t start, off_t end, Vol *vol)
 {
-  for (int i = 0; i < vol->buckets * DIR_DEPTH * vol->segments; i++) {
+  for (int64_t i = 0; i < (int64_t)(vol->buckets * DIR_DEPTH * vol->segments); 
i++) {
 Dir *e = dir_index(vol, i);
 if (!dir_token(e) && dir_offset(e) >= (int64_t)start && dir_offset(e) < 
(int64_t)end) {
   CACHE_DEC_DIR_USED(vol->mutex);



git commit: [TS-1648] Segmentation fault in dir_clear_range()

2014-01-16 Thread briang
Updated Branches:
  refs/heads/master fed6a5b8e -> 9ad143897


[TS-1648] Segmentation fault in dir_clear_range()


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

Branch: refs/heads/master
Commit: 9ad143897aa4fa914705bc9e8fceaf056a8dbb37
Parents: fed6a5b
Author: Brian Geffon 
Authored: Thu Jan 16 17:34:27 2014 -0800
Committer: Brian Geffon 
Committed: Thu Jan 16 17:34:27 2014 -0800

--
 iocore/cache/CacheDir.cc | 2 +-
 lib/atscppapi/src/Headers.cc | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ad14389/iocore/cache/CacheDir.cc
--
diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index f1ba72c..d5e7739 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -466,7 +466,7 @@ dir_clean_range_interimvol(off_t start, off_t end, 
InterimCacheVol *svol)
 void
 dir_clear_range(off_t start, off_t end, Vol *vol)
 {
-  for (int64_t i = 0; i < (int64_t)(vol->buckets * DIR_DEPTH * vol->segments); 
i++) {
+  for (off_t i = 0; i < vol->buckets * DIR_DEPTH * vol->segments; i++) {
 Dir *e = dir_index(vol, i);
 if (!dir_token(e) && dir_offset(e) >= (int64_t)start && dir_offset(e) < 
(int64_t)end) {
   CACHE_DEC_DIR_USED(vol->mutex);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9ad14389/lib/atscppapi/src/Headers.cc
--
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index 2c061da..8eb0ce5 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -51,14 +51,14 @@ HeaderFieldName::operator const char*() {
   return name_.c_str();
 }
 
-HeaderFieldName::size_type HeaderFieldName::length() {
-  return name_.length();
-}
-
 std::string HeaderFieldName::str() {
   return name_;
 }
 
+HeaderFieldName::size_type HeaderFieldName::length() {
+  return name_.length();
+}
+
 const char *HeaderFieldName::c_str() {
   return name_.c_str();
 }



[2/2] git commit: [TS-2541] Add WebSocket Support

2014-02-03 Thread briang
[TS-2541] Add WebSocket Support


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

Branch: refs/heads/master
Commit: 60ec950539ab9f5b138c41bfddb2008128773787
Parents: cca82f1 f0f9cb9
Author: Brian Geffon 
Authored: Mon Feb 3 11:11:26 2014 -0800
Committer: Brian Geffon 
Committed: Mon Feb 3 11:11:26 2014 -0800

--

--




[1/2] git commit: [TS-2541] Add WebSocket Support

2014-02-03 Thread briang
Updated Branches:
  refs/heads/master f0f9cb9c3 -> 60ec95053


[TS-2541] Add WebSocket Support


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

Branch: refs/heads/master
Commit: cca82f1b910dfea6903e05602b06df53e4979b9b
Parents: 70f8e10
Author: Brian Geffon 
Authored: Mon Feb 3 11:10:44 2014 -0800
Committer: Brian Geffon 
Committed: Mon Feb 3 11:10:44 2014 -0800

--
 CHANGES   |   2 +
 proxy/config/remap.config.default |   8 +
 proxy/hdrs/HdrToken.cc|  18 +++
 proxy/hdrs/HdrToken.h |   8 +-
 proxy/hdrs/MIME.cc|  20 ++-
 proxy/hdrs/MIME.h |   8 +
 proxy/hdrs/URL.cc |  14 ++
 proxy/hdrs/URL.h  |   6 +
 proxy/http/HttpClientSession.cc   |   1 +
 proxy/http/HttpConfig.cc  |   5 +
 proxy/http/HttpConfig.h   |   1 +
 proxy/http/HttpDebugNames.cc  |   3 +-
 proxy/http/HttpSM.cc  |  23 ++-
 proxy/http/HttpTransact.cc| 284 -
 proxy/http/HttpTransact.h |  33 +++-
 proxy/http/HttpTransactHeaders.cc |   7 +-
 proxy/http/remap/RemapConfig.cc   |  17 +-
 17 files changed, 406 insertions(+), 52 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca82f1b/CHANGES
--
diff --git a/CHANGES b/CHANGES
index be006e8..fab65c0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 4.2.0
 
+  *) [TS-2541] Add WebSocket support
+
   *) [TS-2550] Add inline configuration overrised to the conf_remap plugin.
 
   *) [TS-2546] Move xptr and _xstrdup to ink_memory.{h,cc}.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca82f1b/proxy/config/remap.config.default
--
diff --git a/proxy/config/remap.config.default 
b/proxy/config/remap.config.default
index e0cd89a..2198ee4 100644
--- a/proxy/config/remap.config.default
+++ b/proxy/config/remap.config.default
@@ -149,6 +149,14 @@
 #  Example:
 #map http://foo.cow.com/ http://bar.cow.com 
@src_ip=10.72.118.51-10.72.118.62 @method=GET @method=DELETE 
@src_ip=192.168.0.1-192.168.0.254 @action=allow @method=PUT
 #
+#  Traffic Server supports WebSockets but it must be enabled via remap. 
WebSocket upgrades are automatically
+#  detected when there exists a remap rule containing a ws:// scheme.
+#
+#  Example:
+# map ws://bar.com/ ws://foo.com/
+#
+#  Explaination: When a request comes in with the appropriate upgrade headers, 
Traffic Server will use this
+#   remap rule in an attempt to establish and maintain a websocket connection.
 #
 #  Named filters can be created and applied to blocks of mappings
 #  using the .definefilter, .activatefilter, and .deactivatefilter

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca82f1b/proxy/hdrs/HdrToken.cc
--
diff --git a/proxy/hdrs/HdrToken.cc b/proxy/hdrs/HdrToken.cc
index 72bbbe1..7977b67 100644
--- a/proxy/hdrs/HdrToken.cc
+++ b/proxy/hdrs/HdrToken.cc
@@ -145,6 +145,11 @@ static const char *_hdrtoken_strs[] = {
   "chunked",
   "close",
   
+  // WS
+  "websocket",
+  "Sec-WebSocket-Key",
+  "Sec-WebSocket-Version",
+
   // URL schemes
   "file",
   "ftp",
@@ -164,6 +169,8 @@ static const char *_hdrtoken_strs[] = {
   "mmsu",
   "mmst",
   "mms",
+  "wss",
+  "ws",
   
   // HTTP methods
   "CONNECT",
@@ -203,6 +210,8 @@ static HdrTokenTypeBinding 
_hdrtoken_strs_type_initializers[] = {
   {"mms", HDRTOKEN_TYPE_SCHEME},
   {"mmsu", HDRTOKEN_TYPE_SCHEME},
   {"mmst", HDRTOKEN_TYPE_SCHEME},
+  {"wss", HDRTOKEN_TYPE_SCHEME},
+  {"ws", HDRTOKEN_TYPE_SCHEME},
 
   {"CONNECT", HDRTOKEN_TYPE_METHOD},
   {"DELETE", HDRTOKEN_TYPE_METHOD},
@@ -309,6 +318,8 @@ static HdrTokenFieldInfo 
_hdrtoken_strs_field_initializers[] = {
   {"@DataInfo", MIME_SLOTID_NONE, MIME_PRESENCE_INT_DATA_INFO, HTIF_NONE},
   {"X-ID", MIME_SLOTID_NONE, MIME_PRESENCE_NONE, (HTIF_COMMAS | HTIF_MULTVALS 
| HTIF_HOPBYHOP)},
   {"X-Forwarded-For", MIME_SLOTID_NONE, MIME_PRESENCE_NONE, (HTIF_COMMAS | 
HTIF_MULTVALS)},
+  {"Sec-WebSocket-Key", MIME_SLOTID_NONE, MIME_PRESENCE_NONE, HTIF_NONE},
+  {"Sec-WebSocket-Version", MIME_SLOTID_NONE, MIME_PRESENCE_NONE, HTIF_NONE},
   {NULL, 0, 0, 0}
 };
 
@@ -473,6 +484,11 @@ static const char *_hdrtoken_commonly_tokenized_strs[] = {
   "chunked",
   "close",
   
+  // WS
+  "websocket",
+  "Sec-WebSocket-Key",
+  "Sec-WebSocket-Ve

git commit: Adding notice

2014-02-05 Thread briang
Updated Branches:
  refs/heads/master 370e2ace0 -> e9d757da0


Adding notice


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

Branch: refs/heads/master
Commit: e9d757da09a5f5afd3216325a54ff4ff3ab2965c
Parents: 370e2ac
Author: Brian Geffon 
Authored: Wed Feb 5 18:12:22 2014 -0800
Committer: Brian Geffon 
Committed: Wed Feb 5 18:12:22 2014 -0800

--
 NOTICE | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e9d757da/NOTICE
--
diff --git a/NOTICE b/NOTICE
index 55084b6..a28f2c8 100644
--- a/NOTICE
+++ b/NOTICE
@@ -7,6 +7,7 @@ This product includes software developed at
   - Network Geographics (http://network-geographics.com)
   - OmniTI
   - Comcast
+  - LinkedIn
 
 ~~~
 
@@ -27,6 +28,11 @@ Copyright (C) 2010 Network Geographics, Inc.
 
 ~~~
 
+WebSocket support developed by LinkedIn
+Copyright (C) 2014 LinkedIn
+
+~~~
+
 Cacheurl Plugin developed by OmniTI on behalf of Google.
 Copyright (C) 2011 Google Inc.
 



git commit: Adding myself to reviewers

2014-02-13 Thread briang
Updated Branches:
  refs/heads/master 0df8dd7f2 -> 6636f4dcf


Adding myself to reviewers


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

Branch: refs/heads/master
Commit: 6636f4dcf031e2f6fbb7324a2320d7a1b07147e1
Parents: 0df8dd7
Author: Brian Geffon 
Authored: Thu Feb 13 10:58:06 2014 -0800
Committer: Brian Geffon 
Committed: Thu Feb 13 10:58:06 2014 -0800

--
 REVIEWERS | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6636f4dc/REVIEWERS
--
diff --git a/REVIEWERS b/REVIEWERS
index 369d4b9..5380681 100644
--- a/REVIEWERS
+++ b/REVIEWERS
@@ -18,6 +18,7 @@ Committers: add modules as needed and any qualifications 
after your e-mail addre
 all/general interest
 jplev...@apache.org
 bc...@apache.org
+   bri...@apache.org
 mt...@apache.org
 zw...@apache.org
 j...@apache.org
@@ -35,13 +36,15 @@ lib/records
 Event System/Buffering/VIO/VConnection
 jplev...@apache.org
 bc...@apache.org
+   bri...@apache.org
 geor...@apache.org
 Network I/O
 jplev...@apache.org - not including SSL or UDP except where it 
intersects the other code
 bc...@apache.org
 geor...@apache.org
+   bri...@apache.org
 j...@apache.org
- zw...@apache.org
+   zw...@apache.org
 Raw Cache and AIO
 jplev...@apache.org
 bc...@apache.org
@@ -68,6 +71,7 @@ Docs
 Examples/Plugins
 zw...@apache.org
 bc...@apache.org
+   bri...@apache.org
 er...@apache.org
 HDRs
 bc...@apache.org
@@ -75,6 +79,7 @@ HDRs
 HTTP
 bc...@apache.org
 zw...@apache.org
+   bri...@apache.org
 j...@apache.org
 er...@apache.org
 Remap
@@ -84,6 +89,7 @@ Remap
 er...@apache.org
 API
 zw...@apache.org
+   bri...@apache.org
 bc...@apache.org
 geor...@apache.org
 er...@apache.org
@@ -99,7 +105,8 @@ MGMT
 Stats
 bc...@apache.org
 geor...@apache.org
- zw...@apache.org
+   bri...@apache.org
+   zw...@apache.org
 Build System
 zw...@apache.org
 bc...@apache.org



git commit: Fix issues releasing MLocHandles in headers

2014-02-18 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master f5c2b2c94 -> d3e4614bf


Fix issues releasing MLocHandles in headers


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

Branch: refs/heads/master
Commit: d3e4614bf3e945c07c367cc488dc13ee832ce131
Parents: f5c2b2c
Author: Brian Geffon 
Authored: Tue Feb 18 14:48:36 2014 -0800
Committer: Brian Geffon 
Committed: Tue Feb 18 14:48:36 2014 -0800

--
 lib/atscppapi/src/Headers.cc  | 171 +++--
 lib/atscppapi/src/include/atscppapi/Headers.h | 157 +--
 2 files changed, 159 insertions(+), 169 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3e4614b/lib/atscppapi/src/Headers.cc
--
diff --git a/lib/atscppapi/src/Headers.cc b/lib/atscppapi/src/Headers.cc
index 8eb0ce5..871fecc 100644
--- a/lib/atscppapi/src/Headers.cc
+++ b/lib/atscppapi/src/Headers.cc
@@ -20,6 +20,7 @@
  * @file Headers.cc
  */
 #include "atscppapi/Headers.h"
+#include "atscppapi/shared_ptr.h"
 #include "InitializableValue.h"
 #include "logging_internal.h"
 #include 
@@ -147,45 +148,46 @@ bool header_field_value_iterator::operator!=(const 
header_field_value_iterator&
 /**
  * @private
  */
-struct HeaderFieldState: noncopyable {
+struct MLocContainer {
   TSMBuffer hdr_buf_;
   TSMLoc hdr_loc_;
   TSMLoc field_loc_;
-  HeaderFieldState() : hdr_buf_(NULL), hdr_loc_(NULL), field_loc_(NULL) { }
-  void reset(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) {
-hdr_buf_ = bufp;
-hdr_loc_ = hdr_loc;
-field_loc_ = field_loc;
+  MLocContainer(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc) :
+hdr_buf_(bufp), hdr_loc_(hdr_loc), field_loc_(field_loc) { }
+  ~MLocContainer() {
+if (field_loc_ != TS_NULL_MLOC) {
+  TSHandleMLocRelease(hdr_buf_, hdr_loc_, field_loc_);
+}
   }
 };
 
-HeaderField::HeaderField(void *bufp, void *hdr_loc, void *field_loc)
-{
-  state_ = new HeaderFieldState();
-  state_->hdr_buf_ = static_cast(bufp);
-  state_->hdr_loc_ = static_cast(hdr_loc);
-  state_->field_loc_ = static_cast(field_loc);
-}
+/**
+ * @private
+ */
+struct HeaderFieldIteratorState {
+  shared_ptr mloc_container_;
+  HeaderFieldIteratorState(TSMBuffer bufp, TSMLoc hdr_loc, TSMLoc field_loc)
+: mloc_container_(new MLocContainer(bufp, hdr_loc, field_loc)) { }
+};
 
 HeaderField::~HeaderField() {
-  delete state_;
 }
 
 HeaderField::size_type HeaderField::size() const {
-  return TSMimeHdrFieldValuesCount(state_->hdr_buf_, state_->hdr_loc_, 
state_->field_loc_);
+  return TSMimeHdrFieldValuesCount(iter_.state_->mloc_container_->hdr_buf_, 
iter_.state_->mloc_container_->hdr_loc_, 
iter_.state_->mloc_container_->field_loc_);
 }
 
 header_field_value_iterator HeaderField::begin() {
-  return header_field_value_iterator(state_->hdr_buf_, state_->hdr_loc_, 
state_->field_loc_, 0);
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, 
iter_.state_->mloc_container_->hdr_loc_, 
iter_.state_->mloc_container_->field_loc_, 0);
 }
 
 header_field_value_iterator HeaderField::end() {
-  return header_field_value_iterator(state_->hdr_buf_, state_->hdr_loc_, 
state_->field_loc_, size());
+  return header_field_value_iterator(iter_.state_->mloc_container_->hdr_buf_, 
iter_.state_->mloc_container_->hdr_loc_, 
iter_.state_->mloc_container_->field_loc_, size());
 }
 
 HeaderFieldName HeaderField::name() const {
   int length = 0;
-  const char *str = TSMimeHdrFieldNameGet(state_->hdr_buf_, state_->hdr_loc_, 
state_->field_loc_, &length);
+  const char *str = 
TSMimeHdrFieldNameGet(iter_.state_->mloc_container_->hdr_buf_, 
iter_.state_->mloc_container_->hdr_loc_, 
iter_.state_->mloc_container_->field_loc_, &length);
   if (str && length) {
 return std::string(str, length);
   }
@@ -211,12 +213,29 @@ std::string HeaderField::values(const char join) {
   return values(std::string().append(1,join));
 }
 
+std::string Headers::value(const std::string key, size_type index /* = 0 */) {
+  header_field_iterator iter = find(key);
+  if (iter == end()) {
+return string();
+  }
+  if (index == 0) { // skip for loop
+return *((*iter).begin());
+  }
+  for (; iter != end(); iter.nextDup()) {
+if (index < (*iter).size()) {
+  return (*iter)[index];
+}
+index -= (*iter).size();
+  }
+  return string();
+}
+
 bool HeaderField::empty() {
   return (begin() == end());
 }
 
 bool HeaderField::clear() {
-  return (TSMimeHdrFieldValuesClear(state_->hdr_buf_, state_->hdr_loc_, 
state_->field_loc_) == TS_SUCCESS);
+  return (TSMimeHdrFieldValuesClear(i

git commit: Fix bug with GzipDefalate transformation

2014-03-04 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 912d5f2f8 -> d9ecf4f9e


Fix bug with GzipDefalate transformation


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

Branch: refs/heads/master
Commit: d9ecf4f9ec5bf8cc35b0329fc549c496466a0f7a
Parents: 912d5f2
Author: Brian Geffon 
Authored: Tue Mar 4 15:56:01 2014 -0800
Committer: Brian Geffon 
Committed: Tue Mar 4 15:56:01 2014 -0800

--
 lib/atscppapi/src/GzipDeflateTransformation.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d9ecf4f9/lib/atscppapi/src/GzipDeflateTransformation.cc
--
diff --git a/lib/atscppapi/src/GzipDeflateTransformation.cc 
b/lib/atscppapi/src/GzipDeflateTransformation.cc
index ac8348c..3b70c02 100644
--- a/lib/atscppapi/src/GzipDeflateTransformation.cc
+++ b/lib/atscppapi/src/GzipDeflateTransformation.cc
@@ -35,7 +35,7 @@ using std::vector;
 namespace {
 const int GZIP_MEM_LEVEL = 8;
 const int WINDOW_BITS = 31; // Always use 31 for gzip.
-const int ONE_KB = 1024;
+const unsigned int ONE_KB = 1024;
 }
 
 /**
@@ -94,7 +94,7 @@ void GzipDeflateTransformation::consume(const string &data) {
 
   // For small payloads the size can actually be greater than the original 
input
   // so we'll use twice the original size to avoid needless repeated calls to 
deflate.
-  unsigned long buffer_size = data.length() < 
static_cast(ONE_KB ? 2 * ONE_KB : data.length());
+  unsigned long buffer_size = (data.length() < ONE_KB) ? 2 * ONE_KB : 
data.length();
   vector buffer(buffer_size);
 
   do {



[2/2] git commit: intercept support in atscppapi

2014-03-06 Thread briang
intercept support in atscppapi


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

Branch: refs/heads/master
Commit: b4c34003301694dc5a26498382c4446364d4a2eb
Parents: 79ae4a1
Author: Manjesh Nilange 
Authored: Thu Mar 6 12:36:54 2014 -0800
Committer: Manjesh Nilange 
Committed: Thu Mar 6 12:36:54 2014 -0800

--
 configure.ac  |  1 +
 lib/atscppapi/examples/Makefile.am|  3 +-
 lib/atscppapi/examples/intercept/Makefile.am  | 24 ++
 lib/atscppapi/examples/intercept/intercept.cc | 55 ++
 lib/atscppapi/src/Makefile.am |  6 ++-
 lib/atscppapi/src/include/utils_internal.h|  6 +++
 6 files changed, 92 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4c34003/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 875f2c4..7460f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1937,6 +1937,7 @@ AC_CONFIG_FILES([
   lib/atscppapi/examples/timeout_example/Makefile
   lib/atscppapi/examples/internal_transaction_handling/Makefile
   lib/atscppapi/examples/async_timer/Makefile
+  lib/atscppapi/examples/intercept/Makefile
   lib/wccp/Makefile
   lib/perl/Makefile
   lib/perl/lib/Apache/TS.pm

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4c34003/lib/atscppapi/examples/Makefile.am
--
diff --git a/lib/atscppapi/examples/Makefile.am 
b/lib/atscppapi/examples/Makefile.am
index 23c9c70..9cbf7d6 100644
--- a/lib/atscppapi/examples/Makefile.am
+++ b/lib/atscppapi/examples/Makefile.am
@@ -33,4 +33,5 @@ SUBDIRS = helloworld \
  gzip_transformation \
  timeout_example \
   internal_transaction_handling \
-  async_timer
\ No newline at end of file
+  async_timer \
+  intercept
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4c34003/lib/atscppapi/examples/intercept/Makefile.am
--
diff --git a/lib/atscppapi/examples/intercept/Makefile.am 
b/lib/atscppapi/examples/intercept/Makefile.am
new file mode 100644
index 000..2400a10
--- /dev/null
+++ b/lib/atscppapi/examples/intercept/Makefile.am
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2013 LinkedIn Corp. All rights reserved. 
+# Licensed 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.
+#
+
+AM_CPPFLAGS = -I$(top_srcdir)/src/include
+
+target=intercept.so
+pkglibdir = ${pkglibexecdir}
+pkglib_LTLIBRARIES = intercept.la
+intercept_la_SOURCES = intercept.cc
+intercept_la_LDFLAGS = -module -avoid-version -shared -L$(top_srcdir) 
-latscppapi
+
+all:
+   ln -sf .libs/$(target)
+
+clean-local:
+   rm -f $(target)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4c34003/lib/atscppapi/examples/intercept/intercept.cc
--
diff --git a/lib/atscppapi/examples/intercept/intercept.cc 
b/lib/atscppapi/examples/intercept/intercept.cc
new file mode 100644
index 000..4c98782
--- /dev/null
+++ b/lib/atscppapi/examples/intercept/intercept.cc
@@ -0,0 +1,55 @@
+#include 
+#include 
+#include 
+
+#include 
+
+using namespace atscppapi;
+using std::string;
+using std::cout;
+using std::endl;
+
+class Intercept : public InterceptPlugin {
+public:
+  Intercept(Transaction &transaction) : InterceptPlugin(transaction, 
InterceptPlugin::SERVER_INTERCEPT) { }
+  void consume(const string &data, InterceptPlugin::RequestDataType type);
+  void handleInputComplete();
+  ~Intercept() { cout << "Shutting down" << endl; }
+};
+
+class InterceptInstaller : public GlobalPlugin {
+public:
+  InterceptInstaller() : GlobalPlugin(true /* ignore internal transactions */) 
{
+GlobalPlugin::registerHook(Plugin::HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
+  }
+  void handleReadRequestHeadersPreRemap(Transaction &transaction) {
+transaction.addPlugin(new Intercept(transaction));
+cout << "Added intercept" << endl;
+transaction.resume();
+  }
+};
+
+void TSPluginInit(int argc, const char *argv[]) {
+  new InterceptInstaller();
+}
+
+void Intercept::consume(const strin

[1/2] git commit: Fixed async http fetch to support headers and post body

2014-03-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master f5c07af5d -> b4c340033


Fixed async http fetch to support headers and post body


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

Branch: refs/heads/master
Commit: 79ae4a1fc37662ae79167beca0533785be63498a
Parents: f5c07af
Author: Manjesh Nilange 
Authored: Thu Mar 6 12:29:23 2014 -0800
Committer: Manjesh Nilange 
Committed: Thu Mar 6 12:29:23 2014 -0800

--
 .../examples/async_http_fetch/AsyncHttpFetch.cc | 14 +--
 lib/atscppapi/src/AsyncHttpFetch.cc | 41 +---
 lib/atscppapi/src/Headers.cc| 15 ++-
 .../src/include/atscppapi/AsyncHttpFetch.h  |  3 ++
 lib/atscppapi/src/include/atscppapi/Headers.h   |  3 +-
 5 files changed, 56 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79ae4a1f/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
--
diff --git a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc 
b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
index c0b8079..c296dfe 100644
--- a/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
+++ b/lib/atscppapi/examples/async_http_fetch/AsyncHttpFetch.cc
@@ -55,12 +55,17 @@ public:
   void handleSendRequestHeaders(Transaction &transaction) {
 Async::execute(this, new 
AsyncHttpFetch("http://127.0.0.1/";), getMutex());
 ++num_fetches_pending_;
+AsyncHttpFetch *post_request = new AsyncHttpFetch("http://127.0.0.1/post";, 
"data");
+
+Async::execute(this, new 
AsyncHttpFetch("http://127.0.0.1/post";, "data"),
+   getMutex());
+++num_fetches_pending_;
 
 // we'll add some custom headers for this request
 AsyncHttpFetch2 *provider2 = new AsyncHttpFetch2("http://127.0.0.1/";);
 Headers &request_headers = provider2->getRequestHeaders();
-request_headers["Header1"]  = "Value1";
-request_headers["Header2"]  = "Value2";
+request_headers.set("Header1", "Value1");
+request_headers.set("Header2", "Value2");
 Async::execute(this, provider2, getMutex());
 ++num_fetches_pending_;
   }
@@ -93,6 +98,7 @@ private:
 
   void handleAnyAsyncComplete(AsyncHttpFetch &async_http_fetch) {
 // This will be called when our async event is complete.
+TS_DEBUG(TAG, "Fetch completed for URL [%s]", 
async_http_fetch.getRequestUrl().getUrlString().c_str());
 const Response &response = async_http_fetch.getResponse();
 if (async_http_fetch.getResult() == AsyncHttpFetch::RESULT_SUCCESS) {
   TS_DEBUG(TAG, "Response version is [%s], status code %d, reason phrase 
[%s]",
@@ -104,7 +110,7 @@ private:
   const void *body;
   size_t body_size;
   async_http_fetch.getResponseBody(body, body_size);
-  TS_DEBUG(TAG, "Response body is [%.*s]", static_cast(body_size), 
static_cast(body));
+  TS_DEBUG(TAG, "Response body is [%.*s]", body_size, body);
 } else {
   TS_ERROR(TAG, "Fetch did not complete successfully; Result %d",
static_cast(async_http_fetch.getResult()));
@@ -137,6 +143,6 @@ public:
 
 void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] 
ATSCPPAPI_UNUSED) {
   TS_DEBUG(TAG, "Loaded async_http_fetch_example plugin");
-  new GlobalHookPlugin();
+  GlobalPlugin *instance = new GlobalHookPlugin();
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/79ae4a1f/lib/atscppapi/src/AsyncHttpFetch.cc
--
diff --git a/lib/atscppapi/src/AsyncHttpFetch.cc 
b/lib/atscppapi/src/AsyncHttpFetch.cc
index 7f40dd2..1ea8b5f 100644
--- a/lib/atscppapi/src/AsyncHttpFetch.cc
+++ b/lib/atscppapi/src/AsyncHttpFetch.cc
@@ -26,6 +26,8 @@
 #include "logging_internal.h"
 #include "utils_internal.h"
 
+#include 
+
 using namespace atscppapi;
 using std::string;
 
@@ -35,6 +37,7 @@ using std::string;
 struct atscppapi::AsyncHttpFetchState : noncopyable {
   Request request_;
   Response response_;
+  string request_body_;
   AsyncHttpFetch::Result result_;
   const void *body_;
   size_t body_size_;
@@ -42,9 +45,9 @@ struct atscppapi::AsyncHttpFetchState : noncopyable {
   TSMLoc hdr_loc_;
   shared_ptr dispatch_controller_;
 
-  AsyncHttpFetchState(const string &url_str, HttpMethod http_method)
-: request_(url_str, http_method, HTTP_VERSION_1_0), 
result_(AsyncHttpFetch::RESULT_FAILURE), body_(NULL),
-  body_size_(0), hdr_buf_(NULL), hdr_loc_(NULL) { }
+  AsyncHttpFetchState(const string &url_str, HttpMethod http_method, string 
request_body)
+ 

git commit: Fixing license header

2014-03-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master b4c340033 -> c5655676f


Fixing license header


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

Branch: refs/heads/master
Commit: c5655676f3d04d9e8c3ae1ab880f39394186
Parents: b4c3400
Author: Brian Geffon 
Authored: Thu Mar 6 12:56:18 2014 -0800
Committer: Brian Geffon 
Committed: Thu Mar 6 12:56:18 2014 -0800

--
 lib/atscppapi/examples/intercept/Makefile.am | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c5655676/lib/atscppapi/examples/intercept/Makefile.am
--
diff --git a/lib/atscppapi/examples/intercept/Makefile.am 
b/lib/atscppapi/examples/intercept/Makefile.am
index 2400a10..ef39f1d 100644
--- a/lib/atscppapi/examples/intercept/Makefile.am
+++ b/lib/atscppapi/examples/intercept/Makefile.am
@@ -1,14 +1,19 @@
 #
-# Copyright (c) 2013 LinkedIn Corp. All rights reserved. 
-# Licensed 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
+##  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
 #
-# 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.
+##  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.
 AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 target=intercept.so



[1/3] git commit: atscppapi: Added missing intercept files

2014-03-06 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master faf38a5e0 -> 148b47455


atscppapi: Added missing intercept files


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

Branch: refs/heads/master
Commit: 51fc9ff92b41bec074613367c5a708103794be68
Parents: b4c3400
Author: Manjesh Nilange 
Authored: Thu Mar 6 15:12:02 2014 -0800
Committer: Manjesh Nilange 
Committed: Thu Mar 6 15:12:02 2014 -0800

--
 lib/atscppapi/src/InterceptPlugin.cc| 295 +++
 .../src/include/atscppapi/InterceptPlugin.h |  98 ++
 2 files changed, 393 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51fc9ff9/lib/atscppapi/src/InterceptPlugin.cc
--
diff --git a/lib/atscppapi/src/InterceptPlugin.cc 
b/lib/atscppapi/src/InterceptPlugin.cc
new file mode 100644
index 000..dd7242f
--- /dev/null
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -0,0 +1,295 @@
+/**
+  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.
+ */
+
+/**
+ * @file InterceptPlugin.cc
+ */
+
+#include "atscppapi/InterceptPlugin.h"
+
+#include 
+#include "logging_internal.h"
+#include "atscppapi/noncopyable.h"
+#include "utils_internal.h"
+
+#include 
+#include 
+
+#ifndef INT64_MAX
+#define INT64_MAX (9223372036854775807LL)
+#endif
+
+using namespace atscppapi;
+using std::string;
+
+/**
+ * @private
+ */
+struct InterceptPlugin::State {
+  TSCont cont_;
+  TSVConn net_vc_;
+
+  struct IoHandle {
+TSVIO vio_;
+TSIOBuffer buffer_;
+TSIOBufferReader reader_;
+IoHandle() : vio_(NULL), buffer_(NULL), reader_(NULL) { };
+~IoHandle() {
+  if (reader_) {
+TSIOBufferReaderFree(reader_);
+  }
+  if (buffer_) {
+TSIOBufferDestroy(buffer_);
+  }
+};
+  };
+
+  IoHandle input_;
+  IoHandle output_;
+
+  /** the API doesn't recognize end of input; so we have to explicitly
+   * figure out when to continue reading and when to stop */
+  TSHttpParser http_parser_;
+  int expected_body_size_;
+  int num_body_bytes_read_;
+  bool hdr_parsed_;
+
+  TSMBuffer hdr_buf_;
+  TSMLoc hdr_loc_;
+  int num_bytes_written_;
+
+  State(TSCont cont) : cont_(cont), net_vc_(NULL), expected_body_size_(0), 
num_body_bytes_read_(0),
+   hdr_parsed_(false), hdr_buf_(NULL), hdr_loc_(NULL), 
num_bytes_written_(0) {
+http_parser_ = TSHttpParserCreate();
+  }
+  
+  ~State() {
+TSHttpParserDestroy(http_parser_); 
+if (hdr_loc_) {
+  TSHandleMLocRelease(hdr_buf_, TS_NULL_MLOC, hdr_loc_);
+}
+if (hdr_buf_) {
+  TSMBufferDestroy(hdr_buf_);
+}
+  }
+};
+
+namespace {
+
+int handleEvents(TSCont cont, TSEvent event, void *edata);
+
+}
+
+InterceptPlugin::InterceptPlugin(Transaction &transaction, 
InterceptPlugin::Type type)
+  : TransactionPlugin(transaction) {
+  TSCont cont = TSContCreate(handleEvents, TSMutexCreate());
+  TSContDataSet(cont, this);
+  state_ = new State(cont);
+  TSHttpTxn txn = static_cast(transaction.getAtsHandle());
+  if (type == SERVER_INTERCEPT) {
+TSHttpTxnServerIntercept(cont, txn);
+  }
+  else {
+TSHttpTxnIntercept(cont, txn);
+  }
+  Headers &request_headers = transaction.getClientRequest().getHeaders();
+  string content_length_str = request_headers.value("Content-Length");
+  if (!content_length_str.empty()) {
+const char *start_ptr = content_length_str.data();
+char *end_ptr;
+int content_length = strtol(start_ptr, &end_ptr, 10 /* base */);
+if ((errno != ERANGE) && (end_ptr != start_ptr) && (*end_ptr == '\0')) {
+  LOG_DEBUG("Got content length: %d", content_length);
+  state_->expected_body_size_ = content_length;
+}
+else {
+  LOG_ERROR("Invalid content length header [%s]; Assuming no content", 
content_length_str.c_str());
+}
+  }
+  if (request_headers.value("Transfer-Encoding") == "chunke

[3/3] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2014-03-06 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: 148b4745548c3c495a7ce151dd5e40b542ad38f4
Parents: 3c3bd8b faf38a5
Author: Brian Geffon 
Authored: Thu Mar 6 15:18:20 2014 -0800
Committer: Brian Geffon 
Committed: Thu Mar 6 15:18:20 2014 -0800

--
 doc/arch/cache/cache-arch.en.rst  | 10 +-
 doc/reference/configuration/records.config.en.rst |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
--




[2/3] git commit: Merge branch 'master' of https://github.com/manjeshnilange/trafficserver

2014-03-06 Thread briang
Merge branch 'master' of https://github.com/manjeshnilange/trafficserver


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

Branch: refs/heads/master
Commit: 3c3bd8bdc2dde8abac063897d0136d12006472a9
Parents: c565567 51fc9ff
Author: Brian Geffon 
Authored: Thu Mar 6 15:17:59 2014 -0800
Committer: Brian Geffon 
Committed: Thu Mar 6 15:17:59 2014 -0800

--
 lib/atscppapi/src/InterceptPlugin.cc| 295 +++
 .../src/include/atscppapi/InterceptPlugin.h |  98 ++
 2 files changed, 393 insertions(+)
--




git commit: [TS-2625] trafficserver.in doesn't use TSBASE directory.

2014-03-10 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 362c8b692 -> 7fad3c29e


[TS-2625] trafficserver.in doesn't use TSBASE directory.


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

Branch: refs/heads/master
Commit: 7fad3c29e4508be7e6c04dff53b30bc1e92ddf92
Parents: 362c8b6
Author: Brian Geffon 
Authored: Mon Mar 10 15:47:24 2014 -0700
Committer: Brian Geffon 
Committed: Mon Mar 10 15:47:24 2014 -0700

--
 rc/trafficserver.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7fad3c29/rc/trafficserver.in
--
diff --git a/rc/trafficserver.in b/rc/trafficserver.in
index 5e1d0a4..8c2672e 100644
--- a/rc/trafficserver.in
+++ b/rc/trafficserver.in
@@ -164,10 +164,10 @@ test -f /lib/lsb/init-functions && . 
/lib/lsb/init-functions
 # with native OS rc.subr(8) features.
 test -f /etc/rc.subr && . /etc/rc.subr
 
-if [ ! -d @exp_runtimedir@ ]
+if [ ! -d $TS_BASE@exp_runtimedir@ ]
 then
-   mkdir -p @exp_runtimedir@
-   chown @pkgsysuser@:@pkgsysgroup@ @exp_runtimedir@
+   mkdir -p $TS_BASE@exp_runtimedir@
+   chown @pkgsysuser@:@pkgsysgroup@ $TS_BASE@exp_runtimedir@
 fi
 
 #



git commit: [TS-2625] trafficserver.in doesn't use TSBASE directory.

2014-03-10 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 7fad3c29e -> 4611c511c


[TS-2625] trafficserver.in doesn't use TSBASE directory.


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

Branch: refs/heads/master
Commit: 4611c511c92e01868658f0d0838b61de7e438873
Parents: 7fad3c2
Author: Brian Geffon 
Authored: Mon Mar 10 15:49:11 2014 -0700
Committer: Brian Geffon 
Committed: Mon Mar 10 15:49:11 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4611c511/CHANGES
--
diff --git a/CHANGES b/CHANGES
index ee3ef6e..e59b52d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2625] trafficserver.in doesn't use TS_BASE
+
   *) [TS-2624] Make thread affinity more robust
 
   *) [TS-2620] Make the stats_over_http plugin publish node and plugin stats.



git commit: Adding GNUC check for unused attribute

2014-03-10 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 4611c511c -> 51fd97931


Adding GNUC check for unused attribute


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

Branch: refs/heads/master
Commit: 51fd979313d482d859e76b80274b9e743241d486
Parents: 4611c51
Author: Brian Geffon 
Authored: Mon Mar 10 18:14:42 2014 -0700
Committer: Brian Geffon 
Committed: Mon Mar 10 18:14:42 2014 -0700

--
 lib/atscppapi/src/include/atscppapi/utils.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51fd9793/lib/atscppapi/src/include/atscppapi/utils.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/utils.h 
b/lib/atscppapi/src/include/atscppapi/utils.h
index 035d217..c927f14 100644
--- a/lib/atscppapi/src/include/atscppapi/utils.h
+++ b/lib/atscppapi/src/include/atscppapi/utils.h
@@ -32,9 +32,11 @@
 #include 
 
 #ifndef ATSCPPAPI_UNUSED
+#ifdef __GNUC__
 #define ATSCPPAPI_UNUSED __attribute__ ((unused))
+#else
+#define ATSCPPAPI_UNUSED
 #endif
-
 namespace atscppapi {
 namespace utils {
 



git commit: Adding GNUC check for unused attribute

2014-03-10 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 51fd97931 -> 6ad6e5aa5


Adding GNUC check for unused attribute


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

Branch: refs/heads/master
Commit: 6ad6e5aa56f1bde2d8829505fb59fdbb561ebeac
Parents: 51fd979
Author: Brian Geffon 
Authored: Mon Mar 10 18:15:35 2014 -0700
Committer: Brian Geffon 
Committed: Mon Mar 10 18:15:35 2014 -0700

--
 lib/atscppapi/src/include/atscppapi/utils.h | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6ad6e5aa/lib/atscppapi/src/include/atscppapi/utils.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/utils.h 
b/lib/atscppapi/src/include/atscppapi/utils.h
index c927f14..c0d42bf 100644
--- a/lib/atscppapi/src/include/atscppapi/utils.h
+++ b/lib/atscppapi/src/include/atscppapi/utils.h
@@ -37,6 +37,8 @@
 #else
 #define ATSCPPAPI_UNUSED
 #endif
+#endif
+
 namespace atscppapi {
 namespace utils {
 



[1/2] git commit: Locking fix in atscppapi transformation code

2014-03-11 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 2b35ff4b2 -> 47a53bec1


Locking fix in atscppapi transformation code


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

Branch: refs/heads/master
Commit: 8176151bf70bbcd480b3f6c0f37f774222fafd16
Parents: 6ad6e5a
Author: Brian Geffon 
Authored: Tue Mar 11 11:04:45 2014 -0700
Committer: Brian Geffon 
Committed: Tue Mar 11 11:04:45 2014 -0700

--
 lib/atscppapi/src/TransformationPlugin.cc| 27 ++-
 lib/atscppapi/src/include/atscppapi/Logger.h | 11 +
 2 files changed, 27 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8176151b/lib/atscppapi/src/TransformationPlugin.cc
--
diff --git a/lib/atscppapi/src/TransformationPlugin.cc 
b/lib/atscppapi/src/TransformationPlugin.cc
index f859bb3..a3a8691 100644
--- a/lib/atscppapi/src/TransformationPlugin.cc
+++ b/lib/atscppapi/src/TransformationPlugin.cc
@@ -131,7 +131,8 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
 /* Now call the client to tell them about data */
 if (in_data.length() > 0) {
-   state->transformation_plugin_.consume(in_data);
+  ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
+  state->transformation_plugin_.consume(in_data);
 }
   }
 
@@ -154,11 +155,12 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
 /* Call back the write VIO continuation to let it know that we have 
completed the write operation. */
 if (!state->input_complete_dispatched_) {
- state->transformation_plugin_.handleInputComplete();
- state->input_complete_dispatched_ = true;
- if (vio_cont) {
-   TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
- }
+  ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
+  state->transformation_plugin_.handleInputComplete();
+  state->input_complete_dispatched_ = true;
+  if (vio_cont) {
+TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+  }
 }
   }
 } else {
@@ -167,11 +169,12 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
   /* Call back the write VIO continuation to let it know that we have 
completed the write operation. */
   if (!state->input_complete_dispatched_) {
-   state->transformation_plugin_.handleInputComplete();
-   state->input_complete_dispatched_ = true;
-   if (vio_cont) {
- TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
-   }
+ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
+state->transformation_plugin_.handleInputComplete();
+state->input_complete_dispatched_ = true;
+if (vio_cont) {
+  TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+}
   }
 }
   } else {
@@ -233,6 +236,7 @@ TransformationPlugin::~TransformationPlugin() {
 }
 
 size_t TransformationPlugin::produce(const std::string &data) {
+  ScopedSharedMutexLock scopedLock(state_->transformation_plugin_.getMutex());
   LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p producing output with 
length=%ld", this, state_->txn_, data.length());
   int64_t write_length = static_cast(data.length());
   if (!write_length) {
@@ -282,6 +286,7 @@ size_t TransformationPlugin::produce(const std::string 
&data) {
 }
 
 size_t TransformationPlugin::setOutputComplete() {
+  ScopedSharedMutexLock scopedLock(state_->transformation_plugin_.getMutex());
   int connection_closed = TSVConnClosedGet(state_->vconn_);
   LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p 
connection_closed=%d, total bytes written=%" PRId64, this, state_->txn_, 
state_->vconn_, connection_closed,state_->bytes_written_);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8176151b/lib/atscppapi/src/include/atscppapi/Logger.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/Logger.h 
b/lib/atscppapi/src/include/atscppapi/Logger.h
index f5227d0..3227b63 100644
--- a/lib/atscppapi/src/include/atscppapi/Logger.h
+++ b/lib/atscppapi/src/include/atscppapi/Logger.h
@@ -125,6 +125,17 @@ extern "C" void TSError(const char *fmt, ...) 
ATSCPPAPI_PRINTFLIKE(1,2);
 TSError("[%s] [

[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2014-03-11 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: 47a53bec100da61c0308a78c35d90e9fbac7f7a9
Parents: 8176151 2b35ff4
Author: Brian Geffon 
Authored: Tue Mar 11 11:05:16 2014 -0700
Committer: Brian Geffon 
Committed: Tue Mar 11 11:05:16 2014 -0700

--
 ci/tsqa/test-log-configuration | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)
--




git commit: This closes #60

2014-03-11 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 07720dc20 -> e9a6033a2


This closes #60


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

Branch: refs/heads/master
Commit: e9a6033a286998e66b7785c40b9d2c4e7067b209
Parents: 07720dc
Author: Brian Geffon 
Authored: Tue Mar 11 13:09:15 2014 -0700
Committer: Brian Geffon 
Committed: Tue Mar 11 13:09:15 2014 -0700

--
 lib/atscppapi/Makefile.am | 1 -
 1 file changed, 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e9a6033a/lib/atscppapi/Makefile.am
--
diff --git a/lib/atscppapi/Makefile.am b/lib/atscppapi/Makefile.am
index 659252c..2e1ba77 100644
--- a/lib/atscppapi/Makefile.am
+++ b/lib/atscppapi/Makefile.am
@@ -14,5 +14,4 @@
 #  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.
-
 SUBDIRS = src examples



git commit: Revert 'atscppapi: Locking fix in xform and utility macro' This closes #61

2014-03-12 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 628dad955 -> 64ff6709f


Revert 'atscppapi: Locking fix in xform and utility macro' This closes #61


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

Branch: refs/heads/master
Commit: 64ff6709f8baf7769d150bfad98873e52b0594ff
Parents: 628dad9
Author: Brian Geffon 
Authored: Wed Mar 12 11:08:02 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 11:08:02 2014 -0700

--
 lib/atscppapi/src/TransformationPlugin.cc| 27 +--
 lib/atscppapi/src/include/atscppapi/Logger.h | 11 -
 2 files changed, 11 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/64ff6709/lib/atscppapi/src/TransformationPlugin.cc
--
diff --git a/lib/atscppapi/src/TransformationPlugin.cc 
b/lib/atscppapi/src/TransformationPlugin.cc
index a3a8691..f859bb3 100644
--- a/lib/atscppapi/src/TransformationPlugin.cc
+++ b/lib/atscppapi/src/TransformationPlugin.cc
@@ -131,8 +131,7 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
 /* Now call the client to tell them about data */
 if (in_data.length() > 0) {
-  ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
-  state->transformation_plugin_.consume(in_data);
+   state->transformation_plugin_.consume(in_data);
 }
   }
 
@@ -155,12 +154,11 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
 /* Call back the write VIO continuation to let it know that we have 
completed the write operation. */
 if (!state->input_complete_dispatched_) {
-  ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
-  state->transformation_plugin_.handleInputComplete();
-  state->input_complete_dispatched_ = true;
-  if (vio_cont) {
-TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
-  }
+ state->transformation_plugin_.handleInputComplete();
+ state->input_complete_dispatched_ = true;
+ if (vio_cont) {
+   TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+ }
 }
   }
 } else {
@@ -169,12 +167,11 @@ int handleTransformationPluginRead(TSCont contp, 
TransformationPluginState *stat
 
   /* Call back the write VIO continuation to let it know that we have 
completed the write operation. */
   if (!state->input_complete_dispatched_) {
-ScopedSharedMutexLock 
scopedLock(state->transformation_plugin_.getMutex());
-state->transformation_plugin_.handleInputComplete();
-state->input_complete_dispatched_ = true;
-if (vio_cont) {
-  TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
-}
+   state->transformation_plugin_.handleInputComplete();
+   state->input_complete_dispatched_ = true;
+   if (vio_cont) {
+ TSContCall(vio_cont, 
static_cast(TS_EVENT_VCONN_WRITE_COMPLETE), write_vio);
+   }
   }
 }
   } else {
@@ -236,7 +233,6 @@ TransformationPlugin::~TransformationPlugin() {
 }
 
 size_t TransformationPlugin::produce(const std::string &data) {
-  ScopedSharedMutexLock scopedLock(state_->transformation_plugin_.getMutex());
   LOG_DEBUG("TransformationPlugin=%p tshttptxn=%p producing output with 
length=%ld", this, state_->txn_, data.length());
   int64_t write_length = static_cast(data.length());
   if (!write_length) {
@@ -286,7 +282,6 @@ size_t TransformationPlugin::produce(const std::string 
&data) {
 }
 
 size_t TransformationPlugin::setOutputComplete() {
-  ScopedSharedMutexLock scopedLock(state_->transformation_plugin_.getMutex());
   int connection_closed = TSVConnClosedGet(state_->vconn_);
   LOG_DEBUG("OutputComplete TransformationPlugin=%p tshttptxn=%p vconn=%p 
connection_closed=%d, total bytes written=%" PRId64, this, state_->txn_, 
state_->vconn_, connection_closed,state_->bytes_written_);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/64ff6709/lib/atscppapi/src/include/atscppapi/Logger.h
--
diff --git a/lib/atscppapi/src/include/atscppapi/Logger.h 
b/lib/atscppapi/src/include/atscppapi/Logger.h
index 3227b63..f5227d0 100644
--- a/lib/atscppapi/src/include/atscppapi/Logger.h
+++ b/lib/atscppapi/src/include/atscppapi/Logger.h
@@ -125,17 +125,6 @@ extern "C" void TSError(const char *fmt, ...) 
ATSCPPAPI_PRINTFL

[5/5] git commit: [TS-2631] Header_rewrite add SkipRemap operator

2014-03-12 Thread briang
[TS-2631] Header_rewrite add SkipRemap operator


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

Branch: refs/heads/master
Commit: 5701441b6d329d652f557091fe5996df978faaa1
Parents: 9f7afd8
Author: Brian Geffon 
Authored: Wed Mar 12 14:58:20 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 14:58:20 2014 -0700

--
 plugins/header_rewrite/factory.cc   |  2 ++
 plugins/header_rewrite/operators.cc | 18 ++
 plugins/header_rewrite/operators.h  | 19 +++
 3 files changed, 39 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/factory.cc
--
diff --git a/plugins/header_rewrite/factory.cc 
b/plugins/header_rewrite/factory.cc
index 208d42a..66087fc 100644
--- a/plugins/header_rewrite/factory.cc
+++ b/plugins/header_rewrite/factory.cc
@@ -51,6 +51,8 @@ operator_factory(const std::string& op)
 o = new OperatorSetRedirect();
   } else if (op == "timeout-out") {
 o = new OperatorSetTimeoutOut();
+  } else if (op == "skip-remap") {
+o = new OperatorSkipRemap();
   } else if (op == "no-op") {
 o = new OperatorNoOp();
   } else if (op == "counter") {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 086a316..6d062dd 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -364,6 +364,24 @@ OperatorSetTimeoutOut::exec(const Resources& res) const
   }
 }
 
+// OperatorSkipRemap
+void
+OperatorSkipRemap::initialize(Parser& p)
+{
+  Operator::initialize(p);
+
+  if (p.get_arg() == "1" || p.get_arg() == "true") {
+_skip_remap = true;
+  }
+}
+
+void
+OperatorSkipRemap::exec(const Resources& res) const
+{
+  TSDebug(PLUGIN_NAME, "OperatorSkipRemap::exec() skipping remap: %s", 
_skip_remap ? "True" : "False");
+  TSSkipRemappingSet(res.txnp, _skip_remap ? 1 : 0);
+}
+
 
 // OperatorRMHeader
 void

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5701441b/plugins/header_rewrite/operators.h
--
diff --git a/plugins/header_rewrite/operators.h 
b/plugins/header_rewrite/operators.h
index 6ab67ff..57d6608 100644
--- a/plugins/header_rewrite/operators.h
+++ b/plugins/header_rewrite/operators.h
@@ -185,6 +185,25 @@ private:
   Value _timeout;
 };
 
+class OperatorSkipRemap : public Operator
+{
+public:
+  OperatorSkipRemap()
+: _skip_remap(false)
+  {
+TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for OperatorSkipRemap");
+  }
+  void initialize(Parser& p);
+
+protected:
+  void exec(const Resources& res) const;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(OperatorSkipRemap);
+
+  bool _skip_remap;
+};
+
 
 // All the header operators share a base class
 class OperatorRMHeader : public OperatorHeaders



[1/5] git commit: [TS-2631] header_rewrite to support new destinations in global plugin case

2014-03-12 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 64ff6709f -> 5701441b6


[TS-2631] header_rewrite to support new destinations in global plugin case


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

Branch: refs/heads/master
Commit: 50a583f7e4ef467b6c7f7af3fa6bb25ba4b0dfee
Parents: 64ff670
Author: Brian Geffon 
Authored: Wed Mar 12 14:13:21 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 14:13:21 2014 -0700

--
 plugins/header_rewrite/operators.cc | 42 +---
 1 file changed, 28 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/50a583f7/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 3b2cd27..086a316 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -144,7 +144,6 @@ OperatorSetStatusReason::exec(const Resources& res) const
 }
 
 
-/// TODO and XXX: These currently only support when running as remap plugin.
 // OperatorSetDestination
 void
 OperatorSetDestination::initialize(Parser& p)
@@ -153,16 +152,31 @@ OperatorSetDestination::initialize(Parser& p)
 
   _url_qual = parse_url_qualifier(p.get_arg());
   _value.set_value(p.get_value());
-  // TODO: What resources would we require here?
+  require_resources(RSRC_CLIENT_REQUEST_HEADERS);
+  require_resources(RSRC_SERVER_REQUEST_HEADERS);
 }
 
 
 void
 OperatorSetDestination::exec(const Resources& res) const
 {
-  if (res._rri) {
+  if (res._rri || (res.bufp && res.hdr_loc)) {
 std::string value;
 
+// Determine which TSMBuffer and TSMLoc to use
+TSMBuffer bufp;
+TSMLoc url_m_loc;
+if (res._rri) {
+  bufp = res._rri->requestBufp;
+  url_m_loc = res._rri->requestUrl;
+} else {
+  bufp = res.bufp;
+  if (TSHttpHdrUrlGet(res.bufp, res.hdr_loc, &url_m_loc) != TS_SUCCESS) {
+TSDebug(PLUGIN_NAME, "TSHttpHdrUrlGet was unable to return the url 
m_loc");
+return;
+  }
+}
+
 // Never set an empty destination value (I don't think that ever makes 
sense?)
 switch (_url_qual) {
 
@@ -172,8 +186,8 @@ OperatorSetDestination::exec(const Resources& res) const
 TSDebug(PLUGIN_NAME, "Would set destination HOST to an empty value, 
skipping");
   } else {
 const_cast(res).changed_url = true;
-TSUrlHostSet(res._rri->requestBufp, res._rri->requestUrl, 
value.c_str(), value.size());
-TSDebug(PLUGIN_NAME, "OperatorSetHost::exec() invoked with HOST: %s", 
value.c_str());
+TSUrlHostSet(bufp, url_m_loc, value.c_str(), value.size());
+TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() invoked with 
HOST: %s", value.c_str());
   }
   break;
 
@@ -183,8 +197,8 @@ OperatorSetDestination::exec(const Resources& res) const
 TSDebug(PLUGIN_NAME, "Would set destination PATH to an empty value, 
skipping");
   } else {
 const_cast(res).changed_url = true;
-TSUrlPathSet(res._rri->requestBufp, res._rri->requestUrl, 
value.c_str(), value.size());
-TSDebug(PLUGIN_NAME, "OperatorSetHost::exec() invoked with PATH: %s", 
value.c_str());
+TSUrlPathSet(bufp, url_m_loc, value.c_str(), value.size());
+TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() invoked with 
PATH: %s", value.c_str());
   }
   break;
 
@@ -196,7 +210,7 @@ OperatorSetDestination::exec(const Resources& res) const
 //1.6.4--Support for preserving QSA in case of set-destination
 if (get_oper_modifiers() & OPER_QSA) {
   int query_len = 0;
-  const char* query = TSUrlHttpQueryGet(res._rri->requestBufp, 
res._rri->requestUrl, &query_len);
+  const char* query = TSUrlHttpQueryGet(bufp, url_m_loc, &query_len);
   TSDebug(PLUGIN_NAME, "QSA mode, append original query string: %.*s", 
query_len, query);
   //std::string connector = (value.find("?") == std::string::npos)? 
"?" : "&";
   value.append("&");
@@ -204,18 +218,18 @@ OperatorSetDestination::exec(const Resources& res) const
 }
 
 const_cast(res).changed_url = true;
-TSUrlHttpQuerySet(res._rri->requestBufp, res._rri->requestUrl, 
value.c_str(), value.size());
-TSDebug(PLUGIN_NAME, "OperatorSetHost::exec() invoked with QUERY: %s", 
value.c_str());
+TSUrlHttpQuerySet(bufp, url_m_loc, value.c_str(), value.size());
+TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() invoked with 
QUERY: %s", value.c_str());
   }
   break;
 

[3/5] git commit: [TS-2631] header_rewrite to support new destinations in global plugin case

2014-03-12 Thread briang
[TS-2631] header_rewrite to support new destinations in global plugin case


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

Branch: refs/heads/master
Commit: cca8867973ae68ee51332eb9c19aebea0f4779d2
Parents: fa62240
Author: Brian Geffon 
Authored: Wed Mar 12 14:19:37 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 14:19:37 2014 -0700

--
 plugins/header_rewrite/operators.cc | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/cca88679/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 086a316..c1621ef 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -167,9 +167,11 @@ OperatorSetDestination::exec(const Resources& res) const
 TSMBuffer bufp;
 TSMLoc url_m_loc;
 if (res._rri) {
+  TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() using remap plugin 
TSMBuffer.");
   bufp = res._rri->requestBufp;
   url_m_loc = res._rri->requestUrl;
 } else {
+  TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() using global plugin 
TSMBuffer.");
   bufp = res.bufp;
   if (TSHttpHdrUrlGet(res.bufp, res.hdr_loc, &url_m_loc) != TS_SUCCESS) {
 TSDebug(PLUGIN_NAME, "TSHttpHdrUrlGet was unable to return the url 
m_loc");



[2/5] git commit: [TS-2631] header_rewrite to support new destinations in global plugin case

2014-03-12 Thread briang
[TS-2631] header_rewrite to support new destinations in global plugin case


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

Branch: refs/heads/master
Commit: fa6224047720655882123f304d476868fba95425
Parents: 50a583f
Author: Brian Geffon 
Authored: Wed Mar 12 14:13:46 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 14:13:46 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fa622404/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 05dcfc2..cbc208a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
+  *) [TS-2631] Header_rewrite should support changing destination in non-remap 
case.
 
   *) [TS-2623] Remove the limit on the number of cachurl regular expressions.
 



[4/5] git commit: [TS-2631] header_rewrite to support new destinations in global plugin case

2014-03-12 Thread briang
[TS-2631] header_rewrite to support new destinations in global plugin case


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

Branch: refs/heads/master
Commit: 9f7afd8c952121a53762ad966ff207cc27d055b9
Parents: cca8867
Author: Brian Geffon 
Authored: Wed Mar 12 14:19:44 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 14:19:44 2014 -0700

--
 plugins/header_rewrite/operators.cc | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f7afd8c/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index c1621ef..086a316 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -167,11 +167,9 @@ OperatorSetDestination::exec(const Resources& res) const
 TSMBuffer bufp;
 TSMLoc url_m_loc;
 if (res._rri) {
-  TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() using remap plugin 
TSMBuffer.");
   bufp = res._rri->requestBufp;
   url_m_loc = res._rri->requestUrl;
 } else {
-  TSDebug(PLUGIN_NAME, "OperatorSetDestination::exec() using global plugin 
TSMBuffer.");
   bufp = res.bufp;
   if (TSHttpHdrUrlGet(res.bufp, res.hdr_loc, &url_m_loc) != TS_SUCCESS) {
 TSDebug(PLUGIN_NAME, "TSHttpHdrUrlGet was unable to return the url 
m_loc");



[1/4] git commit: [TS-2631] Improve HeaderRewrite set-destination: using Condition operator instead of hard coded strings

2014-03-12 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 09844ea4a -> b17ef34cb


[TS-2631] Improve HeaderRewrite set-destination: using Condition operator 
instead of hard coded strings


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

Branch: refs/heads/master
Commit: 0f6e5c99cc6a3d1dc2cc2131b4e8b27f0ad8b381
Parents: 5701441
Author: Brian Geffon 
Authored: Wed Mar 12 15:30:09 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 15:30:09 2014 -0700

--
 plugins/header_rewrite/operators.cc | 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0f6e5c99/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 6d062dd..4bdcdc1 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -370,9 +370,6 @@ OperatorSkipRemap::initialize(Parser& p)
 {
   Operator::initialize(p);
 
-  if (p.get_arg() == "1" || p.get_arg() == "true") {
-_skip_remap = true;
-  }
 }
 
 void



[4/4] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver

2014-03-12 Thread briang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/trafficserver


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

Branch: refs/heads/master
Commit: b17ef34cbcc1f0147642a5f5bb7e84f14c430b39
Parents: 864c0ca 09844ea
Author: Brian Geffon 
Authored: Wed Mar 12 16:05:04 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 16:05:04 2014 -0700

--
 proxy/FetchSM.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--




[3/4] git commit: [TS-2631] Improve HeaderRewrite set-destination

2014-03-12 Thread briang
[TS-2631] Improve HeaderRewrite set-destination


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

Branch: refs/heads/master
Commit: 864c0ca784947df54fa2a8bdc58b006c1e1cc818
Parents: f9b6c35
Author: Brian Geffon 
Authored: Wed Mar 12 16:04:52 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 16:04:52 2014 -0700

--
 plugins/header_rewrite/operators.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/864c0ca7/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 6d062dd..7b3beb5 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -370,7 +370,7 @@ OperatorSkipRemap::initialize(Parser& p)
 {
   Operator::initialize(p);
 
-  if (p.get_arg() == "1" || p.get_arg() == "true") {
+  if (p.get_arg() == "1" || p.get_arg() == "true" || p.get_arg() == "TRUE") {
 _skip_remap = true;
   }
 }



[2/4] git commit: Revert "[TS-2631] Improve HeaderRewrite set-destination: using Condition operator instead of hard coded strings"

2014-03-12 Thread briang
Revert "[TS-2631] Improve HeaderRewrite set-destination: using Condition 
operator instead of hard coded strings"

This reverts commit 0f6e5c99cc6a3d1dc2cc2131b4e8b27f0ad8b381.


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

Branch: refs/heads/master
Commit: f9b6c350186780b3271d35794a3cbec570c9f4fe
Parents: 0f6e5c9
Author: Brian Geffon 
Authored: Wed Mar 12 15:55:59 2014 -0700
Committer: Brian Geffon 
Committed: Wed Mar 12 15:55:59 2014 -0700

--
 plugins/header_rewrite/operators.cc | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f9b6c350/plugins/header_rewrite/operators.cc
--
diff --git a/plugins/header_rewrite/operators.cc 
b/plugins/header_rewrite/operators.cc
index 4bdcdc1..6d062dd 100644
--- a/plugins/header_rewrite/operators.cc
+++ b/plugins/header_rewrite/operators.cc
@@ -370,6 +370,9 @@ OperatorSkipRemap::initialize(Parser& p)
 {
   Operator::initialize(p);
 
+  if (p.get_arg() == "1" || p.get_arg() == "true") {
+_skip_remap = true;
+  }
 }
 
 void



  1   2   3   4   5   >