]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
icp.h
authorwessels <>
Thu, 24 Oct 1996 11:07:16 +0000 (11:07 +0000)
committerwessels <>
Thu, 24 Oct 1996 11:07:16 +0000 (11:07 +0000)
src/cache_cf.cc
src/debug.cc
src/fqdncache.cc
src/ipcache.cc
src/main.cc

index 5516f78b04994635311bbec0e3bc649e6ef46117..51e632724397b4d8a2794cda92022bec74aefb21 100644 (file)
@@ -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;
index 42d269768b848fc1cdd68ede35dde2fb1649ac49..e047ffe58b9755f7a2dd9d5fa9f647f13dae54cd 100644 (file)
@@ -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)
index 5308818171760ab457f168c71215a6d36d17d723..f4e9bf7b8e7f79708bcd2a82468bb40e97fc93f7 100644 (file)
@@ -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)
index 98ff5ca97f4063e17a831ba82657719942feaf73..ebf626d6d217adae5e3438744b0a6cbb789ac4f1 100644 (file)
@@ -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");
     }
index 5fef5a1c1eefcb25578c22a1e97f069011101e78..92e45d31c87bbba49f620825f427fa69d2a9925a 100644 (file)
@@ -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 (;;) {