#include "SwapDir.h"
#include "ConfigParser.h"
#include "acl/Acl.h"
+#include "acl/MethodData.h"
#include "acl/Gadgets.h"
#include "StoreFileSystem.h"
#include "Parsing.h"
configFreeMemory();
+ ACLMethodData::ThePurgeCount = 0;
default_all();
err_count = parseOneConfigFile(file_name, 0);
#endif
- // we have reconfigured and in the process disabled any need for PURGE.
- // turn it off now.
- if(Config2.onoff.enable_purge == 2)
- Config2.onoff.enable_purge = 0;
+ // 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();
return 0; /* NEVER REACHED */
}
/** Returns either the service port number from /etc/services */
- if( !isUnsignedNumeric(token, strlen(token)) )
+ 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);
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;