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 2013/03/09 01:48:36 UTC

[34/50] git commit: TS-1058: add TSHttpTxnCloseAfterResponse experimental API

TS-1058: add TSHttpTxnCloseAfterResponse experimental API

Add a new API to force the server end of a HTTP keepalive. This is
useful for a plugin that sets the error body to easuly intercept a
transaction, but needs to ensure that the subsequent request does
not go to a different replica. One example of this use case is a
challenge-response authentication protocol where the challenge data
is held in memory on the session.


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

Branch: refs/heads/3.3.x
Commit: 8facd16fdcb2ec5c5efd66bb8d4c9c2ba24d1231
Parents: 7016ec9
Author: Yakov Kopel <yk...@websense.com>
Authored: Tue Mar 5 10:36:52 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Mar 5 10:40:59 2013 -0800

----------------------------------------------------------------------
 CHANGES                     |    6 +++++-
 proxy/InkAPI.cc             |   20 ++++++++++++++++++++
 proxy/api/ts/experimental.h |    1 +
 3 files changed, 26 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8facd16f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 8cada05..d4fb0bc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.1
 
+
+  *) [TS-1058] add TSHttpTxnCloseAfterResponse experimental API
+   Author: Yakov Kopel <yk...@websense.com>
+
   *) [TS-1733] Retool tsxs so that it can compile multiple source files
    Author: Dale Ghent <da...@omniti.com>
 
@@ -10,7 +14,7 @@ Changes with Apache Traffic Server 3.3.1
   *) [TS-1739] Fix TODO within varFloatFromName()
    Author: Yunkai Zhang <qi...@taobao.com>
 
-  *) [TS-1559] Server side termination not handled properly when a PluginVC 
+  *) [TS-1559] Server side termination not handled properly when a PluginVC
    Protocol Plugin is used. Author: Yossi Gottlieb.
 
   *) [TS-1300] Document the usage of TSUrlStringGet() and derivatives.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8facd16f/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index f46ade6..661a2d0 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -8125,6 +8125,26 @@ TSMgmtIntCreate(TSRecordType rec_type, const char *name, TSMgmtInt data_default,
   return TS_SUCCESS;
 }
 
+TSReturnCode
+TSHttpTxnCloseAfterResponse (TSHttpTxn txnp, int should_close)
+{
+    if (sdk_sanity_check_txn(txnp)!=TS_SUCCESS) {
+           return TS_ERROR;
+    }
+
+    HttpSM *sm = (HttpSM*)txnp;
+    if (should_close) {
+        sm->t_state.client_info.keep_alive = HTTP_NO_KEEPALIVE;
+        if (sm->ua_session) sm->set_ua_half_close_flag();
+    }
+    // Don't change if PIPELINE is set...
+    else if (sm->t_state.client_info.keep_alive == HTTP_NO_KEEPALIVE) {
+        sm->t_state.client_info.keep_alive = HTTP_KEEPALIVE;
+    }
+
+    return TS_SUCCESS;
+}
+
 // Parse a port descriptor for the proxy.config.http.server_ports descriptor format.
 TSPortDescriptor
 TSPortDescriptorParse(const char * descriptor)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8facd16f/proxy/api/ts/experimental.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/experimental.h b/proxy/api/ts/experimental.h
index a96ed19..2ca5d68 100644
--- a/proxy/api/ts/experimental.h
+++ b/proxy/api/ts/experimental.h
@@ -184,6 +184,7 @@ extern "C"
   tsapi TSReturnCode TSHttpTxnCacheLookupSkip(TSHttpTxn txnp);
   tsapi TSReturnCode TSHttpTxnServerRespIgnore(TSHttpTxn txnp);
   tsapi TSReturnCode TSHttpTxnShutDown(TSHttpTxn txnp, TSEvent event);
+  tsapi TSReturnCode TSHttpTxnCloseAfterResponse(TSHttpTxn txnp, int should_close);
 
   /****************************************************************************
    *  ??