/*
- * $Id: cache_cf.cc,v 1.112 1996/10/17 18:09:47 wessels Exp $
+ * $Id: cache_cf.cc,v 1.113 1996/10/24 05:07:16 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
parseAddressLine(struct in_addr *addr)
{
char *token;
- ipcache_addrs *ia = NULL;
+ struct hostent *hp;
token = strtok(NULL, w_space);
if (token == NULL)
self_destruct();
if (inet_addr(token) != INADDR_NONE)
(*addr).s_addr = inet_addr(token);
- else if ((ia = ipcache_gethostbyname(token, IP_BLOCKING_LOOKUP)))
- *addr = ia->in_addrs[0];
+ else if ((hp = gethostbyname(token))) /* dont use ipcache */
+ *addr = inaddrFromHostent(hp);
else
self_destruct();
}
return;
safe_free(Config.Announce.file);
Config.Announce.file = xstrdup(token);
+ Config.Announce.on = 1;
}
static void
Config.Announce.port = DefaultAnnouncePort;
Config.Announce.file = safe_xstrdup(DefaultAnnounceFile);
Config.Announce.rate = DefaultAnnounceRate;
+ Config.Announce.on = 0;
Config.tcpRcvBufsz = DefaultTcpRcvBufsz;
Config.Addrs.tcp_outgoing.s_addr = DefaultTcpOutgoingAddr;
Config.Addrs.tcp_incoming.s_addr = DefaultTcpIncomingAddr;
/*
- * $Id: debug.cc,v 1.31 1996/10/14 21:28:09 wessels Exp $
+ * $Id: debug.cc,v 1.32 1996/10/24 05:07:17 wessels Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
debugArg(s);
xfree(p);
}
+ if (opt_read_only)
+ return;
debugOpenLog(logfile);
#if HAVE_SYSLOG && defined(LOG_LOCAL4)
/*
- * $Id: fqdncache.cc,v 1.27 1996/10/11 23:11:54 wessels Exp $
+ * $Id: fqdncache.cc,v 1.28 1996/10/24 05:07:18 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
f->name = xstrdup(name);
if (cached) {
f->name_count = 0;
- f->names[f->name_count++] = xstrdup(hp->h_name);
+ f->names[f->name_count++] = xstrdup((char *)hp->h_name);
for (k = 0; hp->h_aliases[k]; k++) {
f->names[f->name_count++] = xstrdup(hp->h_aliases[k]);
if (f->name_count == FQDN_MAX_NAMES)
/*
- * $Id: ipcache.cc,v 1.75 1996/10/15 23:32:53 wessels Exp $
+ * $Id: ipcache.cc,v 1.76 1996/10/24 05:07:21 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
if (!opt_dns_tests) {
debug(14, 4, "ipcache_init: Skipping DNS name lookup tests.\n");
} else if (!ipcache_testname()) {
- fatal("ipcache_init: DNS name lookup tests failed/");
+ fatal("ipcache_init: DNS name lookup tests failed.");
} else {
debug(14, 1, "Successful DNS name lookup tests...\n");
}
/*
- * $Id: main.cc,v 1.97 1996/10/18 20:36:24 wessels Exp $
+ * $Id: main.cc,v 1.98 1996/10/24 05:07:22 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
int opt_udp_hit_obj = 1;
int opt_mem_pools = 1;
int opt_forwarded_for = 1;
+int opt_read_only = 0;
int vhost_mode = 0;
volatile int unbuffered_logs = 1; /* debug and hierarchy unbuffered by default */
volatile int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
#if MALLOC_DBG
static int malloc_debug_level = 0;
#endif
+static char *get_url;
static time_t next_cleaning;
static time_t next_maintain;
break;
}
}
+ argc -= optind;
+ argv += optind;
+ if (argc) {
+ opt_read_only = 1;
+ get_url = xstrdup(*argv);
+ }
}
static void
{
struct in_addr addr;
u_short port;
- /* Get our real priviliges */
-
- /* Open server ports */
+ if (!opt_read_only) {
enter_suid();
theHttpConnection = comm_open(SOCK_STREAM,
0,
NULL, 0);
debug(1, 1, "Accepting HTTP connections on FD %d.\n",
theHttpConnection);
+ }
if (!httpd_accel_mode || Config.Accel.withProxy) {
if ((port = Config.Port.icp) > (u_short) 0) {
+ if (opt_read_only)
+ Config.Port.icp = port = 0;
enter_suid();
theInIcpConnection = comm_open(SOCK_DGRAM,
0,
storePurgeOld();
next_cleaning = squid_curtime + Config.cleanRate;
} else if (squid_curtime >= next_announce) {
- send_announce();
+ if (Config.Announce.on)
+ send_announce();
next_announce = squid_curtime + Config.Announce.rate;
}
}
hash_init(0);
mainInitialize();
+ if (get_url) {
+ sigusr2_handle(0);
+ icpFakeRequest(get_url);
+ }
/* main loop */
for (;;) {