You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by su...@apache.org on 2014/11/18 04:58:18 UTC

trafficserver git commit: fix build error for various platforms

Repository: trafficserver
Updated Branches:
  refs/heads/master cd3a246c4 -> 8822ae9d5


fix build error for various platforms


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

Branch: refs/heads/master
Commit: 8822ae9d5d03118ee217c8908f5032a691e25b2a
Parents: cd3a246
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Tue Nov 18 03:58:00 2014 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Tue Nov 18 03:58:00 2014 +0000

----------------------------------------------------------------------
 .../sni_proto_nego/sni_proto_nego.cc            | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8822ae9d/plugins/experimental/sni_proto_nego/sni_proto_nego.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/sni_proto_nego/sni_proto_nego.cc b/plugins/experimental/sni_proto_nego/sni_proto_nego.cc
index bd5e5f2..d8f50b6 100644
--- a/plugins/experimental/sni_proto_nego/sni_proto_nego.cc
+++ b/plugins/experimental/sni_proto_nego/sni_proto_nego.cc
@@ -31,6 +31,8 @@
 using namespace std;
 
 const char* PLUGIN_NAME = "sni_proto_nego";
+
+#if TS_USE_TLS_SNI
 const int MAX_BUFFER_SIZE = 1024;
 const int MAX_FILE_PATH_SIZE = 1024;
 const unsigned int MAX_PROTO_LIST_LEN = 100;
@@ -50,7 +52,7 @@ bool read_config(char* config_file) {
   char file_path[MAX_FILE_PATH_SIZE];
   TSFile file;
   if (config_file == NULL) {
-    TSError("invalid config file");
+    TSError("%s: invalid config file", PLUGIN_NAME);
     return false;
   }
   TSDebug(PLUGIN_NAME, "trying to open config file in this path: %s", file_path);
@@ -59,7 +61,7 @@ bool read_config(char* config_file) {
     snprintf(file_path, sizeof(file_path), "%s/%s", TSInstallDirGet(), config_file);
     file = TSfopen(file_path, "r");
     if (file == NULL) {
-      TSError("Failed to open config file %s", config_file);
+      TSError("%s:Failed to open config file %s", PLUGIN_NAME, config_file);
       return false;
     }
   }
@@ -69,7 +71,7 @@ bool read_config(char* config_file) {
     char *eol = 0;
     // make sure line was not bigger than buffer
     if ((eol = strchr(buffer, '\n')) == NULL && (eol = strstr(buffer, "\r\n")) == NULL) {
-      TSError("sni_proto_nego line too long, did not get a good line in cfg, skipping, line: %s", buffer);
+      TSError("%s: sni_proto_nego line too long, did not get a good line in cfg, skipping, line: %s", PLUGIN_NAME, buffer);
       memset(buffer, 0, sizeof(buffer));
       continue;
     }
@@ -156,10 +158,8 @@ init_sni_callback(void *sslNetVC)
   if (it!=_sniProtoMap.end()) {
     SNIProtoConfig sniProtoConfig = it->second; 
     if (!sniProtoConfig.enableNpn) {
-#if TS_USE_TLS_NPN
       TSDebug(PLUGIN_NAME, "disabling NPN for serverName %s", serverName);
       SSL_CTX_set_next_protos_advertised_cb(ctx, NULL, NULL);
-#endif
     } else {
       TSDebug(PLUGIN_NAME, "setting NPN advertised list for %s", serverName);
       //TSSslAdvertiseProtocolSet(ssl_vc, (const unsigned char **)sniProtoConfig.npn_proto_list, sniProtoConfig.npn_proto_list_count);
@@ -171,7 +171,8 @@ init_sni_callback(void *sslNetVC)
 }
 
 int
-SSLSniInitCallbackHandler(TSCont /* cont */, TSEvent /* id */, void* sslNetVC) {
+SSLSniInitCallbackHandler(TSCont /* cont */, TSEvent /* id */, void* sslNetVC)
+{
   init_sni_callback(sslNetVC);
   return TS_EVENT_NONE;
 }
@@ -186,7 +187,7 @@ TSPluginInit(int argc, const char *argv[])
   info.vendor_name = (char *)("ats");
 
   if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
-    TSError("Plugin registration failed.");
+    TSError("%s: Plugin registration failed.", PLUGIN_NAME);
   }
 
   char* config_file = (char*)"conf/sni_proto_nego/sni_proto_nego.config";
@@ -203,3 +204,10 @@ TSPluginInit(int argc, const char *argv[])
   TSCont cont = TSContCreate(SSLSniInitCallbackHandler, NULL);
   TSHttpHookAdd(TS_SSL_SNI_HOOK, cont);
 }
+#else // #if TS_USE_TLS_SNI
+void
+TSPluginInit(int, const char *[])
+{
+    TSError("%s: requires TLS SNI which is not available.", PLUGIN_NAME);
+}
+#endif // #if TS_USE_TLS_SNI