trafficserver git commit: TS-4045: improvement on ts_lua plugin. This closes #357

2015-12-01 Thread kichan
Repository: trafficserver
Updated Branches:
  refs/heads/master 076279261 -> 2121859b3


TS-4045: improvement on ts_lua plugin. This closes #357


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

Branch: refs/heads/master
Commit: 2121859b3868e49631f128b7bea993e19eba2cc1
Parents: 0762792
Author: Kit Chan 
Authored: Tue Dec 1 23:37:21 2015 -0800
Committer: Kit Chan 
Committed: Tue Dec 1 23:37:21 2015 -0800

--
 doc/admin-guide/plugins/ts_lua.en.rst   | 20 
 .../ts_lua/ts_lua_cached_response.c |  8 ++--
 .../experimental/ts_lua/ts_lua_client_request.c | 50 ++--
 .../ts_lua/ts_lua_client_response.c | 17 +++
 plugins/experimental/ts_lua/ts_lua_fetch.c  |  4 +-
 plugins/experimental/ts_lua/ts_lua_http.c   | 34 -
 plugins/experimental/ts_lua/ts_lua_http_cntl.c  |  4 +-
 .../experimental/ts_lua/ts_lua_http_config.c| 47 --
 .../experimental/ts_lua/ts_lua_http_intercept.c | 16 ++-
 .../experimental/ts_lua/ts_lua_http_milestone.c |  2 +-
 plugins/experimental/ts_lua/ts_lua_remap.c  | 20 
 .../experimental/ts_lua/ts_lua_server_request.c | 26 +-
 .../ts_lua/ts_lua_server_response.c | 14 +++---
 plugins/experimental/ts_lua/ts_lua_util.h   |  7 +++
 14 files changed, 168 insertions(+), 101 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2121859b/doc/admin-guide/plugins/ts_lua.en.rst
--
diff --git a/doc/admin-guide/plugins/ts_lua.en.rst 
b/doc/admin-guide/plugins/ts_lua.en.rst
index 37d11f2..27b27a8 100644
--- a/doc/admin-guide/plugins/ts_lua.en.rst
+++ b/doc/admin-guide/plugins/ts_lua.en.rst
@@ -2687,6 +2687,26 @@ Here is an example:
 
 `TOP <#ts-lua-plugin>`_
 
+ts.http.set_debug
+-
+**syntax:** *ts.http.set_debug(NUMBER)*
+
+**context:** do_remap or do_global_* or later.
+
+**decription:** This function can be used to enable debug log for the 
transaction
+
+Here is an example:
+
+::
+
+function do_remap()
+ts.http.set_debug(1)
+return 0
+end
+
+
+`TOP <#ts-lua-plugin>`_
+
 ts.http.cntl_get
 
 **syntax:** *val = ts.http.cntl_get(CNTL_TYPE)*

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2121859b/plugins/experimental/ts_lua/ts_lua_cached_response.c
--
diff --git a/plugins/experimental/ts_lua/ts_lua_cached_response.c 
b/plugins/experimental/ts_lua/ts_lua_cached_response.c
index 01be519..2c52e8f 100644
--- a/plugins/experimental/ts_lua/ts_lua_cached_response.c
+++ b/plugins/experimental/ts_lua/ts_lua_cached_response.c
@@ -103,7 +103,7 @@ ts_lua_cached_response_get_status(lua_State *L)
   int status;
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);
+  GET_HTTP_CONTEXT(http_ctx, L);
 
   TS_LUA_CHECK_CACHED_RESPONSE_HDR(http_ctx);
 
@@ -123,7 +123,7 @@ ts_lua_cached_response_get_version(lua_State *L)
 
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);
+  GET_HTTP_CONTEXT(http_ctx, L);
 
   TS_LUA_CHECK_CACHED_RESPONSE_HDR(http_ctx);
 
@@ -150,7 +150,7 @@ ts_lua_cached_response_header_get(lua_State *L)
   TSMLoc field_loc;
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);
+  GET_HTTP_CONTEXT(http_ctx, L);
 
   /*   we skip the first argument that is the table */
   key = luaL_checklstring(L, 2, _len);
@@ -193,7 +193,7 @@ ts_lua_cached_response_get_headers(lua_State *L)
 
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);
+  GET_HTTP_CONTEXT(http_ctx, L);
 
   TS_LUA_CHECK_CACHED_RESPONSE_HDR(http_ctx);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2121859b/plugins/experimental/ts_lua/ts_lua_client_request.c
--
diff --git a/plugins/experimental/ts_lua/ts_lua_client_request.c 
b/plugins/experimental/ts_lua/ts_lua_client_request.c
index 7151971..7a729ab 100644
--- a/plugins/experimental/ts_lua/ts_lua_client_request.c
+++ b/plugins/experimental/ts_lua/ts_lua_client_request.c
@@ -145,7 +145,7 @@ ts_lua_client_request_header_get(lua_State *L)
   TSMLoc field_loc;
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);
+  GET_HTTP_CONTEXT(http_ctx, L);
 
   /*  we skip the first argument that is the table */
   key = luaL_checklstring(L, 2, _len);
@@ -181,7 +181,7 @@ ts_lua_client_request_header_set(lua_State *L)
 
   ts_lua_http_ctx *http_ctx;
 
-  http_ctx = ts_lua_get_http_ctx(L);

trafficserver git commit: TS-3986: Cleanup code related to HTTP/2 frame flags validation

2015-12-01 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master cb8382a64 -> f8621492a


TS-3986: Cleanup code related to HTTP/2 frame flags validation

1. Rename http2_are_frame_flags_valid to http2_frame_flags_are_valid
2. Move list of masks to HTTP2.h from HTTP2.cc

This closes #354


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

Branch: refs/heads/master
Commit: f8621492a725db05f5e5f87998f4f90dc7a59941
Parents: cb8382a
Author: Masaori Koshiba 
Authored: Tue Dec 1 18:51:07 2015 +0900
Committer: Masaori Koshiba 
Committed: Tue Dec 1 18:51:07 2015 +0900

--
 proxy/http2/HTTP2.cc | 14 --
 proxy/http2/HTTP2.h  |  6 ++
 2 files changed, 10 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 195b9e1..a9b0e2b 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -105,27 +105,21 @@ memcpy_and_advance(uint8_t(), byte_pointer )
 }
 
 static bool
-http2_are_frame_flags_valid(uint8_t ftype, uint8_t fflags)
+http2_frame_flags_are_valid(uint8_t ftype, uint8_t fflags)
 {
-  static const uint8_t mask[HTTP2_FRAME_TYPE_MAX] = {
-HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
-HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
-HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
-  };
-
   if (ftype >= HTTP2_FRAME_TYPE_MAX) {
 // Skip validation for Unkown frame type - [RFC 7540] 5.5. Extending HTTP/2
 return true;
   }
 
   // The frame flags are valid for this frame if nothing outside the defined 
bits is set.
-  return (fflags & ~mask[ftype]) == 0;
+  return (fflags & ~HTTP2_FRAME_FLAGS_MASKS[ftype]) == 0;
 }
 
 bool
 http2_frame_header_is_valid(const Http2FrameHeader , unsigned 
max_frame_size)
 {
-  if (!http2_are_frame_flags_valid(hdr.type, hdr.flags)) {
+  if (!http2_frame_flags_are_valid(hdr.type, hdr.flags)) {
 return false;
   }
 
@@ -869,7 +863,7 @@ REGRESSION_TEST(HTTP2_FRAME_FLAGS)(RegressionTest *t, int, 
int *pstatus)
   box = REGRESSION_TEST_PASSED;
 
   for (unsigned int i = 0; i < sizeof(http2_frame_flags_test_case) / 
sizeof(http2_frame_flags_test_case[0]); ++i) {
-
box.check(http2_are_frame_flags_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
+
box.check(http2_frame_flags_are_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
 http2_frame_flags_test_case[i].valid,
   "Validation of frame flags (type: %d, flags: %d) are expected 
%d, but not", http2_frame_flags_test_case[i].ftype,
   http2_frame_flags_test_case[i].fflags, 
http2_frame_flags_test_case[i].valid);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.h
--
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 9120d7c..ba322db 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -201,6 +201,12 @@ enum Http2FrameFlagsContinuation {
   HTTP2_FLAGS_CONTINUATION_MASK = 0x04,
 };
 
+static const uint8_t HTTP2_FRAME_FLAGS_MASKS[HTTP2_FRAME_TYPE_MAX] = {
+  HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
+  HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
+  HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
+};
+
 // [RFC 7540] 6.5.2. Defined SETTINGS Parameters
 enum Http2SettingsIdentifier {
   HTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,



trafficserver git commit: Doc: update comment.

2015-12-01 Thread amc
Repository: trafficserver
Updated Branches:
  refs/heads/master f8621492a -> 076279261


Doc: update comment.


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

Branch: refs/heads/master
Commit: 07627926158059ec8ec52e1e81f9d54cc66d5e18
Parents: f862149
Author: Alan M. Carroll 
Authored: Tue Dec 1 09:56:31 2015 -0600
Committer: Alan M. Carroll 
Committed: Tue Dec 1 09:56:55 2015 -0600

--
 mgmt/api/include/mgmtapi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/07627926/mgmt/api/include/mgmtapi.h
--
diff --git a/mgmt/api/include/mgmtapi.h b/mgmt/api/include/mgmtapi.h
index 6b0553c..0fe51e0 100644
--- a/mgmt/api/include/mgmtapi.h
+++ b/mgmt/api/include/mgmtapi.h
@@ -942,7 +942,7 @@ tsapi TSMgmtError TSActionDo(TSActionNeedT action);
  */
 tsapi TSMgmtError TSBounce(unsigned options);
 
-/* TSStorageDeviceOp: Request an operation on a storage device.
+/* TSStorageDeviceCmdOffline: Request to make a cache storage device offline.
  * @arg dev Target device, specified by path to device.
  * @return Success.
  */