This is an automated email from the ASF dual-hosted git repository.
rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 482bd3d Removes unused TSConfig usage in ssl_sni_whitelist example
482bd3d is described below
commit 482bd3d42dbab02bd186ae827e4634620f2d758d
Author: Randall Meyer <[email protected]>
AuthorDate: Tue May 7 13:44:12 2019 -0700
Removes unused TSConfig usage in ssl_sni_whitelist example
---
example/ssl_sni_whitelist/ssl_sni_whitelist.cc | 59 ++--------------------
example/ssl_sni_whitelist/ssl_sni_whitelist.config | 3 --
2 files changed, 3 insertions(+), 59 deletions(-)
diff --git a/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
b/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
index 9d2db9e..f0217b0 100644
--- a/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
+++ b/example/ssl_sni_whitelist/ssl_sni_whitelist.cc
@@ -2,7 +2,7 @@
SSL SNI white list plugin
If the server name and IP address are not in the ssl_multicert.config
- go head and blind tunnel it.
+ go ahead and blind tunnel it.
@section license License
@@ -28,45 +28,14 @@
#include <cinttypes>
#include <ts/ts.h>
#include "tscore/ink_config.h"
-#include <tsconfig/TsValue.h>
-#include <openssl/ssl.h>
-#include <getopt.h>
-using ts::config::Configuration;
-using ts::config::Value;
+#include <openssl/ssl.h>
#define PLUGIN_NAME "ssl_sni_whitelist"
#define PCP "[" PLUGIN_NAME "] "
namespace
{
-std::string ConfigPath;
-
-Configuration Config; // global configuration
-
-int
-Load_Config_File()
-{
- ts::Rv<Configuration> cv = Configuration::loadFromPath(ConfigPath.c_str());
- if (!cv.isOK()) {
- TSError(PCP "Failed to parse %s as TSConfig format", ConfigPath.c_str());
- return -1;
- }
- Config = cv;
- return 1;
-}
-
-int
-Load_Configuration()
-{
- int ret = Load_Config_File();
- if (ret != 0) {
- TSError(PCP "Failed to load the config file, check debug output for
errata");
- }
-
- return 0;
-}
-
int
CB_servername_whitelist(TSCont /* contp */, TSEvent /* event */, void *edata)
{
@@ -105,38 +74,16 @@ TSPluginInit(int argc, const char *argv[])
{
bool success = false;
TSPluginRegistrationInfo info;
- TSCont cb_sni = nullptr; // sni callback continuation
- static const struct option longopt[] = {
- {const_cast<char *>("config"), required_argument, nullptr, 'c'},
- {nullptr, no_argument, nullptr, '\0'},
- };
+ TSCont cb_sni = nullptr; // sni callback continuation
info.plugin_name = PLUGIN_NAME;
info.vendor_name = "Apache Software Foundation";
info.support_email = "[email protected]";
- int opt = 0;
- while (opt >= 0) {
- opt = getopt_long(argc, (char *const *)argv, "c:", longopt, nullptr);
- switch (opt) {
- case 'c':
- ConfigPath = optarg;
- ConfigPath = std::string(TSConfigDirGet()) + '/' + std::string(optarg);
- break;
- }
- }
- if (ConfigPath.length() == 0) {
- static const char *const DEFAULT_CONFIG_PATH = "ssl_sni_whitelist.config";
- ConfigPath =
std::string(TSConfigDirGet()) + '/' + std::string(DEFAULT_CONFIG_PATH);
- TSDebug(PLUGIN_NAME, "No config path set in arguments, using default: %s",
DEFAULT_CONFIG_PATH);
- }
-
if (TS_SUCCESS != TSPluginRegister(&info)) {
TSError(PCP "registration failed");
} else if (TSTrafficServerVersionGetMajor() < 2) {
TSError(PCP "requires Traffic Server 2.0 or later");
- } else if (0 > Load_Configuration()) {
- TSError(PCP "Failed to load config file");
} else if (nullptr == (cb_sni = TSContCreate(&CB_servername_whitelist,
TSMutexCreate()))) {
TSError(PCP "Failed to create SNI callback");
} else {
diff --git a/example/ssl_sni_whitelist/ssl_sni_whitelist.config
b/example/ssl_sni_whitelist/ssl_sni_whitelist.config
deleted file mode 100644
index 706e6a8..0000000
--- a/example/ssl_sni_whitelist/ssl_sni_whitelist.config
+++ /dev/null
@@ -1,3 +0,0 @@
-//
-// Place holder
-