git commit: TS-2555 Add to CHANGES

2014-04-16 Thread kichan
Repository: trafficserver
Updated Branches:
  refs/heads/master 904e1f7c2 - e35029116


TS-2555 Add to CHANGES


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

Branch: refs/heads/master
Commit: e350291161f291ddcd70442edcbf2f916cb232d3
Parents: 904e1f7
Author: Kit Chan kic...@apache.org
Authored: Tue Apr 15 23:02:46 2014 -0700
Committer: Kit Chan kic...@apache.org
Committed: Tue Apr 15 23:02:46 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e3502911/CHANGES
--
diff --git a/CHANGES b/CHANGES
index ebe5161..9f8cf54 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2555] adding global plugin support to ts_lua plugin
+
   *) [TS-2717] header-rewrite set-redirect not working.
Author: Igor Brezac
 



git commit: TS-2555 adding example and documentation

2014-04-16 Thread kichan
Repository: trafficserver
Updated Branches:
  refs/heads/master e35029116 - 01be17ecd


TS-2555 adding example and documentation


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

Branch: refs/heads/master
Commit: 01be17ecd6ec47b493366feb755db9998bb9146e
Parents: e350291
Author: Kit Chan kic...@apache.org
Authored: Wed Apr 16 00:38:25 2014 -0700
Committer: Kit Chan kic...@apache.org
Committed: Wed Apr 16 00:38:25 2014 -0700

--
 doc/reference/plugins/ts_lua.en.rst | 77 +---
 plugins/experimental/ts_lua/example/hdr.lua | 37 --
 .../ts_lua/example/test_global_hdr.lua  | 37 ++
 .../experimental/ts_lua/example/test_hdr.lua| 37 ++
 4 files changed, 125 insertions(+), 63 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/01be17ec/doc/reference/plugins/ts_lua.en.rst
--
diff --git a/doc/reference/plugins/ts_lua.en.rst 
b/doc/reference/plugins/ts_lua.en.rst
index fbf7674..ebcb88c 100644
--- a/doc/reference/plugins/ts_lua.en.rst
+++ b/doc/reference/plugins/ts_lua.en.rst
@@ -23,16 +23,6 @@ ts-lua Plugin
 
 Embed the Power of Lua into TrafficServer.
 
-Status
-==
-
-This module is being tested under our production environment.
-
-Version
-===
-
-ts-lua has not been released yet.
-
 Synopsis
 
 
@@ -242,18 +232,52 @@ Synopsis
 return 0
 end
 
+**test_global_hdr.lua**
+
+::
+
+
+function send_response()
+ts.client_response.header['Rhost'] = ts.ctx['rhost']
+return 0
+end
+
+function do_global_read_request()
+local req_host = ts.client_request.header.Host
+
+if req_host == nil then
+return 0
+end
+
+ts.ctx['rhost'] = string.reverse(req_host)
+
+ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, send_response)
+
+return 0
+end
+
 
 Description
 ===
 
-This module embeds Lua, via the standard Lua 5.1 interpreter, into Apache 
Traffic Server. This module acts as remap plugin of Traffic Server, so we 
should realize **'do_remap'** function in each lua script. We can write this in 
remap.config:::
+This module embeds Lua, into Apache Traffic Server. This module acts as remap 
plugin of Traffic Server. In this case we
+should provide **'do_remap'** function in each lua script. We can write this 
in remap.config:::
+
+ map http://a.tbcdn.cn/ http://inner.tbcdn.cn/ 
@plugin=/usr/lib64/trafficserver/plugins/tslua.so
+@pparam=/etc/trafficserver/script/test_hdr.lua
 
- map http://a.tbcdn.cn/ http://inner.tbcdn.cn/ 
@plugin=/usr/lib64/trafficserver/plugins/tslua.so 
@pparam=/etc/trafficserver/script/test_hdr.lua
+Sometimes we want to receive parameters and process them in the script, we 
should realize **'\__init__'** function in
+the lua script(sethost.lua is a reference), and we can write this in 
remap.config:::
 
-Sometimes we want to receive parameters and process them in the script, we 
should realize **'\__init__'** function in the lua script(sethost.lua is a 
reference), and we can write this in remap.config:::
+ map http://a.tbcdn.cn/ http://inner.tbcdn.cn/ 
@plugin=/usr/lib64/trafficserver/plugins/tslua.so
+@pparam=/etc/trafficserver/script/sethost.lua @pparam=img03.tbcdn.cn
 
- map http://a.tbcdn.cn/ http://inner.tbcdn.cn/ 
@plugin=/usr/lib64/trafficserver/plugins/tslua.so 
@pparam=/etc/trafficserver/script/sethost.lua @pparam=img03.tbcdn.cn
+This module can also act as a global plugin of Traffic Server. In this case we 
should provide one of these functions
+(**'do_global_read_request'**, **'do_global_send_request'**, 
**'do_global_read_response'**,
+**'do_global_send_response'**, **'do_global_cache_lookup_complete'**) in each 
lua script. We can write this in
+plugin.config:::
 
+ tslua.so /etc/trafficserver/script/test_global_hdr.lua
 
 
 TS API for Lua
@@ -262,7 +286,8 @@ TS API for Lua
 Introduction
 
 
-The API is exposed to Lua in the form of one standard packages ts. This 
package is in the default global scope and is always available within lua 
script.
+The API is exposed to Lua in the form of one standard packages ts. This 
package is in the default global scope and is
+always available within lua script.
 
 
 
@@ -306,7 +331,7 @@ ts.hook
 ---
 **syntax**: *ts.hook(HOOK_POINT, FUNCTION)*
 
-**context**: do_remap or later
+**context**: do_remap/do_global_*/later
 
 **description**: Hooks are points in http transaction processing where we can 
step in and do some work.
 FUNCTION will be called when the http transaction steps in to 

Re: git commit: TS-2555 add global plugin support for ts_lua plugin

2014-04-16 Thread James Peach
On Apr 15, 2014, at 10:34 PM, kic...@apache.org wrote:

 Repository: trafficserver
 Updated Branches:
  refs/heads/master 9f509d401 - 904e1f7c2
 
 
 TS-2555 add global plugin support for ts_lua plugin
 
 
 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
 Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/904e1f7c
 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/904e1f7c
 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/904e1f7c
 
 Branch: refs/heads/master
 Commit: 904e1f7c2995dbb4a8afea7cd99e32f0fd844f46
 Parents: 9f509d4
 Author: Kit Chan kic...@apache.org
 Authored: Tue Apr 15 22:30:01 2014 -0700
 Committer: Kit Chan kic...@apache.org
 Committed: Tue Apr 15 22:30:01 2014 -0700
 
 --
 plugins/experimental/ts_lua/ts_lua.c| 155 ++-
 plugins/experimental/ts_lua/ts_lua_common.h |   8 ++
 plugins/experimental/ts_lua/ts_lua_util.c   |   9 ++
 3 files changed, 170 insertions(+), 2 deletions(-)
 --
 
 
 http://git-wip-us.apache.org/repos/asf/trafficserver/blob/904e1f7c/plugins/experimental/ts_lua/ts_lua.c
 --
 diff --git a/plugins/experimental/ts_lua/ts_lua.c 
 b/plugins/experimental/ts_lua/ts_lua.c
 index ca78665..32cb58c 100644
 --- a/plugins/experimental/ts_lua/ts_lua.c
 +++ b/plugins/experimental/ts_lua/ts_lua.c
 @@ -26,9 +26,10 @@
 #define TS_LUA_MAX_STATE_COUNT  2048
 
 static volatile int32_t ts_lua_http_next_id = 0;
 +static volatile int32_t ts_lua_g_http_next_id = 0;
 
 ts_lua_main_ctx *ts_lua_main_ctx_array;
 -
 +ts_lua_main_ctx *ts_lua_g_main_ctx_array;
 
 TSReturnCode
 TSRemapInit(TSRemapInterface *api_info, char * errbuf ATS_UNUSED , int 
 errbuf_size ATS_UNUSED )
 @@ -119,7 +120,7 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo 
 *rri)
 http_ctx-client_request_bufp = rri-requestBufp;
 http_ctx-client_request_hdrp = rri-requestHdrp;
 http_ctx-client_request_url = rri-requestUrl;
 -
 +http_ctx-remap = 1;
 l = http_ctx-lua;
 
 lua_getglobal(l, TS_LUA_FUNCTION_REMAP);
 @@ -146,3 +147,153 @@ TSRemapDoRemap(void* ih, TSHttpTxn rh, 
 TSRemapRequestInfo *rri)
 return ret;
 }
 
 +static int
 +globalHookHandler(TSCont contp, TSEvent event, void *edata) {
 +  TSHttpTxn txnp = (TSHttpTxn) edata;
 +
 +  int ret = 0;
 +  int64_t req_id;
 +
 +  lua_State *l;
 +  TSCont txn_contp;
 +
 +  ts_lua_main_ctx *main_ctx;
 +  ts_lua_http_ctx *http_ctx;
 +
 +  ts_lua_instance_conf *conf = (ts_lua_instance_conf *)TSContDataGet(contp);
 +
 +  req_id = (int64_t) ts_lua_atomic_increment((ts_lua_g_http_next_id), 1);
 +  main_ctx = ts_lua_g_main_ctx_array[req_id%TS_LUA_MAX_STATE_COUNT];

Won't this cause different hook invocations on the same transaction to execute 
in different lua states?

 +
 +  TSMutexLock(main_ctx-mutexp);
 +
 +  http_ctx = ts_lua_create_http_ctx(main_ctx, conf);
 +  http_ctx-txnp = txnp;
 +  http_ctx-remap = 0;
 +
 +  TSMBuffer bufp;
 +  TSMLoc hdr_loc;
 +  TSMLoc url_loc;
 +
 +  if(TSHttpTxnClientReqGet(txnp, bufp, hdr_loc) == TS_SUCCESS) {
 +http_ctx-client_request_bufp = bufp;
 +http_ctx-client_request_hdrp = hdr_loc;
 +if (TSHttpHdrUrlGet(bufp, hdr_loc, url_loc) == TS_SUCCESS) {
 +  http_ctx-client_request_url = url_loc;
 +}
 +  }
 +
 +  if(!http_ctx-client_request_hdrp) {
 +TSMutexUnlock(main_ctx-mutexp);
 +TSHttpTxnReenable(txnp,TS_EVENT_HTTP_CONTINUE);
 +return 0;
 +  }
 + 
 +  l = http_ctx-lua;
 +
 +  switch (event) {
 +  case TS_EVENT_HTTP_READ_REQUEST_HDR:
 +lua_getglobal(l, TS_LUA_FUNCTION_G_READ_REQUEST);
 +break;
 +
 +  case TS_EVENT_HTTP_SEND_REQUEST_HDR:
 +lua_getglobal(l, TS_LUA_FUNCTION_G_SEND_REQUEST);
 +break;
 +
 +  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
 +lua_getglobal(l, TS_LUA_FUNCTION_G_READ_RESPONSE);
 +break;
 +
 +  case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
 +lua_getglobal(l, TS_LUA_FUNCTION_G_SEND_RESPONSE);
 +break;
 +
 +  case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE:
 +lua_getglobal(l, TS_LUA_FUNCTION_G_CACHE_LOOKUP_COMPLETE);
 +break;
 +
 +  default:
 +TSMutexUnlock(main_ctx-mutexp);
 +TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 +return 0;
 +break;
 +  }
 +
 +  if (lua_type(l, -1) != LUA_TFUNCTION) {
 +  TSMutexUnlock(main_ctx-mutexp);
 +  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
 +  return 0;
 +  }
 +
 +  txn_contp = TSContCreate(ts_lua_http_cont_handler, NULL);
 +  TSContDataSet(txn_contp, http_ctx);
 +  http_ctx-main_contp = txn_contp;
 +
 +  if (lua_pcall(l, 0, 1, 0) != 0) {
 +  fprintf(stderr, lua_pcall failed: %s\n, lua_tostring(l, -1));
 +  }
 +
 +  ret = lua_tointeger(l, -1);
 +  lua_pop(l, 1);
 +
 +  TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, txn_contp);
 +
 +  

git commit: Fix some formatting style.

2014-04-16 Thread zwoop
Repository: trafficserver
Updated Branches:
  refs/heads/master 01be17ecd - bf16745fb


Fix some formatting style.


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

Branch: refs/heads/master
Commit: bf16745fb8034acca2b77a6820792093bb993be0
Parents: 01be17e
Author: Leif Hedstrom zw...@apache.org
Authored: Wed Apr 16 10:48:51 2014 -0600
Committer: Leif Hedstrom zw...@apache.org
Committed: Wed Apr 16 10:48:51 2014 -0600

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bf16745f/CHANGES
--
diff --git a/CHANGES b/CHANGES
index 9f8cf54..f578673 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
-  *) [TS-2555] adding global plugin support to ts_lua plugin
+  *) [TS-2555] Adding global plugin support to ts_lua plugin.
 
   *) [TS-2717] header-rewrite set-redirect not working.
Author: Igor Brezac
@@ -187,6 +187,7 @@ Changes with Apache Traffic Server 5.0.0
 
   *) [TS-2494] fix the crash that return the stale cached document
when os is down, even if it`s status is not 200 (ok).
+
   *) [TS-2590] Translate documentation into Japanese.
Authors: Masaori Koshiba masaori...@gmail.com
 Masakazu Kitajo m4s...@gmail.com



[1/2] git commit: TS-2708: refactor and modernize the tcp_info plugin

2014-04-16 Thread jpeach
Repository: trafficserver
Updated Branches:
  refs/heads/master bf16745fb - 86453b993


TS-2708: refactor and modernize the tcp_info plugin

Always build the tcp_info plugin, even if it doesn't end up doing
anything useful on the build platform. This is convenient for
development.

Only sample and log TCP metrics after it passes the sample threshold
to reduce unnecessary work.

Add IPv6 support. Use TS*Assert instead of assert. Remove the Config
global variable. Add a txn_close hook.

Use the text logging API rather than writing custom logs.


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

Branch: refs/heads/master
Commit: d461c33e2050905bce86dc1eba59665ee879754b
Parents: bf16745
Author: James Peach jpe...@apache.org
Authored: Fri Apr 11 13:33:46 2014 -0700
Committer: James Peach jpe...@apache.org
Committed: Wed Apr 16 10:29:03 2014 -0700

--
 CHANGES   |   2 +
 configure.ac  |  10 +-
 plugins/experimental/tcp_info/Makefile.am |   4 -
 plugins/experimental/tcp_info/tcp_info.cc | 268 +++--
 proxy/api/ts/ts.h |   7 +-
 5 files changed, 180 insertions(+), 111 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d461c33e/CHANGES
--
diff --git a/CHANGES b/CHANGES
index f578673..932f614 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2708] Refactor and modernize the tcp_info plugin.
+
   *) [TS-2555] Adding global plugin support to ts_lua plugin.
 
   *) [TS-2717] header-rewrite set-redirect not working.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d461c33e/configure.ac
--
diff --git a/configure.ac b/configure.ac
index ad8c054..2a19d01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1801,11 +1801,13 @@ TS_CHECK_GETHOSTBYNAME_R_STYLE
 TS_CHECK_MACRO_IN6_IS_ADDR_UNSPECIFIED
 
 AC_CHECK_TYPE([struct tcp_info],
-  [enable_tcpinfo_plugin=yes],
-  [enable_tcpinfo_plugin=no],
-  [[#include netinet/tcp.h]]
+  [AC_DEFINE(HAVE_STRUCT_TCP_INFO, 1, [whether struct tcp_info is available])],
+  [],
+  [[
+   #include netinet/in.h
+   #include netinet/tcp.h
+  ]]
 )
-AM_CONDITIONAL([BUILD_TCPINFO_PLUGIN], [ test x${enable_tcpinfo_plugin} != 
xno ])
 
 # See if we can build the remap_stats plugin
 AS_IF([test x$enable_experimental_plugins = xyes],

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d461c33e/plugins/experimental/tcp_info/Makefile.am
--
diff --git a/plugins/experimental/tcp_info/Makefile.am 
b/plugins/experimental/tcp_info/Makefile.am
index 7e6e5f1..daabefd 100644
--- a/plugins/experimental/tcp_info/Makefile.am
+++ b/plugins/experimental/tcp_info/Makefile.am
@@ -16,11 +16,7 @@
 
 include $(top_srcdir)/build/plugins.mk
 
-if BUILD_TCPINFO_PLUGIN
-
 pkglib_LTLIBRARIES = tcp_info.la
 tcp_info_la_SOURCES = tcp_info.cc
 tcp_info_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
-endif
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d461c33e/plugins/experimental/tcp_info/tcp_info.cc
--
diff --git a/plugins/experimental/tcp_info/tcp_info.cc 
b/plugins/experimental/tcp_info/tcp_info.cc
index 7835039..e828ded 100644
--- a/plugins/experimental/tcp_info/tcp_info.cc
+++ b/plugins/experimental/tcp_info/tcp_info.cc
@@ -27,102 +27,176 @@
 #include unistd.h
 #include netinet/in.h
 #include netinet/tcp.h
-#include assert.h
 #include sys/types.h
 #include sys/stat.h
 #include getopt.h
 #include fcntl.h
 #include limits.h
 #include string.h
+#include errno.h
 #include sys/time.h
 #include arpa/inet.h
 
+#include ink_defs.h
+
+#if defined(TCP_INFO)  defined(HAVE_STRUCT_TCP_INFO)
+#define TCPI_PLUGIN_SUPPORTED 1
+#endif
+
 #define TCPI_HOOK_SSN_START 0x01u
 #define TCPI_HOOK_TXN_START 0x02u
 #define TCPI_HOOK_SEND_RESPONSE 0x04u
 #define TCPI_HOOK_SSN_CLOSE 0x08u
+#define TCPI_HOOK_TXN_CLOSE 0x10u
+
+// Log format headers. These are emitted once at the start of a log file. Note 
that we
+// carefully order the fields so the field ordering is compatible. This lets 
you change
+// the verbosity without breaking a perser that is moderately robust.
+static const char * tcpi_headers[] = {
+  timestamp event client server rtt,
+  timestamp event client server rtt rttvar last_sent last_recv 
+

git commit: tcpinfo: fix docutils option formatting issues

2014-04-16 Thread jpeach
Repository: trafficserver
Updated Branches:
  refs/heads/master 50d69f19b - b25b2c28c


tcpinfo: fix docutils option formatting issues


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

Branch: refs/heads/master
Commit: b25b2c28c04d3a4bfdf58045d210ba122669e06b
Parents: 50d69f1
Author: James Peach jpe...@apache.org
Authored: Wed Apr 16 12:38:41 2014 -0700
Committer: James Peach jpe...@apache.org
Committed: Wed Apr 16 12:38:41 2014 -0700

--
 doc/reference/plugins/tcpinfo.en.rst | 44 +--
 1 file changed, 24 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b25b2c28/doc/reference/plugins/tcpinfo.en.rst
--
diff --git a/doc/reference/plugins/tcpinfo.en.rst 
b/doc/reference/plugins/tcpinfo.en.rst
index 688fe45..e2eef53 100644
--- a/doc/reference/plugins/tcpinfo.en.rst
+++ b/doc/reference/plugins/tcpinfo.en.rst
@@ -5,20 +5,20 @@ TCPInfo Plugin
 
 .. 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
+   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.
+   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.
 
 This global plugin logs TCP metrics at various points in the HTTP
 processing pipeline. The TCP information is retrieved by the
@@ -34,7 +34,11 @@ Plugin Options
 
 The following options may be specified in :file:`plugin.config`:
 
---hooks=LIST
+.. NOTE: if the option name is not long enough, docutils will not
+   add the colspan attribute and the options table formatting will
+   be all messed up. Just a trap for young players.
+
+--hooks=NAMELIST
   This option specifies when TCP information should be logged. The
   argument is a comma-separated list of the event names listed
   below. TCP information will be sampled and logged each time the
@@ -43,11 +47,11 @@ The following options may be specified in 
:file:`plugin.config`:
   ==  ===
Event Name Triggered when
   ==  ===
-   send_resp_hdr  The server begins sending an HTTP response.
-   ssn_close  The TCP connection closes.
-   ssn_start  A new TCP connection is accepted.
-   txn_close  A HTTP transaction is completed.
-   txn_start  A HTTP transaction is initiated.
+  send_resp_hdr   The server begins sending an HTTP response.
+  ssn_close   The TCP connection closes.
+  ssn_start   A new TCP connection is accepted.
+  txn_close   A HTTP transaction is completed.
+  txn_start   A HTTP transaction is initiated.
   ==  ===
 
 --log-file=NAME
@@ -105,13 +109,13 @@ The following options may be specified in 
:file:`plugin.config`:
 Examples:
 -
 
-This example logs the simple TCP information to ``jpeach.log``
+This example logs the simple TCP information to ``tcp-metrics.log``
 at the start of a TCP connection and once for each HTTP
 transaction thereafter::
 
-  tcp_info.so --log-file=jpeach --log-level=1 --hooks=ssn_start,txn_start
+  tcp_info.so --log-file=tcp-metrics --log-level=1 --hooks=ssn_start,txn_start
 
-The file ``jpeach.log`` will contain the following log format::
+The file ``tcp-metrics.log`` will contain the following log format::
 
   timestamp event client server rtt
   

git commit: docs: Fix visible hyperlink target on Read the Docs (should only show the link text)

2014-04-16 Thread jpeach
Repository: trafficserver
Updated Branches:
  refs/heads/master b25b2c28c - 9d12a5db7


docs: Fix visible hyperlink target on Read the Docs (should only show the link 
text)

This closes #72


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

Branch: refs/heads/master
Commit: 9d12a5db757e20033a60b92926890abf13453a46
Parents: b25b2c2
Author: Jack Bates j...@nottheoilrig.com
Authored: Tue Apr 15 11:10:59 2014 -0700
Committer: James Peach jpe...@apache.org
Committed: Wed Apr 16 12:43:20 2014 -0700

--
 doc/sdk/actions-guide.en.rst|  4 +-
 doc/sdk/actions-guide/hosts-lookup-api.en.rst   |  4 +-
 doc/sdk/http-headers/http-headers.en.rst| 46 +--
 doc/sdk/http-headers/mime-headers.en.rst| 84 ++--
 doc/sdk/http-headers/urls.en.rst| 56 ++---
 .../adding-hooks.en.rst | 10 +--
 .../http-sessions.en.rst|  4 +-
 .../http-transactions.en.rst| 34 
 .../initiate-http-connection.en.rst |  2 +-
 .../intercepting-http-transactions.en.rst   |  2 +-
 doc/sdk/io-guide.en.rst | 16 ++--
 doc/sdk/io-guide/io-buffers.en.rst  |  2 +-
 doc/sdk/io-guide/transformations.en.rst |  4 +-
 doc/sdk/io-guide/vios.en.rst| 22 ++---
 doc/sdk/misc-interface-guide.en.rst | 10 +--
 .../memory-allocation.en.rst| 10 +--
 .../thread-functions.en.rst |  8 +-
 .../misc-interface-guide/tsfopen-family.en.rst  | 12 +--
 doc/sdk/mutex-guide.en.rst  | 16 ++--
 doc/sdk/plugin-configurations.en.rst|  8 +-
 .../guide-to-the-logging-api.en.rst | 16 ++--
 ...trafficserver-settings-and-statistics.en.rst | 10 +--
 22 files changed, 190 insertions(+), 190 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d12a5db/doc/sdk/actions-guide.en.rst
--
diff --git a/doc/sdk/actions-guide.en.rst b/doc/sdk/actions-guide.en.rst
index f73d12d..ec9a53d 100644
--- a/doc/sdk/actions-guide.en.rst
+++ b/doc/sdk/actions-guide.en.rst
@@ -175,6 +175,6 @@ cancel the action. The following sample code implements 
this:
 
 The action functions are:
 
--  ```TSActionCancel`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a5d49a6addcc9dbdc7f339ee6b73ac0b6`__
--  ```TSActionDone`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#abe189274ad59911f2a57d345d11bfecb`__
+-  :c:func:`TSActionCancel`
+-  :c:func:`TSActionDone`
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d12a5db/doc/sdk/actions-guide/hosts-lookup-api.en.rst
--
diff --git a/doc/sdk/actions-guide/hosts-lookup-api.en.rst 
b/doc/sdk/actions-guide/hosts-lookup-api.en.rst
index 66fc687..d77ee71 100644
--- a/doc/sdk/actions-guide/hosts-lookup-api.en.rst
+++ b/doc/sdk/actions-guide/hosts-lookup-api.en.rst
@@ -23,6 +23,6 @@ lookup of a host name, much like a DNS lookup.
 
 The hosts lookup functions are as follows:
 
--  ```TSHostLookup`` 
http://people.apache.org/~amc/ats/doc/html/InkAPI_8cc.html#ab5bf6eea0ed883e5dc69253965935d12`__
--  ```TSHostLookupResultAddrGet`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#aecac0767192746af1867f528e01d167b`__
+-  :c:func:`TSHostLookup`
+-  :c:func:`TSHostLookupResultAddrGet`
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9d12a5db/doc/sdk/http-headers/http-headers.en.rst
--
diff --git a/doc/sdk/http-headers/http-headers.en.rst 
b/doc/sdk/http-headers/http-headers.en.rst
index 7208840..f74f8a0 100644
--- a/doc/sdk/http-headers/http-headers.en.rst
+++ b/doc/sdk/http-headers/http-headers.en.rst
@@ -159,28 +159,28 @@ known schemes, since this removes the possibility of a 
spelling error.
 
 The **HTTP Header Functions** are listed below:
 
--  ```TSHttpHdrClone`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#abd410a18e8bc73298302c4ff3ee9b0c6`__
--  ```TSHttpHdrCopy`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a5ff26f3836a74e885113423dfd4d9ed6`__
--  ```TSHttpHdrCreate`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a8bbd8c2aaf70fb579af4520053fd5e10`__
--  ```TSHttpHdrDestroy`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a500ac4aae8f369221cf3ac2e3ce0d2a0`__
--  ```TSHttpHdrLengthGet`` 
http://people.apache.org/~amc/ats/doc/html/ts_8h.html#a3afc557e4e99565ab81bf6437b65181b`__
--  

[1/2] git commit: [TS-2720] Fixing bug in C++ API Request Transformations

2014-04-16 Thread briang
Repository: trafficserver
Updated Branches:
  refs/heads/master 9d12a5db7 - 3fb05190f


[TS-2720] Fixing bug in C++ API Request Transformations


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

Branch: refs/heads/master
Commit: a4860363a94e7bb51e5de651c5ea07a804915777
Parents: 76a0777
Author: Brian Geffon bri...@apache.org
Authored: Wed Apr 16 13:13:32 2014 -0700
Committer: Brian Geffon bri...@apache.org
Committed: Wed Apr 16 13:13:32 2014 -0700

--
 CHANGES |  2 ++
 .../NullTransformationPlugin.cc | 21 +++-
 lib/atscppapi/src/TransformationPlugin.cc   | 18 -
 .../include/atscppapi/TransformationPlugin.h|  1 +
 4 files changed, 36 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a4860363/CHANGES
--
diff --git a/CHANGES b/CHANGES
index ebe5161..8cb41d9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
  -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
+  
+  *) [TS-2720] Fix bug with request transformations in C++ api
 
   *) [TS-2717] header-rewrite set-redirect not working.
Author: Igor Brezac

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a4860363/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
--
diff --git 
a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc 
b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
index 0155d30..5312d3b 100644
--- 
a/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
+++ 
b/lib/atscppapi/examples/null_transformation_plugin/NullTransformationPlugin.cc
@@ -32,9 +32,15 @@ namespace {
 
 class NullTransformationPlugin : public TransformationPlugin {
 public:
-  NullTransformationPlugin(Transaction transaction)
-: TransformationPlugin(transaction, RESPONSE_TRANSFORMATION) {
-registerHook(HOOK_SEND_RESPONSE_HEADERS);
+  NullTransformationPlugin(Transaction transaction, 
TransformationPlugin::Type xformType)
+: TransformationPlugin(transaction, xformType) {
+registerHook((xformType == TransformationPlugin::REQUEST_TRANSFORMATION) ? 
+ HOOK_SEND_REQUEST_HEADERS : HOOK_SEND_RESPONSE_HEADERS);
+  }
+
+  void handleSendRequestHeaders(Transaction transaction) {
+transaction.getServerRequest().getHeaders()[X-Content-Transformed] = 1;
+transaction.resume();
   }
 
   void handleSendResponseHeaders(Transaction transaction) {
@@ -60,14 +66,19 @@ private:
 class GlobalHookPlugin : public GlobalPlugin {
 public:
   GlobalHookPlugin() {
+registerHook(HOOK_READ_REQUEST_HEADERS_POST_REMAP);
 registerHook(HOOK_READ_RESPONSE_HEADERS);
   }
 
-  virtual void handleReadResponseHeaders(Transaction transaction) {
-transaction.addPlugin(new NullTransformationPlugin(transaction));
+  virtual void handleReadRequestHeadersPostRemap(Transaction transaction) {
+transaction.addPlugin(new NullTransformationPlugin(transaction, 
TransformationPlugin::REQUEST_TRANSFORMATION));
 transaction.resume();
   }
 
+  virtual void handleReadResponseHeaders(Transaction transaction) {
+transaction.addPlugin(new NullTransformationPlugin(transaction, 
TransformationPlugin::RESPONSE_TRANSFORMATION));
+transaction.resume();
+  }
 };
 
 void TSPluginInit(int argc ATSCPPAPI_UNUSED, const char *argv[] 
ATSCPPAPI_UNUSED) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a4860363/lib/atscppapi/src/TransformationPlugin.cc
--
diff --git a/lib/atscppapi/src/TransformationPlugin.cc 
b/lib/atscppapi/src/TransformationPlugin.cc
index f859bb3..3e5560a 100644
--- a/lib/atscppapi/src/TransformationPlugin.cc
+++ b/lib/atscppapi/src/TransformationPlugin.cc
@@ -56,6 +56,8 @@ struct atscppapi::TransformationPluginState: noncopyable {
   // sent the input end our write complte.
   bool input_complete_dispatched_;
 
+  std::string request_xform_output_; // in case of request xform, data 
produced is buffered here
+
   TransformationPluginState(atscppapi::Transaction transaction, 
TransformationPlugin transformation_plugin,
   TransformationPlugin::Type type, TSHttpTxn txn)
 : vconn_(NULL), transaction_(transaction), 
transformation_plugin_(transformation_plugin), type_(type),
@@ -232,7 +234,7 @@ TransformationPlugin::~TransformationPlugin() {
   delete