188#if USE_HTTP_VIOLATIONS
192#define free_http_header_access free_HeaderManglers
195#define free_http_header_replace free_HeaderManglers
217#define parse_PortCfg(l) parsePortCfg((l), token)
219#define free_PortCfg(h) *(h)=NULL
314 char* saveptr =
nullptr;
319 memset(&globbuf, 0,
sizeof(globbuf));
321 if (glob(path, globbuf.gl_pathc ? GLOB_APPEND : 0,
nullptr, &globbuf) != 0) {
323 fatalf(
"Unable to find configuration file: %s: %s", path,
xstrerr(xerrno));
326 for (i = 0; i < (
int)globbuf.gl_pathc; ++i) {
332 while (file !=
NULL) {
341ReplaceSubstr(
char*& str,
int& len,
unsigned substrIdx,
unsigned substrLen,
const char* newSubstr)
344 assert(newSubstr !=
nullptr);
346 unsigned newSubstrLen = strlen(newSubstr);
347 if (newSubstrLen > substrLen)
348 str = (
char*)realloc(str, len - substrLen + newSubstrLen + 1);
351 memmove(str + substrIdx + newSubstrLen, str + substrIdx + substrLen, len - substrIdx - substrLen + 1);
353 memcpy(str + substrIdx, newSubstr, newSubstrLen);
362 assert(macroName !=
nullptr);
363 assert(substStr !=
nullptr);
364 unsigned macroNameLen = strlen(macroName);
365 while (
const char* macroPos = strstr(line, macroName))
366 ReplaceSubstr(line, len, macroPos - line, macroNameLen, substStr);
381 unsigned i = strlen(str);
382 while ((i > 0) &&
IsSpace(str[i - 1]))
391 assert(statement !=
nullptr);
393 const char* str =
skip_ws(line);
394 unsigned len = strlen(statement);
395 if (strncmp(str, statement, len) == 0) {
412 number = strtol(str, &end, 0);
414 return (end != str) && (*end ==
'\0');
421 if (strcmp(expr,
"true") == 0) {
423 }
else if (strcmp(expr,
"false") == 0) {
425 }
else if (
const char* equation = strchr(expr,
'=')) {
426 const char* rvalue =
skip_ws(equation + 1);
427 char* lvalue = (
char*)
xmalloc(equation - expr + 1);
428 xstrncpy(lvalue, expr, equation - expr + 1);
433 fatalf(
"String is not a integer number: '%s'\n", lvalue);
436 fatalf(
"String is not a integer number: '%s'\n", rvalue);
439 return number1 == number2;
441 fatalf(
"Unable to evaluate expression '%s'\n", expr);
451 char *token =
nullptr;
452 char *tmp_line =
nullptr;
453 int tmp_line_len = 0;
457 debugs(3,
Important(68),
"Processing Configuration File: " << file_name <<
" (depth " << depth <<
")");
459 fatalf(
"WARNING: can't include %s: includes are nested too deeply (>16)!\n", file_name);
463 if (file_name[0] ==
'!' || file_name[0] ==
'|') {
464 fp = popen(file_name + 1,
"r");
467 fp = fopen(file_name,
"r");
472 fatalf(
"Unable to open configuration file: %s: %s", file_name,
xstrerr(xerrno));
476 setmode(fileno(fp),
O_TEXT);
485 std::vector<bool> if_states;
501 static char new_file_name[1024];
503 static char new_lineno;
505 new_lineno = strtol(token, &file, 0) - 1;
510 while (*file &&
IsSpace(*file))
517 xstrncpy(new_file_name, file + 1,
sizeof(new_file_name));
519 if ((token = strchr(new_file_name,
'"')))
536 size_t append_len = strlen(append);
538 tmp_line = (
char*)
xrealloc(tmp_line, tmp_line_len + append_len + 1);
540 strcpy(tmp_line + tmp_line_len, append);
542 tmp_line_len += append_len;
544 if (tmp_line[tmp_line_len-1] ==
'\\') {
545 debugs(3, 5,
"parseConfigFile: tmp_line='" << tmp_line <<
"'");
546 tmp_line[--tmp_line_len] =
'\0';
557 if (!if_states.empty())
558 if_states.pop_back();
560 fatalf(
"'endif' without 'if'\n");
562 if (!if_states.empty())
563 if_states.back() = !if_states.back();
565 fatalf(
"'else' without 'if'\n");
566 }
else if (if_states.empty() || if_states.back()) {
568 if (tmp_line_len >= 9 && strncmp(tmp_line,
"include", 7) == 0 &&
IsSpace(tmp_line[7])) {
589 if (!if_states.empty())
590 fatalf(
"if-statement without 'endif'\n");
593 int ret = pclose(fp);
596 fatalf(
"parseConfigFile: '%s' failed with exit code %d\n", file_name, ret);
624 if (unrecognizedDirectives)
636 "Current Squid Configuration",
684 entry->
append(name, strlen(name));
687 const auto buf = os.
buf();
690 entry->
append(buf.rawContent(), buf.length());
707 static_assert(std::is_trivial<T>::value,
"SquidConfig member is trivial");
708 memset(&raw, 0,
sizeof(raw));
725 debugs(3,
DBG_CRITICAL,
"WARNING: This Squid binary can not handle files larger than 2GB. Limiting maximum_object_size to just below 2GB");
751 fatal(
"append_domain must begin with a '.'");
756#if !HAVE_SETRLIMIT || !defined(RLIMIT_NOFILE)
758 debugs(0,
DBG_IMPORTANT,
"WARNING: max_filedescriptors disabled. Operating System setrlimit(RLIMIT_NOFILE) is missing.");
762 debugs(0,
DBG_IMPORTANT,
"WARNING: max_filedescriptors limited to " << FD_SETSIZE <<
" by select() algorithm.");
795 debugs(0,
DBG_CRITICAL,
"WARNING: connect_retries cannot be larger than 10. Resetting to 10.");
804 bool logDaemonUsed =
false;
806 logDaemonUsed =
log->usesDaemon();
809 logDaemonUsed =
log->usesDaemon();
825#if USE_HTTP_VIOLATIONS
834 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'override-expire' in 'refresh_pattern' violates HTTP");
843 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP");
852 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'reload-into-ims' in 'refresh_pattern' violates HTTP");
861 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'ignore-reload' in 'refresh_pattern' violates HTTP");
870 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'ignore-no-store' in 'refresh_pattern' violates HTTP");
879 debugs(22,
DBG_IMPORTANT,
"WARNING: use of 'ignore-private' in 'refresh_pattern' violates HTTP");
885#if !USE_HTTP_VIOLATIONS
898 if (geteuid() == 0) {
903 if (
nullptr == pwd) {
913 fatalf(
"getpwnam failed to find userid for effective user '%s'",
922 if (pwd->pw_dir && *pwd->pw_dir)
923 (void)setenv(
"HOME", pwd->pw_dir, 1);
934 if (
nullptr == grp) {
935 fatalf(
"getgrnam failed to find groupid for effective group '%s'",
949 debugs(3, 2,
"initializing https:// proxy context");
955 fatal(
"ERROR: Could not initialize https:// proxy context");
957 debugs(3,
DBG_IMPORTANT,
"ERROR: proxying https:// currently still requires --with-openssl");
969 if (p->secure.sslDomain.isEmpty())
970 p->secure.sslDomain = p->host;
972 if (p->secure.encryptTransport) {
973 debugs(3, 2,
"initializing TLS context for cache_peer " << *p);
974 p->sslContext = p->secure.createClientContext(
true);
975 if (!p->sslContext) {
976 debugs(3,
DBG_CRITICAL,
"ERROR: Could not initialize TLS context for cache_peer " << *p);
984 if (!s->secure.encryptTransport)
986 debugs(3, 2,
"initializing " <<
AnyP::UriScheme(s->transport.protocol) <<
"_port " << s->s <<
" TLS contexts");
987 s->secure.initServerContexts(*s);
993 fatalf(
"Client request buffer of %u bytes cannot hold a request with %u bytes of headers." \
994 " Change client_request_buffer_max or request_header_max_size limits.",
1004 debugs(3,
DBG_CRITICAL,
"WARNING: Increasing request_header_max_size beyond " << safeRawHeaderValueSizeMax <<
1005 " bytes makes Squid more vulnerable to denial-of-service attacks; configured value: " <<
Config.
maxRequestHeaderSize <<
" bytes");
1007 debugs(3,
DBG_CRITICAL,
"WARNING: Increasing reply_header_max_size beyond " << safeRawHeaderValueSizeMax <<
1008 " bytes makes Squid more vulnerable to denial-of-service attacks; configured value: " <<
Config.
maxReplyHeaderSize <<
" bytes");
1016 " requires client_persistent_connections ON. Forced pipeline_prefetch 0.");
1031 if ((nego && nego->
active()) || (ntlm && ntlm->
active())) {
1038 authSchemes.expand();
1039 if (authSchemes.authConfigs.empty()) {
1040 debugs(3,
DBG_CRITICAL,
"auth_schemes: at least one scheme name is required; got: " << authSchemes.rawSchemes);
1057 if (!strcmp(name,
"url_rewrite_concurrency")) {
1060 debugs(3,
DBG_CRITICAL,
"WARNING: url_rewrite_concurrency upgrade overriding url_rewrite_children settings.");
1064 if (!strcmp(name,
"ignore_ims_on_miss")) {
1072 if (!strncmp(name,
"sslproxy_", 9)) {
1075 if (!strcmp(name,
"sslproxy_cafile"))
1077 else if (!strcmp(name,
"sslproxy_capath"))
1079 else if (!strcmp(name,
"sslproxy_cipher"))
1081 else if (!strcmp(name,
"sslproxy_client_certificate"))
1083 else if (!strcmp(name,
"sslproxy_client_key"))
1085 else if (!strcmp(name,
"sslproxy_flags"))
1087 else if (!strcmp(name,
"sslproxy_options"))
1089 else if (!strcmp(name,
"sslproxy_version"))
1102 tmp.
append(token, strlen(token));
1107template <
class MinimalUnit>
1111 const auto minUnit = MinimalUnit(1);
1112 if(minUnit == std::chrono::nanoseconds(1))
1114 else if (minUnit == std::chrono::microseconds(1))
1116 else if (minUnit == std::chrono::milliseconds(1))
1119 assert(minUnit >= std::chrono::seconds(1));
1129template <
class MinimalUnit>
1134 throw TexcHere(
"missing time unit");
1137 ns = std::chrono::nanoseconds(1);
1139 ns = std::chrono::microseconds(1);
1141 ns = std::chrono::milliseconds(1);
1143 ns = std::chrono::seconds(1);
1145 ns = std::chrono::minutes(1);
1147 ns = std::chrono::hours(1);
1149 ns = std::chrono::hours(24);
1151 ns = std::chrono::hours(24 * 7);
1153 ns = std::chrono::hours(24 * 14);
1155 ns = std::chrono::hours(24 * 30);
1157 ns = std::chrono::hours(
static_cast<std::chrono::hours::rep
>(
HoursPerYear));
1159 ns = std::chrono::hours(
static_cast<std::chrono::hours::rep
>(
HoursPerYear * 10));
1163 if (
ns < MinimalUnit(1)) {
1164 throw TexcHere(
ToSBuf(
"time unit '", unitName,
"' is too small to be used in this context, the minimal unit is ",
1165 TimeUnitToString<MinimalUnit>()));
1171static std::chrono::nanoseconds
1175 throw TexcHere(
"time must have a positive value");
1177 if (value > (
static_cast<double>(std::chrono::nanoseconds::max().count()) / unit.count())) {
1178 const auto maxYears = std::chrono::duration_cast<std::chrono::hours>(std::chrono::nanoseconds::max()).count()/
HoursPerYear;
1179 throw TexcHere(
ToSBuf(
"time values cannot exceed ", maxYears,
" years"));
1182 return std::chrono::duration_cast<std::chrono::nanoseconds>(unit * value);
1185template <
class TimeUnit>
1189 const auto result = std::chrono::duration_cast<TimeUnit>(
ns);
1190 if (!result.count()) {
1192 "' is too small to be used in this context, the minimal value is 1 ",
1193 TimeUnitToString<TimeUnit>()));
1200template <
class TimeUnit>
1206 throw TexcHere(
"cannot read a time value");
1208 const auto parsedValue =
xatof(valueToken);
1210 if (parsedValue == 0)
1211 return TimeUnit::zero();
1213 std::chrono::nanoseconds parsedUnitDuration;
1217 if (!parseTimeUnit<TimeUnit>(token, parsedUnitDuration))
1222 const auto nanoseconds =
ToNanoSeconds(parsedValue, parsedUnitDuration);
1225 if (TimeUnit(1) <= std::chrono::microseconds(1)) {
1226 if (0 < nanoseconds.count() && nanoseconds.count() < 3) {
1228 "Squid time measurement precision is likely to be far worse than " <<
1229 "the nanosecond-level precision implied by the configured value: " << parsedValue <<
' ' << token);
1233 return FromNanoseconds<TimeUnit>(nanoseconds, parsedValue);
1254 if (strcmp(token,
"none") == 0 || strcmp(token,
"-1") == 0) {
1268 d <<
" " << units );
1274 *bptr =
static_cast<int64_t
>(m * d / u);
1276 if (
static_cast<double>(*bptr) * 2 != (m * d / u) * 2) {
1278 d <<
" " << token <<
": integer overflow (int64_t).");
1301 if (strcmp(token,
"none") == 0 || strcmp(token,
"-1") == 0) {
1302 *bptr =
static_cast<size_t>(-1);
1315 d <<
" " << units );
1321 *bptr =
static_cast<size_t>(m * d / u);
1323 if (
static_cast<double>(*bptr) * 2 != (m * d / u) * 2) {
1325 d <<
" " << token <<
": integer overflow (size_t).");
1348 if (strcmp(token,
"none") == 0 || token[0] ==
'-' ) {
1362 d <<
" " << units );
1368 *bptr =
static_cast<ssize_t
>(m * d / u);
1370 if (
static_cast<double>(*bptr) * 2 != (m * d / u) * 2) {
1372 d <<
" " << token <<
": integer overflow (ssize_t).");
1392 char const * number_begin = value;
1393 char const * number_end = value;
1395 while ((*number_end >=
'0' && *number_end <=
'9')) {
1400 number.
assign(number_begin, number_end - number_begin);
1409 *bptr =
static_cast<size_t>(m * d / u);
1410 if (
static_cast<double>(*bptr) * 2 != (m * d / u) * 2)
1438 list->push_back(
SBuf(token));
1445 for (
const auto &i : words) {
1446 entry->
append(i.rawContent(), i.length());
1456 if (!list.empty()) {
1457 entry->
append(name, strlen(name));
1534 if (!strcmp(token,
"any_addr"))
1536 else if ( (!strcmp(token,
"no_addr")) || (!strcmp(token,
"full_mask")) )
1538 else if ( (*addr = token) )
1543 debugs(3,
DBG_CRITICAL,
"FATAL: invalid IP address or domain name '" << token <<
"'");
1560 if (!l->addr.isAnyAddr())
1580 tail = &(*tail)->
next;
1620 if (!
xstrtoui(token,
nullptr, &tos, 0, std::numeric_limits<tos_t>::max())) {
1625 const unsigned int chTos = tos & 0xFC;
1639 tail = &(*tail)->
next;
1651#if HAVE_LIBCAP && SO_MARK
1672 const auto pkt_dirs = {
"mark_client_packet",
"clientside_mark",
"tcp_outgoing_mark"};
1673 if (mc.hasMask() && std::find(pkt_dirs.begin(), pkt_dirs.end(),
cfg_directive) != pkt_dirs.end())
1683 tail = &(*tail)->
next;
1722 tail = &(*tail)->
next;
1741#define free_delay_pool_class(X)
1742#define free_delay_pool_access(X)
1743#define free_delay_pool_rates(X)
1744#define dump_delay_pool_class(X, Y, Z)
1745#define dump_delay_pool_access(X, Y, Z)
1746#define dump_delay_pool_rates(X, Y, Z)
1792#define free_client_delay_pool_access(X)
1793#define free_client_delay_pool_rates(X)
1794#define dump_client_delay_pool_access(X, Y, Z)
1795#define dump_client_delay_pool_rates(X, Y, Z)
1828#if USE_HTTP_VIOLATIONS
1853 std::string directive =
"http_header_access ";
1905 return s ==
nullptr;
1927 if (schemeCfg ==
nullptr) {
1931 if (theScheme ==
nullptr) {
1932 debugs(3,
DBG_CRITICAL,
"ERROR: Failure while parsing Config File: Unknown authentication scheme '" << type_str <<
"'.");
1937 config->push_back(theScheme->createConfig());
1939 if (schemeCfg ==
nullptr) {
1940 debugs(3,
DBG_CRITICAL,
"Parsing Config File: Corruption configuring authentication scheme '" << type_str <<
"'.");
1946 schemeCfg->
parse(schemeCfg, config->size(), param_str);
1964 for (
auto *scheme : cfg)
1965 scheme->dump(entry, name, scheme);
2004 auto &access = *config;
2018 (*access)->add(rule, action);
2031 const char * result;
2044 result =
"multicast";
2064 for (
const auto &peer: *peers) {
2065 const auto p = peer.get();
2076 snprintf(xname, 128,
"cache_peer_access %s", p->name);
2080 for (t = p->typelist; t; t = t->
next) {
2096 if (len < 1)
return false;
2098 for (; len >0 && *str; ++str, --len) {
2099 if (! isdigit(*str))
2109static unsigned short
2112 struct servent *
port =
nullptr;
2115 if (token ==
nullptr) {
2122 if (
port !=
nullptr) {
2123 return ntohs((
unsigned short)
port->s_port);
2126 return xatos(token);
2133inline unsigned short
2143inline unsigned short
2169 p->options.no_digest =
true;
2170 p->options.no_netdb_exchange =
true;
2175 if (!p->http_port) {
2184 if (!strcmp(token,
"proxy-only")) {
2185 p->options.proxy_only =
true;
2186 }
else if (!strcmp(token,
"no-query")) {
2187 p->options.no_query =
true;
2188 }
else if (!strcmp(token,
"background-ping")) {
2189 p->options.background_ping =
true;
2190 }
else if (!strcmp(token,
"no-digest")) {
2191 p->options.no_digest =
true;
2192 }
else if (!strcmp(token,
"no-tproxy")) {
2193 p->options.no_tproxy =
true;
2194 }
else if (!strcmp(token,
"multicast-responder")) {
2195 p->options.mcast_responder =
true;
2196 }
else if (!strcmp(token,
"multicast-siblings")) {
2197 p->options.mcast_siblings =
true;
2198 }
else if (!strncmp(token,
"weight=", 7)) {
2199 p->weight =
xatoi(token + 7);
2200 }
else if (!strncmp(token,
"basetime=", 9)) {
2201 p->basetime =
xatoi(token + 9);
2202 }
else if (!strcmp(token,
"closest-only")) {
2203 p->options.closest_only =
true;
2204 }
else if (!strncmp(token,
"ttl=", 4)) {
2205 p->mcast.ttl =
xatoi(token + 4);
2207 if (p->mcast.ttl < 0)
2210 if (p->mcast.ttl > 128)
2212 }
else if (!strcmp(token,
"default")) {
2213 p->options.default_parent =
true;
2214 }
else if (!strcmp(token,
"round-robin")) {
2215 p->options.roundrobin =
true;
2216 }
else if (!strcmp(token,
"weighted-round-robin")) {
2217 p->options.weighted_roundrobin =
true;
2219 }
else if (!strcmp(token,
"htcp")) {
2220 p->options.htcp =
true;
2221 }
else if (!strncmp(token,
"htcp=", 5) || !strncmp(token,
"htcp-", 5)) {
2223 p->options.htcp =
true;
2225 char *mode, *nextmode;
2226 for (mode = nextmode = tmp; mode; mode = nextmode) {
2227 nextmode = strchr(mode,
',');
2232 if (!strcmp(mode,
"no-clr")) {
2233 if (p->options.htcp_only_clr)
2234 fatalf(
"parse_peer: can't set htcp-no-clr and htcp-only-clr simultaneously");
2235 p->options.htcp_no_clr =
true;
2236 }
else if (!strcmp(mode,
"no-purge-clr")) {
2237 p->options.htcp_no_purge_clr =
true;
2238 }
else if (!strcmp(mode,
"only-clr")) {
2239 if (p->options.htcp_no_clr)
2240 fatalf(
"parse_peer: can't set htcp no-clr and only-clr simultaneously");
2241 p->options.htcp_only_clr =
true;
2242 }
else if (!strcmp(mode,
"forward-clr")) {
2243 p->options.htcp_forward_clr =
true;
2244 }
else if (!strcmp(mode,
"oldsquid")) {
2245 p->options.htcp_oldsquid =
true;
2247 fatalf(
"invalid HTCP mode '%s'", mode);
2252 }
else if (!strcmp(token,
"no-netdb-exchange")) {
2253 p->options.no_netdb_exchange =
true;
2255 }
else if (!strcmp(token,
"carp")) {
2259 p->options.carp =
true;
2260 }
else if (!strncmp(token,
"carp-key=", 9)) {
2261 if (p->options.carp !=
true)
2263 p->options.carp_key.set =
true;
2264 char *nextkey=token+strlen(
"carp-key="), *key=nextkey;
2265 for (; key; key = nextkey) {
2266 nextkey=strchr(key,
',');
2267 if (nextkey) ++nextkey;
2268 if (0==strncmp(key,
"scheme",6)) {
2269 p->options.carp_key.scheme =
true;
2270 }
else if (0==strncmp(key,
"host",4)) {
2271 p->options.carp_key.host =
true;
2272 }
else if (0==strncmp(key,
"port",4)) {
2273 p->options.carp_key.port =
true;
2274 }
else if (0==strncmp(key,
"path",4)) {
2275 p->options.carp_key.path =
true;
2276 }
else if (0==strncmp(key,
"params",6)) {
2277 p->options.carp_key.params =
true;
2279 fatalf(
"invalid carp-key '%s'",key);
2282 }
else if (!strcmp(token,
"userhash")) {
2287 p->options.userhash =
true;
2291 }
else if (!strcmp(token,
"sourcehash")) {
2295 p->options.sourcehash =
true;
2297 }
else if (!strcmp(token,
"no-delay")) {
2299 p->options.no_delay =
true;
2301 debugs(0,
DBG_CRITICAL,
"WARNING: cache_peer option 'no-delay' requires --enable-delay-pools");
2303 }
else if (!strncmp(token,
"login=", 6)) {
2304 p->login =
xstrdup(token + 6);
2306 }
else if (!strcmp(token,
"auth-no-keytab")) {
2307 p->options.auth_no_keytab = 1;
2308 }
else if (!strncmp(token,
"connect-timeout=", 16)) {
2309 p->connect_timeout_raw =
xatoi(token + 16);
2310 }
else if (!strncmp(token,
"connect-fail-limit=", 19)) {
2311 p->connect_fail_limit =
xatoi(token + 19);
2312#if USE_CACHE_DIGESTS
2313 }
else if (!strncmp(token,
"digest-url=", 11)) {
2314 p->digest_url =
xstrdup(token + 11);
2317 }
else if (!strcmp(token,
"allow-miss")) {
2318 p->options.allow_miss =
true;
2319 }
else if (!strncmp(token,
"max-conn=", 9)) {
2320 p->max_conn =
xatoi(token + 9);
2321 }
else if (!strncmp(token,
"standby=", 8)) {
2322 p->standby.limit =
xatoi(token + 8);
2323 }
else if (!strcmp(token,
"originserver")) {
2324 p->options.originserver =
true;
2325 }
else if (!strncmp(token,
"name=", 5)) {
2326 p->rename(token + 5);
2327 }
else if (!strncmp(token,
"forceddomain=", 13)) {
2330 p->domain =
xstrdup(token + 13);
2332 }
else if (strncmp(token,
"ssl", 3) == 0) {
2334 debugs(0,
DBG_CRITICAL,
"WARNING: cache_peer option '" << token <<
"' requires --with-openssl");
2336 p->secure.parse(token+3);
2338 }
else if (strncmp(token,
"tls-", 4) == 0) {
2339 p->secure.parse(token+4);
2340 }
else if (strncmp(token,
"tls", 3) == 0) {
2341 p->secure.parse(token+3);
2342 }
else if (strcmp(token,
"front-end-https") == 0) {
2343 p->front_end_https = 1;
2344 }
else if (strcmp(token,
"front-end-https=on") == 0) {
2345 p->front_end_https = 1;
2346 }
else if (strcmp(token,
"front-end-https=auto") == 0) {
2347 p->front_end_https = 2;
2348 }
else if (strcmp(token,
"connection-auth=off") == 0) {
2349 p->connection_auth = 0;
2350 }
else if (strcmp(token,
"connection-auth") == 0) {
2351 p->connection_auth = 1;
2352 }
else if (strcmp(token,
"connection-auth=on") == 0) {
2353 p->connection_auth = 1;
2354 }
else if (strcmp(token,
"connection-auth=auto") == 0) {
2355 p->connection_auth = 2;
2356 }
else if (token[0] ==
'#') {
2367 if (p->max_conn > 0 && p->max_conn < p->standby.limit)
2369 " is lower than its standby=", p->standby.limit),
Here());
2374 if (p->connect_fail_limit < 1)
2375 p->connect_fail_limit = 10;
2377#if USE_CACHE_DIGESTS
2378 if (!p->options.no_digest)
2382 if (p->secure.encryptTransport)
2383 p->secure.parseOptions();
2390 p->index = (*peers)->size();
2406 if (strcmp(list->
passwd,
"none") && strcmp(list->
passwd,
"disable"))
2422 char *passwd =
nullptr;
2432 for (P =
head; *P; P = &(*P)->
next) {
2441 for (
const auto &w : (*P)->actions) {
2442 for (
const auto &u : p->
actions) {
2464 while (var !=
nullptr) {
2467 for (
const auto &aclName: var->
acl_list)
2493 std::string directive =
"peer_access ";
2494 directive += p.
name;
2509 char *domain =
nullptr;
2516 for (L = &p.typelist; *L; L = &((*L)->next));
2576 if (!strcmp(token,
"on")) {
2578 }
else if (!strcmp(token,
"enable")) {
2581 }
else if (!strcmp(token,
"off")) {
2583 }
else if (!strcmp(token,
"disable")) {
2592#define free_onoff free_int
2618 if (!strcmp(token,
"on")) {
2620 }
else if (!strcmp(token,
"enable")) {
2623 }
else if (!strcmp(token,
"warn")) {
2625 }
else if (!strcmp(token,
"off")) {
2627 }
else if (!strcmp(token,
"disable")) {
2636#define free_tristate free_int
2647 if (!strcmp(token,
"on")) {
2652 }
else if (!strcmp(token,
"off")) {
2653 debugs(0,
DBG_PARSE_NOTE(2),
"WARNING: 'pipeline_prefetch off' is deprecated. Please update to use '0'.");
2661#define free_pipelinePrefetch free_int
2662#define dump_pipelinePrefetch dump_int
2667 while (
head !=
nullptr) {
2670 head->printHead(os);
2672 if (
head->max_stale >= 0)
2675 if (
head->flags.refresh_ims)
2678 if (
head->flags.store_stale)
2681#if USE_HTTP_VIOLATIONS
2683 if (
head->flags.override_expire)
2686 if (
head->flags.override_lastmod)
2689 if (
head->flags.reload_into_ims)
2692 if (
head->flags.ignore_reload)
2695 if (
head->flags.ignore_no_store)
2698 if (
head->flags.ignore_private)
2715 int refresh_ims = 0;
2716 int store_stale = 0;
2719#if USE_HTTP_VIOLATIONS
2721 int override_expire = 0;
2722 int override_lastmod = 0;
2723 int reload_into_ims = 0;
2724 int ignore_reload = 0;
2725 int ignore_no_store = 0;
2726 int ignore_private = 0;
2738 debugs(3,
DBG_IMPORTANT,
"WARNING: refresh_pattern minimum age negative. Cropped back to zero.");
2741 if (i > 60*24*365) {
2742 debugs(3,
DBG_IMPORTANT,
"WARNING: refresh_pattern minimum age too high. Cropped back to 1 year.");
2746 min = (time_t) (i * 60);
2754 debugs(3,
DBG_IMPORTANT,
"WARNING: refresh_pattern maximum age negative. Cropped back to zero.");
2757 if (i > 60*24*365) {
2758 debugs(3,
DBG_IMPORTANT,
"WARNING: refresh_pattern maximum age too high. Cropped back to 1 year.");
2762 max = (time_t) (i * 60);
2766 if (!strcmp(token,
"refresh-ims")) {
2768 }
else if (!strcmp(token,
"store-stale")) {
2770 }
else if (!strncmp(token,
"max-stale=", 10)) {
2771 max_stale =
xatoi(token + 10);
2773#if USE_HTTP_VIOLATIONS
2775 }
else if (!strcmp(token,
"override-expire"))
2776 override_expire = 1;
2777 else if (!strcmp(token,
"override-lastmod"))
2778 override_lastmod = 1;
2779 else if (!strcmp(token,
"ignore-no-store"))
2780 ignore_no_store = 1;
2781 else if (!strcmp(token,
"ignore-private"))
2783 else if (!strcmp(token,
"reload-into-ims")) {
2784 reload_into_ims = 1;
2787 }
else if (!strcmp(token,
"ignore-reload")) {
2793 }
else if (!strcmp(token,
"ignore-no-cache") ||
2794 !strcmp(token,
"ignore-must-revalidate") ||
2795 !strcmp(token,
"ignore-auth")
2797 debugs(22,
DBG_PARSE_NOTE(2),
"UPGRADE: refresh_pattern option '" << token <<
"' is obsolete. Remove it.");
2802 pct = pct < 0.0 ? 0.0 : pct;
2817#if USE_HTTP_VIOLATIONS
2819 if (override_expire)
2822 if (override_lastmod)
2825 if (reload_into_ims)
2831 if (ignore_no_store)
2852#if USE_HTTP_VIOLATIONS
2909 *var =
xstrdup((
char *) token);
2912#define dump_eol dump_string
2913#define free_eol free_string
2929#define dump_TokenOrQuotedString dump_string
2930#define free_TokenOrQuotedString free_string
2936 os << name <<
' ' << var <<
" seconds\n";
2942 const auto maxTime = std::numeric_limits<time_t>::max();
2943 const auto seconds = parseTimeLine<std::chrono::seconds>();
2944 if (maxTime < seconds.count())
2945 throw TexcHere(
ToSBuf(
"directive supports time values up to ", maxTime,
" but is given ", seconds.count(),
" seconds"));
2946 *var =
static_cast<time_t
>(seconds.count());
2960 os << name <<
' ' << var <<
" milliseconds\n";
2962 os << name <<
' ' << (var/1000) <<
" seconds\n";
2968 *var = parseTimeLine<std::chrono::milliseconds>().count();
2981 storeAppendPrintf(entry,
"%s %jd nanoseconds\n", name,
static_cast<intmax_t
>(var.count()));
2987 *var = parseTimeLine<std::chrono::nanoseconds>();
2993 *var = std::chrono::nanoseconds::zero();
3062#define free_b_size_t free_size_t
3063#define free_b_ssize_t free_ssize_t
3064#define free_kb_size_t free_size_t
3065#define free_mb_size_t free_size_t
3066#define free_gb_size_t free_size_t
3067#define free_kb_int64_t free_b_int64_t
3109 while (list !=
nullptr) {
3132 return a ==
nullptr;
3135#define free_wordlist wordlistDestroy
3137#define free_uri_whitespace free_int
3148 if (!strcmp(token,
"strip"))
3150 else if (!strcmp(token,
"deny"))
3152 else if (!strcmp(token,
"allow"))
3154 else if (!strcmp(token,
"encode"))
3156 else if (!strcmp(token,
"chop"))
3159 debugs(0,
DBG_PARSE_NOTE(2),
"ERROR: Invalid option '" << token <<
"': 'uri_whitespace' accepts 'strip', 'deny', 'allow', 'encode', and 'chop'.");
3195 *settings =
nullptr;
3216 args = settings->
args;
3258 if (strcmp(token,
"always") == 0) {
3261 }
else if (strcmp(token,
"disk") == 0) {
3264 }
else if (strncmp(token,
"net", 3) == 0) {
3267 }
else if (strcmp(token,
"never") == 0) {
3271 debugs(0,
DBG_PARSE_NOTE(2),
"ERROR: Invalid option '" << token <<
"': 'memory_cache_mode' accepts 'always', 'disk', 'network', and 'never'.");
3291#include "cf_parser.cci"
3296 if (!strcmp(s,
"parent"))
3299 if (!strcmp(s,
"neighbor"))
3302 if (!strcmp(s,
"neighbour"))
3305 if (!strcmp(s,
"sibling"))
3308 if (!strcmp(s,
"multicast"))
3377 char *host =
nullptr;
3378 unsigned short port = 0;
3380 char *junk =
nullptr;
3384 s->connection_auth_disabled =
false;
3388 if (*token ==
'[') {
3391 t = strchr(host,
']');
3393 debugs(3,
DBG_CRITICAL,
"FATAL: " << portType <<
"_port: missing ']' on IPv6 address: " << token);
3400 debugs(3,
DBG_CRITICAL,
"FATAL: " << portType <<
"_port: missing Port in: " << token);
3404 if (!Ip::EnableIpv6) {
3410 }
else if ((t = strchr(token,
':'))) {
3417 }
else if (strtol(token, &junk, 10) && !*junk) {
3419 debugs(3, 3, portType <<
"_port: found Listen on Port: " <<
port);
3426 if (
port == 0 && host !=
nullptr) {
3427 debugs(3,
DBG_CRITICAL,
"FATAL: " << portType <<
"_port: Port cannot be 0: " << token);
3432 if (
nullptr == host) {
3435 if (!Ip::EnableIpv6)
3437 debugs(3, 3, portType <<
"_port: found Listen on wildcard address: *:" << s->s.port());
3438 }
else if ( (s->s = host) ) {
3440 if (!Ip::EnableIpv6)
3442 debugs(3, 3, portType <<
"_port: Listen on Host/IP: " << host <<
" --> " << s->s);
3443 }
else if ( s->s.GetHostByName(host) ) {
3445 s->defaultsite =
xstrdup(host);
3447 if (!Ip::EnableIpv6)
3449 debugs(3, 3, portType <<
"_port: found Listen as Host " << s->defaultsite <<
" on IP: " << s->s);
3451 debugs(3,
DBG_CRITICAL,
"FATAL: " << portType <<
"_port: failed to resolve Host/IP: " << host);
3464 if (value.
cmp(
"HTTP") == 0 || value.
cmp(
"HTTP/1.1") == 0)
3467 if (value.
cmp(
"HTTPS") == 0 || value.
cmp(
"HTTPS/1.1") == 0)
3470 if (value.
cmp(
"FTP") == 0)
3482 if (strcmp(token,
"accel") == 0) {
3483 if (s->flags.isIntercepted()) {
3488 s->flags.accelSurrogate =
true;
3490 }
else if (strcmp(token,
"transparent") == 0 || strcmp(token,
"intercept") == 0) {
3491 if (s->flags.accelSurrogate || s->flags.tproxyIntercept) {
3496 s->flags.natIntercept =
true;
3497 Ip::Interceptor.StartInterception();
3500 debugs(3,
DBG_IMPORTANT,
"Disabling Authentication on port " << s->s <<
" (interception enabled)");
3501 }
else if (strcmp(token,
"tproxy") == 0) {
3502 if (s->flags.natIntercept || s->flags.accelSurrogate) {
3507 s->flags.tproxyIntercept =
true;
3508 Ip::Interceptor.StartTransparency();
3510 debugs(3,
DBG_IMPORTANT,
"Disabling Authentication on port " << s->s <<
" (TPROXY enabled)");
3512 if (s->flags.proxySurrogate) {
3513 debugs(3,
DBG_IMPORTANT,
"Disabling TPROXY Spoofing on port " << s->s <<
" (require-proxy-header enabled)");
3516 if (!Ip::Interceptor.ProbeForTproxy(s->s)) {
3522 }
else if (strcmp(token,
"require-proxy-header") == 0) {
3523 s->flags.proxySurrogate =
true;
3524 if (s->flags.tproxyIntercept) {
3527 debugs(3,
DBG_IMPORTANT,
"Disabling TPROXY Spoofing on port " << s->s <<
" (require-proxy-header enabled)");
3530 }
else if (strncmp(token,
"defaultsite=", 12) == 0) {
3531 if (!s->flags.accelSurrogate) {
3537 s->defaultsite =
xstrdup(token + 12);
3538 }
else if (strcmp(token,
"vhost") == 0) {
3539 if (!s->flags.accelSurrogate) {
3542 s->flags.accelSurrogate =
true;
3544 }
else if (strcmp(token,
"no-vhost") == 0) {
3545 if (!s->flags.accelSurrogate) {
3549 }
else if (strcmp(token,
"vport") == 0) {
3550 if (!s->flags.accelSurrogate) {
3556 }
else if (strncmp(token,
"vport=", 6) == 0) {
3557 if (!s->flags.accelSurrogate) {
3562 s->vport =
xatos(token + 6);
3563 }
else if (strncmp(token,
"protocol=", 9) == 0) {
3564 if (!s->flags.accelSurrogate) {
3570 }
else if (strcmp(token,
"allow-direct") == 0) {
3571 if (!s->flags.accelSurrogate) {
3576 s->allow_direct =
true;
3577 }
else if (strcmp(token,
"act-as-origin") == 0) {
3578 if (!s->flags.accelSurrogate) {
3581 s->actAsOrigin =
true;
3582 }
else if (strcmp(token,
"ignore-cc") == 0) {
3583#if !USE_HTTP_VIOLATIONS
3584 if (!s->flags.accelSurrogate) {
3590 s->ignore_cc =
true;
3591 }
else if (strncmp(token,
"name=", 5) == 0) {
3594 }
else if (strcmp(token,
"no-connection-auth") == 0) {
3595 s->connection_auth_disabled =
true;
3596 }
else if (strcmp(token,
"connection-auth=off") == 0) {
3597 s->connection_auth_disabled =
true;
3598 }
else if (strcmp(token,
"connection-auth") == 0) {
3599 s->connection_auth_disabled =
false;
3600 }
else if (strcmp(token,
"connection-auth=on") == 0) {
3601 s->connection_auth_disabled =
false;
3602 }
else if (strncmp(token,
"disable-pmtu-discovery=", 23) == 0) {
3603 if (!strcmp(token + 23,
"off"))
3605 else if (!strcmp(token + 23,
"transparent"))
3607 else if (!strcmp(token + 23,
"always"))
3613 }
else if (strcmp(token,
"ipv4") == 0) {
3614 if ( !s->s.setIPv4() ) {
3619 }
else if (strcmp(token,
"tcpkeepalive") == 0) {
3620 s->tcp_keepalive.enabled =
true;
3621 }
else if (strncmp(token,
"tcpkeepalive=", 13) == 0) {
3622 char *t = token + 13;
3623 s->tcp_keepalive.enabled =
true;
3624 s->tcp_keepalive.idle =
xatoui(t,
',');
3628 s->tcp_keepalive.interval =
xatoui(t,
',');
3633 s->tcp_keepalive.timeout =
xatoui(t);
3636 }
else if (strcmp(token,
"sslBump") == 0) {
3639 s->flags.tunnelSslBumping =
true;
3640 }
else if (strcmp(token,
"ssl-bump") == 0) {
3641 s->flags.tunnelSslBumping =
true;
3642 }
else if (strncmp(token,
"cert=", 5) == 0) {
3643 s->secure.parse(token);
3644 }
else if (strncmp(token,
"key=", 4) == 0) {
3645 s->secure.parse(token);
3646 }
else if (strncmp(token,
"version=", 8) == 0) {
3649 s->secure.parse(token);
3650 }
else if (strncmp(token,
"options=", 8) == 0) {
3651 s->secure.parse(token);
3652 }
else if (strncmp(token,
"cipher=", 7) == 0) {
3653 s->secure.parse(token);
3654 }
else if (strncmp(token,
"clientca=", 9) == 0) {
3655 s->secure.parse(token);
3656 }
else if (strncmp(token,
"cafile=", 7) == 0) {
3659 s->secure.parse(token);
3660 }
else if (strncmp(token,
"capath=", 7) == 0) {
3661 s->secure.parse(token);
3662 }
else if (strncmp(token,
"crlfile=", 8) == 0) {
3663 s->secure.parse(token);
3664 }
else if (strncmp(token,
"dhparams=", 9) == 0) {
3667 s->secure.parse(token);
3668 }
else if (strncmp(token,
"sslflags=", 9) == 0) {
3670 s->secure.parse(token+3);
3671 }
else if (strncmp(token,
"sslcontext=", 11) == 0) {
3673 s->secure.parse(token+3);
3674 }
else if (strncmp(token,
"generate-host-certificates", 26) == 0) {
3675 s->secure.parse(token);
3677 }
else if (strncmp(token,
"dynamic_cert_mem_cache_size=", 28) == 0) {
3678 s->secure.parse(token);
3679 }
else if (strncmp(token,
"tls-", 4) == 0) {
3680 s->secure.parse(token+4);
3681 }
else if (strcmp(token,
"ftp-track-dirs") == 0) {
3682 s->ftp_track_dirs =
true;
3683 }
else if (strcmp(token,
"worker-queues") == 0) {
3684#if !defined(SO_REUSEADDR)
3685#error missing system #include that #defines SO_* constants
3687#if !defined(SO_REUSEPORT)
3688 throw TexcHere(
ToSBuf(
cfg_directive,
' ', token,
" option requires building Squid where SO_REUSEPORT is supported by the TCP stack"));
3690 s->workerQueues =
true;
3704 assert(s->next ==
nullptr);
3713 if (strcmp(optionName,
"http_port") == 0 ||
3714 strcmp(optionName,
"ascii_port") == 0)
3716 else if (strcmp(optionName,
"https_port") == 0)
3717 protoName =
"HTTPS";
3718 else if (strcmp(optionName,
"ftp_port") == 0)
3741 s->secure.syncCaFiles();
3744 s->secure.encryptTransport =
true;
3747 const bool hijacked = s->flags.isIntercepted();
3748 if (s->flags.tunnelSslBumping && !hijacked) {
3749 debugs(3,
DBG_CRITICAL,
"FATAL: ssl-bump on https_port requires tproxy/intercept which is missing.");
3753 if (hijacked && !s->flags.tunnelSslBumping) {
3754 debugs(3,
DBG_CRITICAL,
"FATAL: tproxy/intercept on https_port requires ssl-bump which is missing.");
3759 if (s->flags.proxySurrogate) {
3760 debugs(3,
DBG_CRITICAL,
"FATAL: https_port: require-proxy-header option is not supported on HTTPS ports.");
3764 }
else if (protoName.
cmp(
"FTP") == 0) {
3766 if (s->flags.tunnelSslBumping) {
3771 if (s->flags.proxySurrogate) {
3773 debugs(3,
DBG_CRITICAL,
"FATAL: require-proxy-header option is not supported on ftp_port.");
3779 if (s->secure.encryptTransport) {
3780 if (s->secure.certs.empty()) {
3785 s->secure.parseOptions();
3790 s->next = s->ipV4clone();
3793 while (*
head !=
nullptr)
3794 head = &((*head)->next);
3809 if (s->flags.natIntercept)
3812 else if (s->flags.tproxyIntercept)
3815 else if (s->flags.proxySurrogate)
3818 else if (s->flags.accelSurrogate) {
3826 else if (s->vport > 0)
3836 if (s->allow_direct)
3849#if USE_HTTP_VIOLATIONS
3850 if (!s->flags.accelSurrogate && s->ignore_cc)
3854 if (s->connection_auth_disabled)
3865 pmtu =
"transparent";
3870 if (s->s.isAnyAddr() && !s->s.isIPv6())
3873 if (s->tcp_keepalive.enabled) {
3874 if (s->tcp_keepalive.idle || s->tcp_keepalive.interval || s->tcp_keepalive.timeout) {
3875 storeAppendPrintf(e,
" tcpkeepalive=%d,%d,%d", s->tcp_keepalive.idle, s->tcp_keepalive.interval, s->tcp_keepalive.timeout);
3882 if (s->flags.tunnelSslBumping)
3887 s->secure.dumpCfg(os,
"tls-");
3926 if (stat(path, &sb) < 0) {
3973 cl->filename =
xstrdup(filename);
3975 if (strcmp(filename,
"none") == 0) {
3979 logs = &(*logs)->
next;
3985 if (token && !strchr(token,
'=')) {
3988 cl->setLogformat(token);
3992 cl->setLogformat(
"squid");
4004 logs = &(*logs)->
next;
4012 return customlog_definitions ==
nullptr;
4023 os <<
' ' <<
log->filename;
4024 log->dumpOptions(os);
4037 while (*definitions) {
4044#if HAVE_CPU_AFFINITY
4047parseNamedIntList(
const char *data,
const String &name, std::vector<int> &list)
4049 if (data && (strncmp(data, name.
rawBuf(), name.
size()) == 0)) {
4050 data += name.
size();
4057 list.push_back(value);
4058 if (*data ==
'\0' || *data !=
',')
4063 return data && *data ==
'\0';
4070#if !HAVE_CPU_AFFINITY
4071 (void)cpuAffinityMap;
4073 "support, do not set 'cpu_affinity_map'");
4077 if (!*cpuAffinityMap)
4082 std::vector<int> processes, cores;
4083 if (!parseNamedIntList(pToken,
"process_numbers", processes)) {
4085 "in 'cpu_affinity_map'");
4087 }
else if (!parseNamedIntList(cToken,
"cores", cores)) {
4089 "'cpu_affinity_map'");
4091 }
else if (!(*cpuAffinityMap)->add(processes, cores)) {
4093 "process_numbers and cores lists differ in length or " <<
4094 "contain numbers <= 0");
4103 if (cpuAffinityMap) {
4105 for (
size_t i = 0; i < cpuAffinityMap->
processes().
size(); ++i) {
4110 for (
size_t i = 0; i < cpuAffinityMap->
cores().
size(); ++i) {
4112 cpuAffinityMap->
cores()[i]);
4121 delete *cpuAffinityMap;
4122 *cpuAffinityMap =
nullptr;
4170 "Use 'adaptation_service_set' instead");
4178 "Use 'adaptation_access' instead");
4215 if (strcmp(token,
"in") != 0) {
4250 if (
char *s = strchr(al,
'{')) {
4273 if (strlen(param) > 64) {
4274 debugs(3,
DBG_CRITICAL,
"FATAL: sslproxy_cert_adapt: setCommonName{" <<param <<
"} : using common name longer than 64 bytes is not supported");
4281 debugs(3,
DBG_CRITICAL,
"FATAL: sslproxy_cert_adapt: unknown cert adaptation algorithm: " << al);
4289 cert_adapt = &(*cert_adapt)->
next;
4291 *cert_adapt = ca.release();
4296 for (
const auto *ca = cert_adapt; ca; ca = ca->
next) {
4308 *cert_adapt =
nullptr;
4327 debugs(3,
DBG_CRITICAL,
"FATAL: sslproxy_cert_sign: unknown cert signing algorithm: " << al);
4335 cert_sign = &(*cert_sign)->
next;
4337 *cert_sign = cs.release();
4342 for (
const auto *cs = cert_sign; cs; cs = cs->
next) {
4354 *cert_sign =
nullptr;
4374 static char buf[1024];
4376 strcpy(buf,
"ssl_bump deny all");
4378 "\"ssl_bump deny all\" to \"ssl_bump none all\". New ssl_bump configurations "
4379 "must not use implicit rules. Update your ssl_bump rules.");
4381 strcpy(buf,
"ssl_bump allow all");
4383 "\"ssl_bump allow all\" to \"ssl_bump client-first all\" which is usually "
4384 "inferior to the newer server-first bumping mode. New ssl_bump"
4385 " configurations must not use implicit rules. Update your ssl_bump rules.");
4393 typedef const char *BumpCfgStyle;
4394 BumpCfgStyle bcsNone =
nullptr;
4395 BumpCfgStyle bcsNew =
"new client/server-first/none";
4396 BumpCfgStyle bcsOld =
"deprecated allow/deny";
4397 static BumpCfgStyle bumpCfgStyleLast = bcsNone;
4398 BumpCfgStyle bumpCfgStyleNow = bcsNone;
4406 if (*ssl_bump ==
nullptr) {
4407 bumpCfgStyleLast = bcsNone;
4415 bumpCfgStyleNow = bcsNew;
4418 bumpCfgStyleNow = bcsNew;
4421 bumpCfgStyleNow = bcsNew;
4424 bumpCfgStyleNow = bcsNew;
4427 bumpCfgStyleNow = bcsNew;
4430 bumpCfgStyleNow = bcsNew;
4433 bumpCfgStyleNow = bcsNew;
4436 bumpCfgStyleNow = bcsNew;
4437 }
else if (strcmp(bm,
"allow") == 0) {
4439 "\"ssl_bump allow <acl>\" to \"ssl_bump client-first <acl>\" which "
4440 "is usually inferior to the newer server-first "
4441 "bumping mode. Update your ssl_bump rules.");
4443 bumpCfgStyleNow = bcsOld;
4445 }
else if (strcmp(bm,
"deny") == 0) {
4447 "\"ssl_bump deny <acl>\" to \"ssl_bump none <acl>\". Update "
4448 "your ssl_bump rules.");
4450 bumpCfgStyleNow = bcsOld;
4458 if (bumpCfgStyleLast != bcsNone && bumpCfgStyleNow != bumpCfgStyleLast) {
4459 debugs(3,
DBG_CRITICAL,
"FATAL: do not mix " << bumpCfgStyleNow <<
" actions with " <<
4460 bumpCfgStyleLast <<
" actions. Update your ssl_bump rules.");
4465 bumpCfgStyleLast = bumpCfgStyleNow;
4491 for (HeaderWithAclList::iterator hwa = headers->begin(); hwa != headers->end(); ++hwa) {
4492 storeAppendPrintf(entry,
"%s %s %s", name, hwa->fieldName.c_str(), hwa->fieldValue.c_str());
4530 (*headers)->push_back(hwa);
4538 for (HeaderWithAclList::iterator hwa = (*header)->begin(); hwa != (*header)->end(); ++hwa) {
4542 if (hwa->valueFormat) {
4543 delete hwa->valueFormat;
4544 hwa->valueFormat =
nullptr;
4569 const auto id =
xatoui(value, eov);
4581 char *key =
nullptr;
4582 char *value =
nullptr;
4584 if (strcmp(key,
"id") == 0) {
4588 }
else if (strcmp(key,
"ids") == 0) {
4591 const auto dash = strchr(value,
'-');
4598 }
else if (strcmp(key,
"level") == 0) {
4601 const auto level =
xatoi(value);
4605 }
else if (strcmp(key,
"limit") == 0) {
4612 key = value =
nullptr;
4619 throw TextException(
"cache_log_message is missing a required id=... or ids=... option",
Here());
4622 throw TextException(
"cache_log_message is missing a required level=... or limit=... option",
Here());
4625 if (!*debugMessages)
4628 for (
auto id = minId;
id <= maxId; ++id) {
4630 (*debugMessages)->messages.at(
id) = msg;
4640 for (
const auto &msg: debugMessages->
messages) {
4641 if (!msg.configured())
4643 out << name <<
" id=" << msg.id;
4645 out <<
" level=" << msg.level;
4647 out <<
" limit=" << msg.limit;
4650 const auto buf = out.
buf();
4651 entry->
append(buf.rawContent(), buf.length());
4658 delete *debugMessages;
4659 *debugMessages =
nullptr;
4666 bool ftpEpsvIsDeprecatedRule =
false;
4674 if (!strcmp(t,
"off")) {
4676 ftpEpsvIsDeprecatedRule =
true;
4678 }
else if (!strcmp(t,
"on")) {
4680 ftpEpsvIsDeprecatedRule =
true;
4690 debugs(3,
DBG_CRITICAL,
"FATAL: do not mix \"ftp_epsv on|off\" cfg lines with \"ftp_epsv allow|deny ...\" cfg lines. Update your ftp_epsv rules.");
4695 if (ftpEpsvIsDeprecatedRule) {
4698 *ftp_epsv =
nullptr;
4701 static const auto all =
new SBuf(
"all");
4729static std::chrono::seconds
4733 if (!timeValueToken)
4734 throw TexcHere(
"cannot read a time value");
4736 using Seconds = std::chrono::seconds;
4738 const auto parsedTimeValue =
xatof(timeValueToken);
4740 if (parsedTimeValue == 0)
4741 return std::chrono::seconds::zero();
4743 std::chrono::nanoseconds parsedUnitDuration;
4746 if (parseTimeUnit<Seconds>(unitToken, parsedUnitDuration))
4749 const auto defaultParsed = parseTimeUnit<Seconds>(
T_SECOND_STR, parsedUnitDuration);
4752 ": WARNING: missing time unit, using deprecated default '" <<
T_SECOND_STR <<
"'");
4755 const auto nanoseconds =
ToNanoSeconds(parsedTimeValue, parsedUnitDuration);
4757 return FromNanoseconds<Seconds>(nanoseconds, parsedTimeValue);
4769 if (strcasecmp(key,
"on_timeout") == 0) {
4770 if (strcasecmp(value,
"bypass") == 0)
4772 else if (strcasecmp(value,
"fail") == 0)
4774 else if (strcasecmp(value,
"retry") == 0)
4776 else if (strcasecmp(value,
"use_configured_response") == 0) {
4783 }
else if (strcasecmp(key,
"response") == 0) {
4793 debugs(3,
DBG_CRITICAL,
"FATAL: Expected 'response=' option after 'on_timeout=use_configured_response' option");
4798 debugs(3,
DBG_CRITICAL,
"FATAL: 'response=' option is valid only when used with the 'on_timeout=use_configured_response' option");
4806 const char *onTimedOutActions[] = {
"bypass",
"fail",
"retry",
"use_configured_response"};
4866 if (strcmp(tm,
"tunnel") == 0)
4868 else if (strcmp(tm,
"respond") == 0)
4883 static const std::vector<const char *> onErrorTunnelMode = {
4890 return onErrorTunnelMode.at(action.
kind);
4906 auto &protoGuards = *protoGuardsPtr;
4918 const SBuf name(rawName);
4921 line.push_back(name);
4922 line.push_back(proto);
4924 line.insert(line.end(), acld.begin(), acld.end());
4933 auto &protoGuards = *protoGuardsPtr;
4935 protoGuards =
nullptr;
const CachePeers & CurrentCachePeers()
#define Here()
source code location of the caller
SBuf TheKidName
current Squid process name (e.g., "squid-coord")
unsigned int xatoui(const char *token, char eov)
double GetPercentage(bool limit)
bool GetHostWithPort(char *token, Ip::Address *ipa)
uint64_t xatoull(const char *token, int base, char eov)
double xatof(const char *token)
unsigned short xatos(const char *token)
bool StringToInt(const char *s, int &result, const char **p, int base)
int64_t GetInteger64(void)
unsigned short GetShort(void)
int xatoi(const char *token)
AnyP::PortCfgPointer HttpPortList
list of Squid http(s)_port configured
#define DefineRunnerRegistrator(ClassName)
SBuf ToUpper(SBuf buf)
Returns a lower-cased copy of its parameter.
#define SQUIDSBUFPRINT(s)
class SquidConfig2 Config2
char * strwordtok(char *buf, char **t)
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
void aclParseAccessLine(const char *directive, ConfigParser &, acl_access **config)
Parses a single line of a "action followed by acls" directive (e.g., http_access).
size_t aclParseAclList(ConfigParser &, ACLList **config, const char *label)
void log(char *format,...)
Acl::TreePointer acl_access
squidaio_request_t * head
static DebugMessageId ParseDebugMessageId(const char *value, const char eov)
static std::chrono::nanoseconds ToNanoSeconds(const double value, const std::chrono::nanoseconds &unit)
static void SetConfigFilename(char const *file_name, bool is_pipe)
void parse_time_t(time_t *var)
static void dump_sslproxy_ssl_bump(StoreEntry *entry, const char *name, acl_access *ssl_bump)
static void free_authparam(Auth::ConfigVector *cfg)
static void dump_cachemgrpasswd(StoreEntry *entry, const char *name, Mgr::ActionPasswordList *list)
static void parse_address(Ip::Address *addr)
static void free_icap_service_failure_limit(Adaptation::Icap::Config *)
static const char *const T_SECOND_STR
static void ReplaceSubstr(char *&str, int &len, unsigned substrIdx, unsigned substrLen, const char *newSubstr)
static void parse_b_size_t(size_t *var)
static int parseOneConfigFile(const char *file_name, unsigned int depth)
static void parse_icap_service_failure_limit(Adaptation::Icap::Config *)
static void free_b_int64_t(int64_t *var)
static void free_int64_t(int64_t *var)
static void free_refreshpattern(RefreshPattern **head)
static void parse_authparam(Auth::ConfigVector *config)
static void dump_SBufList(StoreEntry *entry, const SBufList &words)
static void free_time_nanoseconds(std::chrono::nanoseconds *var)
void free_YesNoNone(YesNoNone *)
static void free_HeaderManglers(HeaderManglers **pm)
static void dump_note(StoreEntry *, const char *, Notes &)
static void free_delay_pool_count(DelayConfig *cfg)
void configFreeMemory(void)
static void free_memcachemode(SquidConfig *)
static void free_time_msec(time_msec_t *var)
static void parse_b_ssize_t(ssize_t *var)
static void dump_cache_log_message(StoreEntry *entry, const char *name, const DebugMessages *messages)
static void free_time_t(time_t *var)
static void dump_configuration_includes_quoted_values(StoreEntry *const entry, const char *const name, bool recognizeQuotedValues)
static void parse_client_delay_pool_count(ClientDelayConfig *cfg)
static void parse_adaptation_service_set_type()
static void parse_ftp_epsv(acl_access **ftp_epsv)
static void parse_string(char **)
static const char *const T_MONTH_STR
static void parse_port_option(AnyP::PortCfgPointer &s, char *token)
static void dump_removalpolicy(StoreEntry *entry, const char *name, RemovalPolicySettings *settings)
static const char *const B_MBYTES_STR
static void parse_acl_access(acl_access **head)
static void free_http_upgrade_request_protocols(HttpUpgradeProtocolAccess **protoGuards)
static void free_AuthSchemes(acl_access **authSchemes)
static void free_ecap_service_type(Adaptation::Ecap::Config *)
static void ParseAclWithAction(acl_access **access, const Acl::Answer &action, const char *desc, Acl::Node *acl=nullptr)
static void dump_AuthSchemes(StoreEntry *entry, const char *name, acl_access *authSchemes)
static void free_client_delay_pool_count(ClientDelayConfig *cfg)
static void parse_adaptation_access_type()
static void dump_PortCfg(StoreEntry *, const char *, const AnyP::PortCfgPointer &)
static void dump_ecap_service_type(StoreEntry *, const char *, const Adaptation::Ecap::Config &)
static const char *const T_WEEK_STR
static void dump_delay_pool_count(StoreEntry *entry, const char *name, DelayConfig &cfg)
static void dump_b_ssize_t(StoreEntry *entry, const char *name, ssize_t var)
static int parse_line(char *)
static void defaults_postscriptum(void)
static void parse_configuration_includes_quoted_values(bool *recognizeQuotedValues)
static void free_SBufList(SBufList *list)
static void parse_adaptation_service_chain_type()
static void SubstituteMacro(char *&line, int &len, const char *macroName, const char *substStr)
static void dump_refreshpattern(StoreEntry *entry, const char *name, RefreshPattern *head)
static void parse_icap_service_type(Adaptation::Icap::Config *)
static void parse_time_msec(time_msec_t *var)
static void free_removalpolicy(RemovalPolicySettings **settings)
void parse_onoff(int *var)
static void parse_obsolete(const char *)
static void dump_b_size_t(StoreEntry *entry, const char *name, size_t var)
static void dump_client_delay_pool_count(StoreEntry *entry, const char *name, ClientDelayConfig &cfg)
static void ProcessMacros(char *&line, int &len)
static AnyP::ProtocolVersion parsePortProtocol(const SBuf &value)
static void dump_time_t(StoreEntry *entry, const char *name, time_t var)
static void free_size_t(size_t *var)
static void free_note(Notes *)
static void dump_tristate(StoreEntry *entry, const char *name, int var)
static bool StrToInt(const char *str, long &number)
static void parse_kb_int64_t(int64_t *var)
static void free_acl(Acl::NamedAcls **config)
static void default_all(void)
static const char *const T_DECADE_STR
static int parseManyConfigFiles(char *files, int depth)
static void dump_http_header_replace(StoreEntry *entry, const char *name, const HeaderManglers *manglers)
static int check_null_acl_access(acl_access *a)
void add_http_port(char *portspec)
static void dump_sslproxy_cert_sign(StoreEntry *entry, const char *name, sslproxy_cert_sign *cert_sign)
static void free_acl_access(acl_access **head)
static void dump_memcachemode(StoreEntry *entry, const char *name, SquidConfig &)
static void free_CpuAffinityMap(CpuAffinityMap **const cpuAffinityMap)
static const char *const T_HOUR_STR
static void parse_removalpolicy(RemovalPolicySettings **settings)
static void free_all(void)
static void parse_TokenOrQuotedString(char **var)
static void parse_http_upgrade_request_protocols(HttpUpgradeProtocolAccess **protoGuards)
static void dump_int(StoreEntry *entry, const char *name, int var)
static bool EvalBoolExpr(const char *expr)
static void dump_u_short(StoreEntry *entry, const char *name, unsigned short var)
static void parse_on_unsupported_protocol(acl_access **access)
static void DumpDirective(const T &raw, StoreEntry *entry, const char *name)
static const char *const B_GBYTES_STR
static void parse_peer(CachePeers **peers)
static void parse_AuthSchemes(acl_access **authSchemes)
static void dump_sslproxy_cert_adapt(StoreEntry *entry, const char *name, sslproxy_cert_adapt *cert_adapt)
static void parse_delay_pool_access(DelayConfig *cfg)
static void free_acl_address(Acl::Address **head)
static void free_on_unsupported_protocol(acl_access **access)
void parse_wordlist(wordlist **list)
static void parse_cachemgrpasswd(Mgr::ActionPasswordList **head)
static void free_ssize_t(ssize_t *var)
static void parse_icap_class_type()
static void parseBytesLine64(int64_t *bptr, const char *units)
static void parse_access_log(CustomLog **customlog_definitions)
void requirePathnameExists(const char *name, const char *path)
static void free_acl_b_size_t(AclSizeLimit **head)
static void parse_refreshpattern(RefreshPattern **)
static void free_u_short(unsigned short *u)
static void parse_http_header_replace(HeaderManglers **manglers)
static void parse_sslproxy_ssl_bump(acl_access **ssl_bump)
static void free_IpAddress_list(Ip::Address_list **)
static void dump_icap_service_type(StoreEntry *, const char *, const Adaptation::Icap::Config &)
static void parse_time_nanoseconds(std::chrono::nanoseconds *var)
static const char *const T_MILLISECOND_STR
void parse_eol(char *volatile *var)
static void free_icap_service_type(Adaptation::Icap::Config *)
static void parse_pipelinePrefetch(int *var)
const char * cfg_directive
During parsing, the name of the current squid.conf directive being parsed.
static void dump_authparam(StoreEntry *entry, const char *name, Auth::ConfigVector cfg)
static bool IsSpace(const char ch)
static void dump_string(StoreEntry *entry, const char *name, char *var)
static void trim_trailing_ws(char *str)
static void FreeDirective(T &raw)
frees any resources associated with the given raw SquidConfig data member
static void dump_UrlHelperTimeout(StoreEntry *, const char *, SquidConfig::UrlHelperTimeout &)
static void parse_ecap_service_type(Adaptation::Ecap::Config *)
static void free_cachemgrpasswd(Mgr::ActionPasswordList **head)
static void dump_denyinfo(StoreEntry *entry, const char *name, AclDenyInfoList *var)
static const char *const B_KBYTES_STR
static void dump_http_header_access(StoreEntry *entry, const char *name, const HeaderManglers *manglers)
static void dump_wordlist(StoreEntry *entry, const char *name, wordlist *list)
static void free_int(int *var)
static const char *const T_YEAR_STR
static const char *const T_MINUTE_STR
char config_input_line[BUFSIZ]
static void free_acl_tos(acl_tos **head)
const char * cfg_filename
static void parse_memcachemode(SquidConfig *)
static bool FtpEspvDeprecated
static void parse_hostdomaintype(void)
static int check_null_string(char *s)
static void free_address(Ip::Address *addr)
static void dump_on_unsupported_protocol(StoreEntry *entry, const char *name, acl_access *access)
static const char *const T_FORTNIGHT_STR
static void dump_cachedir(StoreEntry *entry, const char *name, const Store::DiskConfig &swap)
static int check_null_access_log(CustomLog *customlog_definitions)
static const char * FindStatement(const char *line, const char *statement)
static bool SawDirective(const T &raw)
whether we have seen (and, hence, configured) the given directive
static void parseBytesLine(size_t *bptr, const char *units)
static void dump_IpAddress_list(StoreEntry *, const char *, const Ip::Address_list *)
static void dump_access_log(StoreEntry *entry, const char *name, CustomLog *definitions)
static void dump_http_upgrade_request_protocols(StoreEntry *entry, const char *name, HttpUpgradeProtocolAccess *protoGuards)
static void parse_client_delay_pool_rates(ClientDelayConfig *cfg)
static void free_access_log(CustomLog **definitions)
static void parse_sslproxy_cert_sign(sslproxy_cert_sign **cert_sign)
static void parse_peer_access(void)
static ConfigParser LegacyParser
static void parseBytesLineSigned(ssize_t *bptr, const char *units)
static void dump_HeaderWithAclList(StoreEntry *entry, const char *name, HeaderWithAclList *headers)
static void parse_cache_log_message(DebugMessages **messages)
static void dump_acl(StoreEntry *entry, const char *directiveName, Acl::NamedAcls *config)
static void parse_acl_address(Acl::Address **head)
static const char *const T_MICROSECOND_STR
static void dump_int64_t(StoreEntry *entry, const char *name, int64_t var)
static void dump_address(StoreEntry *entry, const char *name, Ip::Address &addr)
static void free_cache_log_message(DebugMessages **messages)
static void parse_UrlHelperTimeout(SquidConfig::UrlHelperTimeout *)
static void parse_http_header_access(HeaderManglers **manglers)
static void parse_b_int64_t(int64_t *var)
static const char *const B_BYTES_STR
static void dump_peer(StoreEntry *entry, const char *name, const CachePeers *peers)
static void dump_acl_address(StoreEntry *entry, const char *name, Acl::Address *head)
static void free_peer(CachePeers **const peers)
static size_t parseBytesUnits(const char *unit)
static void parse_delay_pool_class(DelayConfig *cfg)
static void free_sslproxy_cert_adapt(sslproxy_cert_adapt **cert_adapt)
static void free_ftp_epsv(acl_access **ftp_epsv)
static bool parseTimeUnit(const char *unitName, std::chrono::nanoseconds &ns)
static void parse_u_short(unsigned short *var)
static const char *const T_NANOSECOND_STR
static void free_sslproxy_ssl_bump(acl_access **ssl_bump)
static void dump_time_msec(StoreEntry *entry, const char *name, time_msec_t var)
static const double HoursPerYear
static void free_denyinfo(AclDenyInfoList **var)
static void free_UrlHelperTimeout(SquidConfig::UrlHelperTimeout *)
void parseBytesOptionValue(size_t *bptr, const char *units, char const *value)
Parse bytes number from a string.
static const char * peer_type_str(const peer_t type)
static const char *const T_DAY_STR
static void dump_uri_whitespace(StoreEntry *entry, const char *name, int var)
static void dump_icap_service_failure_limit(StoreEntry *, const char *, const Adaptation::Icap::Config &)
static void parse_denyinfo(AclDenyInfoList **var)
static void free_string(char **var)
static unsigned short GetService(const char *proto)
static TimeUnit parseTimeLine()
static void parse_CpuAffinityMap(CpuAffinityMap **const cpuAffinityMap)
static void parse_SBufList(SBufList *list)
static void parse_tristate(int *var)
static void parsePortCfg(AnyP::PortCfgPointer *, const char *protocol)
static void dump_kb_int64_t(StoreEntry *entry, const char *name, int64_t var)
static void parse_YesNoNone(YesNoNone *option)
static void dump_time_nanoseconds(StoreEntry *entry, const char *name, const std::chrono::nanoseconds &var)
static void free_sslproxy_cert_sign(sslproxy_cert_sign **cert_sign)
static void parse_delay_pool_count(DelayConfig *cfg)
static void dump_b_int64_t(StoreEntry *entry, const char *name, int64_t var)
static void parse_delay_pool_rates(DelayConfig *cfg)
static void dump_acl_tos(StoreEntry *entry, const char *name, acl_tos *head)
static void parse_acl_b_size_t(AclSizeLimit **head)
static void dump_onoff(StoreEntry *entry, const char *name, int var)
static void parse_uri_whitespace(int *var)
static bool isUnsignedNumeric(const char *str, size_t len)
static void ParseDirective(T &raw, ConfigParser &parser)
static peer_t parseNeighborType(const char *s)
static void parse_IpAddress_list(Ip::Address_list **)
static void parse_icap_access_type()
static TimeUnit FromNanoseconds(const std::chrono::nanoseconds &ns, const double parsedValue)
static void parse_acl(Acl::NamedAcls **config)
static void dump_generic_port(StoreEntry *e, const char *n, const AnyP::PortCfgPointer &s)
static void parse_HeaderWithAclList(HeaderWithAclList **header)
static void parsePortSpecification(const AnyP::PortCfgPointer &s, char *token)
static const char * skip_ws(const char *s)
static const char * TimeUnitToString()
static std::chrono::seconds ParseUrlRewriteTimeout()
static void parse_client_delay_pool_access(ClientDelayConfig *cfg)
static void free_configuration_includes_quoted_values(bool *recognizeQuotedValues)
static void parse_int64_t(int64_t *var)
static void parse_cachedir(Store::DiskConfig *swap)
static void parse_note(Notes *)
static void dump_ftp_epsv(StoreEntry *entry, const char *name, acl_access *ftp_epsv)
unsigned short GetUdpService(void)
static void parse_sslproxy_cert_adapt(sslproxy_cert_adapt **cert_adapt)
static void free_HeaderWithAclList(HeaderWithAclList **header)
static void dump_acl_b_size_t(StoreEntry *entry, const char *name, AclSizeLimit *head)
static void defaults_if_none(void)
static void parse_acl_tos(acl_tos **head)
static void dump_CpuAffinityMap(StoreEntry *const entry, const char *const name, const CpuAffinityMap *const cpuAffinityMap)
static void configDoConfigure(void)
static void dump_YesNoNone(StoreEntry *entry, const char *name, YesNoNone &option)
unsigned short GetTcpService(void)
static int ThePurgeCount
PURGE methods seen by parse()
deny_info representation. Currently a POD.
SBufList acl_list
ACL names in configured order.
representation of a class of Size-limit ACLs
list of address-based ACLs.
int kind
the matched custom access list verb (or zero)
void add(Acl::Node *node)
appends the node to the collection and takes control over it
parsed "acl aclname ..." directives indexed by aclname
void context(const SBuf &aName, const char *configuration)
sets user-specified ACL name and squid.conf context
static void ParseNamedAcl(ConfigParser &, NamedAcls *&)
parses acl directive parts that follow directive name (i.e. "acl")
static Acl::Node * FindByName(const SBuf &)
A configured ACL with a given name or nil.
SBufList treeDump(const char *name, ActionToStringConverter converter) const
time_t oldest_service_failure
static void ParseServiceSet(void)
static void ParseAccess(ConfigParser &parser)
void dumpService(StoreEntry *, const char *) const
int service_failure_limit
static void ParseServiceChain(void)
General eCAP configuration.
std::vector< Auth::SchemesConfig > schemeLists
set of auth_schemes directives
virtual bool active() const =0
virtual void parse(SchemeConfig *, size_t, char *)
static SchemeConfig * Find(const char *proxy_auth)
static Scheme::Pointer Find(const char *)
cache_peer configuration storage
void add(CachePeer *p)
stores a being-configured cache_peer
static const CharacterSet WSP
void parsePoolAccess(ConfigParser &parser)
void dumpPoolCount(StoreEntry *entry, const char *name) const
static void DisableMacros()
Do not allow macros inside quoted strings.
static SBuf CurrentLocation()
void rejectDuplicateDirective()
rejects configuration due to a repeated directive
static char * NextQuotedToken()
static char * NextQuotedOrToEol()
std::unique_ptr< RegexPattern > regex(const char *expectedRegexDescription)
extracts and returns a regex (including any optional flags)
static bool RecognizeQuotedValues
configuration_includes_quoted_values in squid.conf
static char * PeekAtToken()
void closeDirective()
stops parsing the current configuration directive
static bool NextKvPair(char *&key, char *&value)
static bool LastTokenWasQuoted()
static void ParseUShort(unsigned short *var)
CachePeer & cachePeer(const char *peerNameTokenDescription)
extracts a cache_peer name token and returns the corresponding CachePeer
static void ParseBool(bool *var)
static char * NextToken()
static void EnableMacros()
Allow macros inside quoted strings.
static void ParseWordList(wordlist **list)
static void Free(T)
destroys Parse() result
static T Parse(ConfigParser &)
creates a new T instance using the given parser; never returns nil
static void Print(std::ostream &, const T &)
reports the current T instance configuration in squid.conf format
stores cpu_affinity_map configuration
const std::vector< int > & processes() const
returns list of process numbers
const std::vector< int > & cores() const
returns list of cores
CustomLog * next
next _log line (if any); maintained by cache_cf.cc
manages configurable aspects of a debugs() message
uint64_t limit
logging attempts beyond this limit are logged at the DBG_DATA level
DebugMessageId id
message identifier or, if the message has not been configured, zero
bool limited() const
whether the number of logging attempts have been limited
bool levelled() const
whether the default logging level of this message has been altered
int level
debugging level (i.e., the second debugs() parameter) or -1
a collection of DebugMessage objects (with fast access by message IDs)
static std::ostream & Extra(std::ostream &)
void dumpPoolCount(StoreEntry *entry, const char *name) const
void parsePoolAccess(ConfigParser &parser)
Allows or blocks HTTP Upgrade protocols (see http_upgrade_request_protocols)
void forEach(const Visitor &) const
iterates over all configured rules, calling the given visitor
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
void setEmpty()
Fast reset of the stored content to what would be after default constructor.
bool GetHostByName(const char *s)
void setAnyAddr()
NOTE: Does NOT clear the Port stored. Only the Address and Type.
static NfMarkConfig Parse(const SBuf &token)
parses a token and returns an object, expects a "mark[/mask]" format
list of cachemgr password authorization definitions. Currently a POD.
ActionPasswordList * next
representation of a neighbor_type_domain configuration directive. A POD
NeighborTypeDomainList * next
Note::Pointer parse(ConfigParser &parser)
Parses a notes line and returns a pointer to the parsed Note object.
void clean()
clean the notes list
void printAsNoteDirectives(StoreEntry *, const char *directiveName) const
Prints notes using "note" squid.conf directive format, one directive per stored note.
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
a representation of a refresh pattern.
struct RefreshPattern::@72 flags
SBuf buf()
bytes written so far
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
SBuf & append(const SBuf &S)
A combination of PeerOptions and the corresponding Context.
Security::ContextPointer createClientContext(bool setOptions)
generate a security client-context from these configured options
virtual void parse(const char *)
parse a TLS squid.conf option
struct SquidConfig2::@102 onoff
the representation of the configuration. POD.
int cache_miss_revalidate
Helper::ChildConfig redirectChildren
size_t maxRequestBufferSize
struct SquidConfig::@99 ssl_client
struct SquidConfig::@82 Log
char * foreignIntermediateCertsPath
Helper::ChildConfig storeIdChildren
size_t maxReplyHeaderSize
struct SquidConfig::@83 Program
struct SquidConfig::@77 Timeout
Security::ContextPointer * sslContext_
Security::FuturePeerContext * defaultPeerContext
struct SquidConfig::@90 onoff
size_t maxRequestHeaderSize
struct SquidConfig::@93 icons
struct SquidConfig::@84 Accel
int pipeline_max_prefetch
struct SquidConfig::@88 Store
int httpd_suppress_version_string
void append(char const *, int) override
Appends a c-string to existing packed data.
static void Dump(const DiskConfig &, StoreEntry &, const char *name)
prints the configuration into the provided StoreEntry
static void Parse(DiskConfig &)
parses a single cache_dir configuration line
static size_type SizeMaxXXX()
void assign(const char *str, int len)
char const * rawBuf() const
char const * termedBuf() const
an std::runtime_error with thrower location info
void configure(bool beSet)
enables or disables the option; updating to 'configured' state
Ip::NfMarkConfig markConfig
void finalizeConfig() override
static Ssl::BumpMode lastDeprecatedRule
sslproxy_cert_adapt * next
sslproxy_cert_sign * next
A const & max(A const &lhs, A const &rhs)
A const & min(A const &lhs, A const &rhs)
constexpr DebugMessageId DebugMessageIdUpperBound
The maximum used DebugMessage::id plus 1. Increase as you add new IDs.
size_t DebugMessageId
an identifier for messages supporting configuration via cache_log_message
#define DBG_PARSE_NOTE(x)
#define debugs(SECTION, LEVEL, CONTENT)
#define URI_WHITESPACE_CHOP
#define URI_WHITESPACE_STRIP
#define URI_WHITESPACE_DENY
#define URI_WHITESPACE_ALLOW
#define URI_WHITESPACE_ENCODE
@ DISABLE_PMTU_TRANSPARENT
void fatal(const char *message)
void fatalf(const char *fmt,...)
char ThisCache2[RFC2181_MAXHOSTNAMELEN<< 1]
char const * visible_appname_string
char ThisCache[RFC2181_MAXHOSTNAMELEN<< 1]
const char * appname_string
void aclDestroyAccessList(acl_access **list)
void dump_acl_list(StoreEntry *entry, ACLList *head)
void aclDestroyAclList(ACLList **list)
void aclParseDenyInfoLine(AclDenyInfoList **head)
void dump_acl_access(StoreEntry *entry, const char *name, acl_access *head)
void useSquidUntrusted(SSL_CTX *sslContext)
std::vector< const char * > BumpModeStr
bool loadSquidUntrusted(const char *path)
void unloadSquidUntrusted()
const char * sslCertAdaptAlgoritm(int alg)
const char * CertAdaptAlgorithmStr[]
const char * certSignAlgorithm(int sg)
const char * CertSignAlgorithmStr[]
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
const char * AllowOrDeny(const Answer &action)
void DumpNamedAcls(std::ostream &, const char *directiveName, NamedAcls *)
report the given list of "acl" directives (using squid.conf syntax)
void FreeNamedAcls(NamedAcls **)
delete the given list of "acl" directives
const char * ProtocolType_str[]
void Init(void)
Initialize Auth subsystem.
std::vector< Auth::SchemeConfig * > ConfigVector
void Parse()
interprets (and partially applies) squid.conf or equivalent configuration
bool ResolveClientAddressesAsap
whether to do reverse DNS lookups for source IPs of accepted connections
AnyP::ProtocolVersion ProtocolVersion()
Protocol version to use in Http::Message structures wrapping FTP messages.
AnyP::ProtocolVersion ProtocolVersion()
const HeaderLookupTable_t HeaderLookupTable
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
std::shared_ptr< SSL_CTX > ContextPointer
PeerOptions & ProxyOutgoingConfig()
configuration options for DIRECT server access
CachePeer * findCachePeerByName(const char *const name)
cache_peer with a given name (or nil)
void dump_peer_options(StoreEntry *sentry, CachePeer *p)
const char * neighborTypeStr(const CachePeer *p)
void peerClearRRStart(void)
struct servent * xgetservbyname(const char *name, const char *proto)
POSIX getservbyname(3) equivalent.
@ toutActUseConfiguredResponse
void rfc1738_unescape(char *url)
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
std::list< SBuf > SBufList
#define LOCAL_ARRAY(type, name, size)
#define SQUID_UDP_SO_SNDBUF
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
void storeConfigure(void)
struct squidaio_request_t * next
const char * xitoa(int num)
const char * wordlistAdd(wordlist **list, const char *key)
void wordlistDestroy(wordlist **list)
destroy a wordlist
void * xrealloc(void *s, size_t sz)
void * xcalloc(size_t n, size_t sz)
const char * xstrerr(int error)
char * xstrncpy(char *dst, const char *src, size_t n)
bool xstrtoui(const char *s, char **end, unsigned int *value, unsigned int min, unsigned int max)