trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vmam...@apache.org
Subject svn commit: r931696 - in /incubator/trafficserver/traffic/trunk: iocore/net/I_NetVConnection.h proxy/InkAPI.cc proxy/PluginVC.h proxy/api/include/ts.h
Date Wed, 07 Apr 2010 21:33:51 GMT
Author: vmamidi
Date: Wed Apr  7 21:33:50 2010
New Revision: 931696

URL: http://svn.apache.org/viewvc?rev=931696&view=rev
Log:
TS-288 - To provide an API to identify a plugin generated request vs external request Author:
Raghav jeyaraman , Reviewed by : Vijaya Bhaskar Mamidi

Modified:
    incubator/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
    incubator/trafficserver/traffic/trunk/proxy/InkAPI.cc
    incubator/trafficserver/traffic/trunk/proxy/PluginVC.h
    incubator/trafficserver/traffic/trunk/proxy/api/include/ts.h

Modified: incubator/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h?rev=931696&r1=931695&r2=931696&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h (original)
+++ incubator/trafficserver/traffic/trunk/iocore/net/I_NetVConnection.h Wed Apr  7 21:33:50
2010
@@ -417,6 +417,14 @@ public:
   /** Set remote sock addr struct. */
   virtual void set_remote_addr() = 0;
 
+  bool get_is_internal_request() const {
+    return is_internal_request;
+  }
+
+  void set_is_internal_request(bool val = false) {
+    is_internal_request = val;
+  }
+
 #if WITH_DETAILED_VCONNECTION_LOGGING
   void loggingInit()
   {
@@ -463,6 +471,7 @@ public:
   void addLogMessage(const char *message) {}
   void loggingInit() {}
   bool loggingEnabled() const { return false; }
+
   ink_hrtime getLogsTotalTime() const { return 0; }
   void printLogs() const {}
   void clearLogs() {}
@@ -478,6 +487,8 @@ protected:
 
   int got_local_addr;
   int got_remote_addr;
+
+  bool is_internal_request;
 };
 
 inline
@@ -489,7 +500,8 @@ thread(NULL),
 logging(NULL),
 #endif
 got_local_addr(0),
-got_remote_addr(0)
+got_remote_addr(0),
+is_internal_request(false)
 {
   memset(&local_addr, 0, sizeof(local_addr));
   memset(&remote_addr, 0, sizeof(remote_addr));

Modified: incubator/trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=931696&r1=931695&r2=931696&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ incubator/trafficserver/traffic/trunk/proxy/InkAPI.cc Wed Apr  7 21:33:50 2010
@@ -6560,6 +6560,14 @@ INKHttpConnect(unsigned int log_ip, int 
     new_pvc->set_active_addr(log_ip, log_port);
     new_pvc->set_accept_cont(plugin_http_accept);
     PluginVC *return_vc = new_pvc->connect();
+
+    if(return_vc !=NULL) {
+      PluginVC* other_side = return_vc->get_other_side();
+      if(other_side != NULL) {
+        other_side->set_is_internal_request(true);
+      }
+    }
+
     *vc = (INKVConn) return_vc;
     return ((return_vc) ? INK_SUCCESS : INK_ERROR);
   } else {
@@ -8990,4 +8998,19 @@ const char* INKRedirectUrlGet(INKHttpTxn
   return (const char*)sm->redirect_url;
 }
 
+int
+INKHttpIsInternalRequest(INKHttpTxn txnp)
+{
+  if (sdk_sanity_check_txn(txnp) != INK_SUCCESS) {
+    return 0;
+  }
+  INKHttpSsn ssnp = INKHttpTxnSsnGet(txnp);
+  HttpClientSession *cs = (HttpClientSession *) ssnp;
+  NetVConnection *vc = cs->get_netvc();
+  if (!cs || !vc) {
+    return 0;
+  }
+  return vc->get_is_internal_request();
+}
+
 #endif //INK_NO_API

Modified: incubator/trafficserver/traffic/trunk/proxy/PluginVC.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/PluginVC.h?rev=931696&r1=931695&r2=931696&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/PluginVC.h (original)
+++ incubator/trafficserver/traffic/trunk/proxy/PluginVC.h Wed Apr  7 21:33:50 2010
@@ -115,6 +115,8 @@ public:
   virtual bool get_data(int id, void *data);
   virtual bool set_data(int id, void *data);
 
+  virtual PluginVC* get_other_side() { return other_side; }
+
   int main_handler(int event, void *data);
 
 private:

Modified: incubator/trafficserver/traffic/trunk/proxy/api/include/ts.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/api/include/ts.h?rev=931696&r1=931695&r2=931696&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/api/include/ts.h (original)
+++ incubator/trafficserver/traffic/trunk/proxy/api/include/ts.h Wed Apr  7 21:33:50 2010
@@ -2120,6 +2120,9 @@ extern "C"
 
    */
   inkapi INKReturnCode INKHttpConnect(unsigned int log_ip, int log_port, INKVConn * vc);
+ 
+  /* Check if HTTP State machine is internal or not */ 
+  inkapi int INKHttpIsInternalRequest(INKHttpTxn txnp);
 
   // --------------------------------------------------------------------------
   // HTTP alternate selection



Mime
View raw message