You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ki...@apache.org on 2015/08/20 11:33:10 UTC

trafficserver git commit: TS-3856: documentation for added api for ts_lua

Repository: trafficserver
Updated Branches:
  refs/heads/master 4cfbfdfcf -> 7d8c13ec1


TS-3856: documentation for added api for ts_lua


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

Branch: refs/heads/master
Commit: 7d8c13ec1fb4b75d8b5e9e5fbae4a6a9686a3897
Parents: 4cfbfdf
Author: Kit Chan <ki...@apache.org>
Authored: Thu Aug 20 02:33:00 2015 -0700
Committer: Kit Chan <ki...@apache.org>
Committed: Thu Aug 20 02:33:00 2015 -0700

----------------------------------------------------------------------
 doc/reference/plugins/ts_lua.en.rst | 172 ++++++++++++++++++++++++++++++-
 1 file changed, 170 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d8c13ec/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 30bce3b..c9a46f4 100644
--- a/doc/reference/plugins/ts_lua.en.rst
+++ b/doc/reference/plugins/ts_lua.en.rst
@@ -180,6 +180,116 @@ These constants are usually used as return value of do_remap function.
 
 `TOP <#ts-lua-plugin>`_
 
+ts.remap.get_to_url_host
+------------------------
+**syntax:** *ts.remap.get_to_url_host()*
+
+**context:** do_remap
+
+**description**: retrieve the "to" host of the remap rule
+
+Here is an example:
+
+::
+
+    function do_remap()
+        local to_host = ts.remap.get_to_url_host()
+        ts.debug(to_host)
+        return 0
+    end
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_to_url_port
+------------------------
+**syntax:** *ts.remap.get_to_url_port()*
+
+**context:** do_remap
+
+**description**: retrieve the "to" port of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_to_url_scheme
+--------------------------
+**syntax:** *ts.remap.get_to_url_scheme()*
+
+**context:** do_remap
+
+**description**: retrieve the "to" scheme of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_to_uri
+-------------------
+**syntax:** *ts.remap.get_to_uri()*
+
+**context:** do_remap
+
+**description**: retrieve the "to" path of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_to_url
+-------------------
+**syntax:** *ts.remap.get_to_url()*
+
+**context:** do_remap
+
+**description**: retrieve the "to" url of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_from_url_host
+--------------------------
+**syntax:** *ts.remap.get_from_url_host()*
+
+**context:** do_remap
+
+**description**: retrieve the "from" host of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_from_url_port
+--------------------------
+**syntax:** *ts.remap.get_from_url_port()*
+
+**context:** do_remap
+
+**description**: retrieve the "from" port of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_from_url_scheme
+----------------------------
+**syntax:** *ts.remap.get_from_url_scheme()*
+
+**context:** do_remap
+
+**description**: retrieve the "from" scheme of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_from_uri
+---------------------
+**syntax:** *ts.remap.get_from_uri()*
+
+**context:** do_remap
+
+**description**: retrieve the "from" path of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
+ts.remap.get_from_url
+---------------------
+**syntax:** *ts.remap.get_from_url()*
+
+**context:** do_remap
+
+**description**: retrieve the "from" url of the remap rule
+
+`TOP <#ts-lua-plugin>`_
+
 ts.hook
 -------
 **syntax:** *ts.hook(HOOK_POINT, FUNCTION)*
@@ -670,6 +780,41 @@ Here is an example:
 
 `TOP <#ts-lua-plugin>`_
 
+ts.http.get_cache_lookup_url
+---------------------
+**syntax:** *ts.http.get_cache_lookup_url()*
+
+**context:** do_global_cache_lookup_complete
+
+**description:** This function can be used to get the cache lookup url for the client request.
+
+Here is an example
+
+::
+
+    function cache_lookup()
+        ts.http.set_cache_lookup_url('http://bad.com/bad.html')
+        local cache = ts.http.get_cache_lookup_url()
+        ts.debug(cache)
+    end 
+
+    function do_remap()
+        ts.hook(TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE, cache_lookup)
+        return 0
+    end
+
+`TOP <#ts-lua-plugin>`_
+
+ts.http.set_cache_lookup_url
+---------------------
+**syntax:** *ts.http.set_cache_lookup_url()*
+
+**context:** do_global_cache_lookup_complete
+
+**description:** This function can be used to set the cache lookup url for the client request.
+
+`TOP <#ts-lua-plugin>`_
+
 ts.http.set_server_resp_no_store
 --------------------------------
 **syntax:** *ts.http.set_server_resp_no_store(status)*
@@ -1641,6 +1786,8 @@ Here is an example:
 
 This function is usually called in do_global_read_request function
 
+`TOP <#ts-lua-plugin>`_
+
 ts.http.is_internal_request
 ---------------------------
 **syntax:** *ts.http.is_internal_request()*
@@ -1659,6 +1806,28 @@ Here is an example:
         return 0
     end
 
+`TOP <#ts-lua-plugin>`_
+
+ts.http.transaction_count
+-------------------------
+**syntax:** *ts.http.transaction_count()*
+
+**context:** do_remap or do_global_* or later
+
+**description:** This function returns the number of transaction in this connection
+
+Here is an example
+
+::
+
+    function do_remap()
+        local count = ts.http.transaction_count()
+        ts.debug(tostring(count))
+        return 0
+    end
+
+`TOP <#ts-lua-plugin>`_
+
 ts.add_package_path
 -------------------
 **syntax:** *ts.add_package_path(lua-style-path-str)*
@@ -1682,7 +1851,6 @@ Here is an example:
 
 `TOP <#ts-lua-plugin>`_
 
-
 ts.add_package_cpath
 --------------------
 **syntax:** *ts.add_package_cpath(lua-style-cpath-str)*
@@ -2381,7 +2549,7 @@ Here is an example:
 ::
 
     function do_remap()
-        ts.http.client_packet_mark_set(TS_LUA_TIMEOUT_DNS, 0)
+        ts.http.client_packet_mark_set(0)
         return 0
     end