#include "SwapDir.h"
#include "ConfigParser.h"
#include "acl/Acl.h"
+#include "acl/MethodData.h"
#include "acl/Gadgets.h"
#include "StoreFileSystem.h"
#include "Parsing.h"
#include "adaptation/Config.h"
static void parse_adaptation_service_set_type();
+static void parse_adaptation_service_chain_type();
static void parse_adaptation_access_type();
#endif
configFreeMemory();
+ ACLMethodData::ThePurgeCount = 0;
default_all();
err_count = parseOneConfigFile(file_name, 0);
memConfigure();
/* Sanity checks */
+ if (Debug::rotateNumber < 0) {
+ Debug::rotateNumber = Config.Log.rotateNumber;
+ }
+
#if SIZEOF_OFF_T <= 4
if (Config.Store.maxObjectSize > 0x7FFF0000) {
debugs(3, 0, "WARNING: This Squid binary can not handle files larger than 2GB. Limiting maximum_object_size to just below 2GB");
}
for (R = Config.Refresh; R; R = R->next) {
- if (!R->flags.ignore_must_revalidate)
- continue;
- debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP");
- break;
+ if (!R->flags.ignore_must_revalidate)
+ continue;
+ debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP");
+ break;
}
for (R = Config.Refresh; R; R = R->next) {
#endif
- if (aclPurgeMethodInUse(Config.accessList.http))
- Config2.onoff.enable_purge = 1;
+ // we enable runtime PURGE checks if there is at least one PURGE method ACL
+ // TODO: replace with a dedicated "purge" ACL option?
+ Config2.onoff.enable_purge = (ACLMethodData::ThePurgeCount > 0);
Config2.onoff.mangle_request_headers = httpReqHdrManglersConfigured();
}
}
+/**
+ * utility function to prevent getservbyname() being called with a numeric value
+ * on Windows at least it returns garage results.
+ */
+static bool
+isUnsignedNumeric(const char *str, size_t len)
+{
+ if (len < 1) return false;
+
+ for (; len >0 && *str; str++, len--) {
+ if (! isdigit(*str))
+ return false;
+ }
+ return true;
+}
+
/**
\param proto 'tcp' or 'udp' for protocol
\returns Port the named service is supposed to be listening on.
return 0; /* NEVER REACHED */
}
/** Returns either the service port number from /etc/services */
- port = getservbyname(token, proto);
+ if ( !isUnsignedNumeric(token, strlen(token)) )
+ port = getservbyname(token, proto);
if (port != NULL) {
return ntohs((u_short)port->s_port);
}
storeAppendPrintf(entry, "\n");
}
+static void
+free_memcachemode(SquidConfig * config)
+{
+ return;
+}
+
+static void
+parse_memcachemode(SquidConfig * config)
+{
+ char *token = strtok(NULL, w_space);
+ if (!token)
+ self_destruct();
+
+ if (strcmp(token, "always") == 0) {
+ Config.onoff.memory_cache_first = 1;
+ Config.onoff.memory_cache_disk = 1;
+ } else if (strcmp(token, "disk") == 0) {
+ Config.onoff.memory_cache_first = 0;
+ Config.onoff.memory_cache_disk = 1;
+ } else if (strncmp(token, "net", 3) == 0) {
+ Config.onoff.memory_cache_first = 1;
+ Config.onoff.memory_cache_disk = 0;
+ } else if (strcmp(token, "never") == 0) {
+ Config.onoff.memory_cache_first = 0;
+ Config.onoff.memory_cache_disk = 0;
+ } else
+ self_destruct();
+}
+
+static void
+dump_memcachemode(StoreEntry * entry, const char *name, SquidConfig &config)
+{
+ storeAppendPrintf(entry, "%s ", name);
+ if (Config.onoff.memory_cache_first && Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "always");
+ else if (!Config.onoff.memory_cache_first && Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "disk");
+ else if (Config.onoff.memory_cache_first && !Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "network");
+ else if (!Config.onoff.memory_cache_first && !Config.onoff.memory_cache_disk)
+ storeAppendPrintf(entry, "none");
+ storeAppendPrintf(entry, "\n");
+}
+
#include "cf_parser.h"
peer_t
if (NULL == host) {
s->s.SetAnyAddr();
s->s.SetPort(port);
- debugs(3, 3, "http(s)_port: found Listen on wildcard address: " << s->s);
+ debugs(3, 3, "http(s)_port: found Listen on wildcard address: *:" << s->s.GetPort() );
} else if ( s->s = host ) { /* check/parse numeric IPA */
s->s.SetPort(port);
debugs(3, 3, "http(s)_port: Listen on Host/IP: " << host << " --> " << s->s);
s->accel = 1;
} else if (strcmp(token, "accel") == 0) {
s->accel = 1;
+ } else if (strcmp(token, "allow-direct") == 0) {
+ s->allow_direct = 1;
} else if (strcmp(token, "no-connection-auth") == 0) {
s->connection_auth_disabled = true;
} else if (strcmp(token, "connection-auth=off") == 0) {
add_http_port(char *portspec)
{
http_port_list *s = create_http_port(portspec);
+ // we may need to merge better of the above returns a list with clones
+ assert(s->next == NULL);
s->next = Config.Sockaddr.http;
Config.Sockaddr.http = s;
}
+#if IPV6_SPECIAL_SPLITSTACK
+http_port_list *
+clone_http_port_list(http_port_list *a)
+{
+ http_port_list *b = new http_port_list(a->protocol);
+
+ b->s = a->s;
+ if (a->name)
+ b->name = xstrdup(a->name);
+ if (a->defaultsite)
+ b->defaultsite = xstrdup(a->defaultsite);
+
+ b->intercepted = a->intercepted;
+ b->spoof_client_ip = a->spoof_client_ip;
+ b->accel = a->accel;
+ b->allow_direct = a->allow_direct;
+ b->vhost = a->vhost;
+ b->sslBump = a->sslBump;
+ b->vport = a->vport;
+ b->connection_auth_disabled = a->connection_auth_disabled;
+ b->disable_pmtu_discovery = a->disable_pmtu_discovery;
+
+ memcpy( &(b->tcp_keepalive), &(a->tcp_keepalive), sizeof(a->tcp_keepalive));
+
+#if 0
+ // AYJ: 2009-07-18: for now SSL does not clone. Configure separate ports with IPs and SSL settings
+
+#if USE_SSL
+ // XXX: temporary hack to ease move of SSL options to http_port
+ http_port_list &http;
+
+ char *cert;
+ char *key;
+ int version;
+ char *cipher;
+ char *options;
+ char *clientca;
+ char *cafile;
+ char *capath;
+ char *crlfile;
+ char *dhfile;
+ char *sslflags;
+ char *sslcontext;
+ SSL_CTX *sslContext;
+#endif
+
+#endif /*0*/
+
+ return b;
+}
+#endif
+
static void
parse_http_port_list(http_port_list ** head)
{
parse_http_port_option(s, token);
}
+#if IPV6_SPECIAL_SPLITSTACK
+ if (s->s.IsAnyAddr()) {
+ // clone the port options from *s to *(s->next)
+ s->next = clone_http_port_list(s);
+ s->next->s.SetIPv4();
+ debugs(3, 3, "http(s)_port: clone wildcard address for split-stack: " << s->s << " and " << s->next->s);
+ }
+#endif
+
while (*head)
head = &(*head)->next;
cl->type = CLF_SQUID;
} else if (strcmp(logdef_name, "common") == 0) {
cl->type = CLF_COMMON;
+#if ICAP_CLIENT
+ } else if (strcmp(logdef_name, "icap_squid") == 0) {
+ cl->type = CLF_ICAP_SQUID;
+#endif
} else {
debugs(3, 0, "Log format '" << logdef_name << "' is not defined");
self_destruct();
case CLF_COMMON:
storeAppendPrintf(entry, "%s squid", log->filename);
break;
-
+#if ICAP_CLIENT
+ case CLF_ICAP_SQUID:
+ storeAppendPrintf(entry, "%s icap_squid", log->filename);
+ break;
+#endif
case CLF_AUTO:
if (log->aclList)
Adaptation::Config::ParseServiceSet();
}
+static void
+parse_adaptation_service_chain_type()
+{
+ Adaptation::Config::ParseServiceChain();
+}
+
static void
parse_adaptation_access_type()
{