From: wessels <> Date: Thu, 24 Oct 1996 11:07:16 +0000 (+0000) Subject: icp.h X-Git-Tag: SQUID_3_0_PRE1~5614 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d73e33a064361fe860f76a7720afb17e01236d9;p=thirdparty%2Fsquid.git icp.h --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 5516f78b04..51e6327243 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -883,14 +883,14 @@ static void 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(); } @@ -1041,6 +1041,7 @@ parseAnnounceToLine(void) return; safe_free(Config.Announce.file); Config.Announce.file = xstrdup(token); + Config.Announce.on = 1; } static void @@ -1579,6 +1580,7 @@ configSetFactoryDefaults(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; diff --git a/src/debug.cc b/src/debug.cc index 42d269768b..e047ffe58b 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -243,6 +243,8 @@ _db_init(char *logfile, char *options) debugArg(s); xfree(p); } + if (opt_read_only) + return; debugOpenLog(logfile); #if HAVE_SYSLOG && defined(LOG_LOCAL4) diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 5308818171..f4e9bf7b8e 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $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 @@ -392,7 +392,7 @@ fqdncache_add(char *name, fqdncache_entry * f, struct hostent *hp, int cached) 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) diff --git a/src/ipcache.cc b/src/ipcache.cc index 98ff5ca97f..ebf626d6d2 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -735,7 +735,7 @@ ipcache_init(void) 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"); } diff --git a/src/main.cc b/src/main.cc index 5fef5a1c1e..92e45d31c8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * $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 @@ -122,6 +122,7 @@ static int opt_send_signal = -1; /* no signal to send */ 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()) */ @@ -141,6 +142,7 @@ static int icpPortNumOverride = 1; /* Want to detect "-u 0" */ #if MALLOC_DBG static int malloc_debug_level = 0; #endif +static char *get_url; static time_t next_cleaning; static time_t next_maintain; @@ -280,6 +282,12 @@ mainParseOptions(int argc, char *argv[]) break; } } + argc -= optind; + argv += optind; + if (argc) { + opt_read_only = 1; + get_url = xstrdup(*argv); + } } static void @@ -323,9 +331,7 @@ serverConnectionsOpen(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, @@ -345,9 +351,12 @@ serverConnectionsOpen(void) 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, @@ -568,7 +577,8 @@ mainMaintenance(void) 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; } } @@ -643,6 +653,10 @@ main(int argc, char **argv) hash_init(0); mainInitialize(); + if (get_url) { + sigusr2_handle(0); + icpFakeRequest(get_url); + } /* main loop */ for (;;) {