You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/06/12 04:04:08 UTC

[1/2] trafficserver git commit: TS-3555 Add a new API TSHttpTxnCacheLookupUrlSet()

Repository: trafficserver
Updated Branches:
  refs/heads/master 95f024619 -> 4a8ce3403


TS-3555 Add a new API TSHttpTxnCacheLookupUrlSet()


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

Branch: refs/heads/master
Commit: 0c3d30e69bf4adc3745beda54276166ea571992b
Parents: 95f0246
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Apr 23 16:23:58 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jun 11 20:01:04 2015 -0600

----------------------------------------------------------------------
 doc/arch/cache/cache-appendix.en.rst            |  6 ++---
 .../api/TSHttpTxnCacheLookupUrlGet.en.rst       | 23 +++++++++++++++++++
 proxy/InkAPI.cc                                 | 24 ++++++++++++++++++++
 proxy/api/ts/ts.h                               |  1 +
 4 files changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0c3d30e6/doc/arch/cache/cache-appendix.en.rst
----------------------------------------------------------------------
diff --git a/doc/arch/cache/cache-appendix.en.rst b/doc/arch/cache/cache-appendix.en.rst
index 54eda3a..8181114 100644
--- a/doc/arch/cache/cache-appendix.en.rst
+++ b/doc/arch/cache/cache-appendix.en.rst
@@ -126,9 +126,9 @@ provides this and so must any substitute. This is entirely the responsibility
 of the plugin; there is no way for the |TS| core to detect such an occurrence.
 
 If :c:func:`TSHttpTxnCacheLookupUrlGet()` is called after new cache url set by
-:c:func:`TSCacheUrlSet()`, it should use a URL location created by
-:c:func:`TSUrlCreate()` as its third input parameter instead of getting
-``url_loc`` from the client request.
+:c:func:`TSHttpTxnCacheLookupUrlSet()` or :c:func:`TSCacheUrlSet()`, it should
+use a URL location created by :c:func:`TSUrlCreate()` as its third input
+parameter instead of getting ``url_loc`` from the client request.
 
 It is a requirement that the string be syntactically a URL but otherwise it is
 completely arbitrary and need not have any path. For instance, if the company

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0c3d30e6/doc/reference/api/TSHttpTxnCacheLookupUrlGet.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSHttpTxnCacheLookupUrlGet.en.rst b/doc/reference/api/TSHttpTxnCacheLookupUrlGet.en.rst
index 70fb52c..6e0c121 100644
--- a/doc/reference/api/TSHttpTxnCacheLookupUrlGet.en.rst
+++ b/doc/reference/api/TSHttpTxnCacheLookupUrlGet.en.rst
@@ -28,3 +28,26 @@ Synopsis
 
 Description
 -----------
+
+Get the current cache key URL, also referred to as the lookup URL. This must
+be stored in a properly allocated URL object, typically created with a
+:c:func:`TSUrlCreate()`.
+
+
+TSHttpTxnCacheLookupUrlSet
+==========================
+
+Synopsis
+--------
+
+`#include <ts/ts.h>`
+
+.. c:function:: TSReturnCode TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc offset)
+
+
+Description
+-----------
+
+Set the current cache key URL, also referred to as the lookup URL. This must
+be stored in a properly allocated URL object, typically created with a
+:c:func:`TSUrlCreate()` or :c:func:`TSUrlClone()`.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0c3d30e6/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 41176ae..53351e4 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -4871,6 +4871,30 @@ TSHttpTxnCacheLookupUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj)
   return TS_ERROR;
 }
 
+TSReturnCode
+TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj)
+{
+  sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+  sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
+  sdk_assert(sdk_sanity_check_url_handle(obj) == TS_SUCCESS);
+
+  HttpSM *sm = (HttpSM *)txnp;
+  URL u, *l_url;
+
+  u.m_heap = ((HdrHeapSDKHandle *)bufp)->m_heap;
+  u.m_url_impl = (URLImpl *)obj;
+  if (!u.valid())
+    return TS_ERROR;
+
+  l_url = sm->t_state.cache_info.lookup_url;
+  if (l_url && l_url->valid()) {
+    l_url->copy(&u);
+    return TS_SUCCESS;
+  }
+
+  return TS_ERROR;
+}
+
 // TS-1996: This API will be removed after v3.4.0 is cut. Do not use it!
 TSReturnCode
 TSHttpTxnNewCacheLookupDo(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc url_loc)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0c3d30e6/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index 2ba589b..a6aa14c 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -2321,6 +2321,7 @@ tsapi int TSHttpCurrentServerConnectionsGet(void);
 tsapi TSReturnCode TSHttpTxnCachedRespModifiableGet(TSHttpTxn txnp, TSMBuffer *bufp, TSMLoc *offset);
 tsapi TSReturnCode TSHttpTxnCacheLookupStatusSet(TSHttpTxn txnp, int cachelookup);
 tsapi TSReturnCode TSHttpTxnCacheLookupUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj);
+tsapi TSReturnCode TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj);
 tsapi TSReturnCode TSHttpTxnPrivateSessionSet(TSHttpTxn txnp, int private_session);
 tsapi int TSHttpTxnBackgroundFillStarted(TSHttpTxn txnp);
 


[2/2] trafficserver git commit: Added TS-3555

Posted by zw...@apache.org.
Added TS-3555


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

Branch: refs/heads/master
Commit: 4a8ce34030487f3c378dac4b9242a97e5ec9d5d0
Parents: 0c3d30e
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jun 11 20:02:09 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jun 11 20:02:09 2015 -0600

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4a8ce340/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3f9901f..f30c1a1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3555] Add a new API TSHttpTxnCacheLookupUrlSet().
+
   *) [TS-3684] Support TSHttpTxnServerRespNoStoreSet in ts_lua plugin.
 
   *) [TS-3466] Remove unused proxy.config.user_name config.