12#include "BESSyntaxUserError.h"
13#include "TheBESKeys.h"
17#include "ProxyConfig.h"
21using std::stringstream;
24#define prolog string("ProxyConfig::").append(__func__).append("() - ")
33 d_instance =
new ProxyConfig();
41 void ProxyConfig::load_proxy_from_keys() {
47 key = HTTP_PROXYHOST_KEY;
49 if (found && !d_host.empty()) {
54 key = HTTP_PROXYPORT_KEY;
56 if (found && !port.empty()) {
57 d_port = atoi(port.c_str());
60 err_msg << prolog <<
"The Httpd catalog proxy host is specified, but a specified port is absent";
61 throw BESSyntaxUserError(err_msg.str(), __FILE__, __LINE__);
71 if (!found || d_protocol.empty()) {
78 key = HTTP_PROXYUSER_KEY;
87 key = HTTP_PROXYPASSWORD_KEY;
90 d_proxy_password =
"";
96 key = HTTP_PROXYUSERPW_KEY;
106 key = HTTP_PROXYAUTHTYPE_KEY;
110 if (authType ==
"basic") {
111 d_auth_type = CURLAUTH_BASIC;
112 BESDEBUG(HTTP_MODULE, prolog <<
"ProxyAuthType BASIC set." << endl);
113 }
else if (authType ==
"digest") {
114 d_auth_type = CURLAUTH_DIGEST;
115 BESDEBUG(HTTP_MODULE, prolog <<
"ProxyAuthType DIGEST set." << endl);
116 }
else if (authType ==
"ntlm") {
117 d_auth_type = CURLAUTH_NTLM;
118 BESDEBUG(HTTP_MODULE, prolog <<
"ProxyAuthType NTLM set." << endl);
120 d_auth_type = CURLAUTH_BASIC;
121 BESDEBUG(HTTP_MODULE,
122 prolog <<
"User supplied an invalid value '" << authType
123 <<
"' for Gateway.ProxyAuthType. Falling back to BASIC authentication scheme."
127 d_auth_type = CURLAUTH_BASIC;
133 key = HTTP_NO_PROXY_REGEX_KEY;
136 d_no_proxy_regex =
"";
static std::string lowercase(const std::string &s)
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
static TheBESKeys * TheKeys()
Access to the singleton.
utility class for the HTTP catalog module