22 bypass(false), maxConn(-1), onOverload(
srvWait),
23 routing(false), ipv6(false)
41 if (!strncasecmp(str,
"REQMOD", 6))
44 if (!strncasecmp(str,
"RESPMOD", 7))
53 const char *t = service_configConfig;
54 const char *q = strchr(t,
'_');
59 if (!strcmp(t,
"precache"))
62 if (!strcmp(t,
"postcache"))
73 if (!method_point.
size()) {
75 "Missing vectoring point in adaptation service definition");
79 method = parseMethod(method_point.
termedBuf());
80 point = parseVectPoint(method_point.
termedBuf());
83 "Unknown vectoring point '" << method_point <<
"' in adaptation service definition");
88 bypass = routing =
false;
91 bool grokkedUri =
false;
92 bool onOverloadSet =
false;
93 std::set<std::string> options;
96 const char *name = option;
97 const char *value =
"";
98 if (strcmp(option,
"0") == 0) {
102 }
else if (strcmp(option,
"1") == 0) {
107 char *eq = strstr(option,
"=");
108 const char *sffx = strstr(option,
"://");
109 if (!eq || (sffx && sffx < eq)) {
119 if (options.find(name) != options.end()) {
121 "Duplicate option \"" << name <<
"\" in adaptation service definition");
124 options.insert(name);
126 bool grokked =
false;
127 if (strcmp(name,
"bypass") == 0) {
128 grokked = grokBool(bypass, name, value);
129 }
else if (strcmp(name,
"routing") == 0)
130 grokked = grokBool(routing, name, value);
131 else if (strcmp(name,
"uri") == 0)
132 grokked = grokkedUri = grokUri(value);
133 else if (strcmp(name,
"ipv6") == 0) {
134 grokked = grokBool(ipv6, name, value);
137 }
else if (strcmp(name,
"max-conn") == 0)
138 grokked = grokLong(maxConn, name, value);
139 else if (strcmp(name,
"on-overload") == 0) {
140 grokked = grokOnOverload(onOverload, value);
141 onOverloadSet =
true;
142 }
else if (strcmp(name,
"connection-encryption") == 0) {
144 grokked = grokBool(
encrypt, name, value);
145 connectionEncryption.configure(
encrypt);
146 }
else if (strncmp(name,
"ssl", 3) == 0 || strncmp(name,
"tls-", 4) == 0) {
151 std::string tmp = name + (name[0] ==
's' ? 3 : 4);
154 secure.parse(tmp.c_str());
158 grokked = grokExtension(name, value);
170 if (secure.encryptTransport)
171 secure.parse(
"no-npn");
176 "No \"uri\" option in adaptation service definition");
181 "adaptation_service " << key <<
' ' <<
183 bypass << routing <<
' ' <<
195 if (!value || !*value) {
197 "empty adaptation service URI");
204 const char *schemeSuffix =
"://";
207 protocol=uri.substr(0,schemeEnd);
210 "service protocol is " << protocol);
212 if (protocol.size() == 0)
216 const char *s = uri.termedBuf() + protocol.size() + strlen(schemeSuffix);
220 bool have_port =
false;
225 if ((t = strchr(s,
']')) ==
nullptr)
230 if ((e = strchr(t,
':')) !=
nullptr) {
232 }
else if ((e = strchr(t,
'/')) !=
nullptr) {
238 if ((e = strchr(s,
':')) !=
nullptr) {
240 }
else if ((e = strchr(s,
'/')) !=
nullptr) {
250 if (secure.sslDomain.isEmpty())
251 secure.sslDomain.assign(host.rawBuf(), host.size());
259 if ((e = strchr(s,
'/')) !=
nullptr) {
261 const unsigned long p = strtoul(s, &t, 0);
266 port =
static_cast<int>(p);
286 "long resource name (>1024), probably wrong");
289 resource.assign(s, len + 1);
296 if (!strcmp(value,
"0") || !strcmp(value,
"off"))
298 else if (!strcmp(value,
"1") || !strcmp(value,
"on"))
302 "wrong value for boolean " << name <<
"; " <<
303 "'0', '1', 'on', or 'off' expected but got: " << value);
314 const long p = strtol(value, &bad, 0);
315 if (p < 0 || bad == value) {
317 config_lineno <<
": " <<
"wrong value for " << name <<
"; " <<
318 "a non-negative integer expected but got: " << value);
328 if (strcmp(value,
"block") == 0)
330 else if (strcmp(value,
"bypass") == 0)
332 else if (strcmp(value,
"wait") == 0)
334 else if (strcmp(value,
"force") == 0)
339 "'block', 'bypass', 'wait' or 'force' expected but got: " << value);
350 "ERROR: unknown adaptation service option: " <<
351 name <<
'=' << value);
const char * cfg_filename
bool grokLong(long &var, const char *name, const char *value)
bool grokUri(const char *value)
VectPoint parseVectPoint(const char *buf) const
bool grokOnOverload(SrvBehaviour &var, const char *value)
handle on-overload configuration option
const char * vectPointStr() const
virtual bool grokExtension(const char *name, const char *value)
handle name=value configuration option with name unknown to Squid
const char * methodStr() const
bool grokBool(bool &var, const char *name, const char *value)
interpret parsed values
Method parseMethod(const char *buf) const
static char * NextToken()
static const size_type npos
char const * termedBuf() const
#define DBG_PARSE_NOTE(x)
#define debugs(SECTION, LEVEL, CONTENT)
void encrypt(char *nachr, int decr)
const char * vectPointStr(VectPoint)
const char * methodStr(Method)
int EnableIpv6
Whether IPv6 is supported and type of support.