32 : socket_type_(
"http"), socket_address_(DEFAULT_SOCKET_ADDRESS),
33 socket_port_(DEFAULT_SOCKET_PORT), auth_config_(),
34 trust_anchor_(
""), cert_file_(
""), key_file_(
""), cert_required_(true),
35 emulate_agent_response_(true) {
38 << config->getPosition() <<
")");
45 "invalid type specified for parameter 'socket-type' ("
46 << socket_type->getPosition() <<
")");
48 socket_type_ = socket_type->stringValue();
49 if ((socket_type_ !=
"http") && (socket_type_ !=
"https")) {
51 << socket_type_ <<
"' not 'http' or 'https'");
55 if (config->contains(
"socket-name")) {
57 "parameter 'socket-name' is not supported by HTTP "
65 "invalid type specified for parameter 'socket-address' ("
66 << socket_address->getPosition() <<
")");
69 socket_address_ =
IOAddress(socket_address->stringValue());
70 }
catch (
const std::exception& ex) {
72 << socket_address->stringValue()
73 <<
"' to address: " << ex.
what()
74 <<
" (" << socket_address->getPosition() <<
")");
83 "invalid type specified for parameter 'socket-port' ("
84 << socket_port->getPosition() <<
")");
86 int64_t value = socket_port->intValue();
87 if ((value < numeric_limits<uint16_t>::min()) ||
88 (value > numeric_limits<uint16_t>::max())) {
90 "out of range value " << value
91 <<
" specified for parameter 'socket-port' ("
92 << socket_port->getPosition() <<
")");
94 socket_port_ =
static_cast<uint16_t
>(value);
101 boost::const_pointer_cast<Element>(auth_config);
104 "invalid type specified for parameter 'authentication' ("
105 << auth_config->getPosition() <<
")");
115 mutable_auth_config->set(
"realm",
120 auth->parse(auth_config);
129 "invalid type specified for parameter 'trust-anchor' ("
130 << trust_anchor->getPosition() <<
")");
132 trust_anchor_ = trust_anchor->stringValue();
140 "invalid type specified for parameter 'cert-file' ("
141 << cert_file->getPosition() <<
")");
143 cert_file_ = cert_file->stringValue();
151 "invalid type specified for parameter 'key-file' ("
152 << key_file->getPosition() <<
")");
154 key_file_ = key_file->stringValue();
162 "invalid type specified for parameter 'cert-required' ("
163 << cert_required->getPosition() <<
")");
165 cert_required_ = cert_required->boolValue();
169 checkTlsSetup(socket_type_ ==
"https");
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.