+Changes to squid-1.1.alpha18:
+
- Fixed storeCheckPurgeMem() to both 'purge' *and* 'release'
objects as needed.
+ - Fixed up RWStateCallbackAndFree() to prevent it from getting
+ called twice.
+ - Added 'deny_info' support for redirecting denied requests to
+ a specific URL (maex@space.net).
+ - Fixed protoUnregister() to not abort objects being swapped in.
+ - Changed debug log timestamp format.
+ - Fixed coredump-causing bugs in icpHandleIMSReply().
+ - Fixed FMR bug in neighborsUdpAck() for UDP_HIT_OBJ replies.
+ - Fixed up InvokeHandlers() to clear handler before calling.
Changes to squid-1.1.alpha17:
dnl
dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
dnl
-dnl $Id: configure.in,v 1.32 1996/09/03 19:24:00 wessels Exp $
+dnl $Id: configure.in,v 1.33 1996/09/12 03:23:52 wessels Exp $
dnl
dnl
dnl
AC_INIT(src/main.c)
AC_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.32 $)dnl
+AC_REVISION($Revision: 1.33 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AC_CONFIG_AUX_DIR(aux)
setrlimit \
setsid \
sigaction \
- socketpair \
srand48 \
strdup \
sysconf \
#
# Darren Hardy, hardy@cs.colorado.edu, April 1994
#
-# $Id: Makefile.in,v 1.12 1996/08/26 22:47:47 wessels Exp $
+# $Id: Makefile.in,v 1.13 1996/09/12 03:23:59 wessels Exp $
#
prefix = @prefix@
srcdir = @srcdir@
AC_CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
XTRA_LIBS = @XTRA_LIBS@
+RM = @RM@
INCLUDE = -I../include -I$(srcdir)/../include
UTILOBJS = rfc850.o \
all: $(LIBS)
libmiscutil.a: $(UTILOBJS)
+ $(RM) -f $@
ar r $@ $(UTILOBJS)
$(RANLIB) $@
/*
- * $Id: acl.cc,v 1.31 1996/09/11 22:41:10 wessels Exp $
+ * $Id: acl.cc,v 1.32 1996/09/12 03:24:00 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
AclListTail = &AclList;
}
-void aclDestroyAclList(list)
+static void aclDestroyAclList(list)
struct _acl_list *list;
{
struct _acl_list *next = NULL;
/*
- * $Id: client_side.cc,v 1.21 1996/09/12 00:32:33 wessels Exp $
+ * $Id: client_side.cc,v 1.22 1996/09/12 03:24:01 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
}
-int icpHandleIMSReply(fd, entry, data)
+static int icpHandleIMSReply(fd, entry, data)
int fd;
StoreEntry *entry;
void *data;
/*
- * $Id: comm.cc,v 1.63 1996/09/12 00:31:34 wessels Exp $
+ * $Id: comm.cc,v 1.64 1996/09/12 03:24:02 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
return fde->local_port;
}
+#ifdef __STDC__
+static int commBind (int s, struct in_addr in_addr, u_short port)
+#else /* K&R C */
static int commBind(s, in_addr, port)
int s;
struct in_addr in_addr;
u_short port;
+#endif
{
struct sockaddr_in S;
/* Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE
* is OR of flags specified in comm.h. */
+#ifdef __STDC__
+int comm_open(unsigned int io_type, struct in_addr addr, u_short port, char *note)
+#else /* K&R C */
int comm_open(io_type, addr, port, note)
unsigned int io_type;
struct in_addr addr;
u_short port;
char *note;
+#endif
{
int new_socket;
FD_ENTRY *conn = NULL;
if (!(io_type & COMM_NOCLOEXEC))
commSetCloseOnExec(new_socket);
- if (port > 0) {
+ if (port > (u_short) 0) {
commSetNoLinger(new_socket);
if (do_reuse)
commSetReuseAddr(new_socket);
/* Send a udp datagram to specified PORT at HOST. */
+#ifdef __STDC__
+int
+comm_udp_send(int fd, char *host, u_short port, char *buf, int len)
+#else /* K&R C */
int comm_udp_send(fd, host, port, buf, len)
int fd;
char *host;
u_short port;
char *buf;
int len;
+#endif
{
struct hostent *hp = NULL;
static struct sockaddr_in to_addr;
return COMM_SHUTDOWN;
if (shutdown_pending || reread_pending)
debug(5, 2, "comm_select: Still waiting on %d FDs\n", nfds);
- while (1) {
+ for (;;) {
#if USE_ASYNC_IO
/* Another CPU vs latency tradeoff for async IO */
poll_time.tv_sec = 0;
/*
- * $Id: dnsserver.cc,v 1.20 1996/09/11 22:41:12 wessels Exp $
+ * $Id: dnsserver.cc,v 1.21 1996/09/12 03:24:02 wessels Exp $
*
* DEBUG: section 0 DNS Resolver
* AUTHOR: Harvest Derived
}
}
/* NOTREACHED */
+ return 0;
}
/*
- * $Id: fqdncache.cc,v 1.15 1996/09/04 22:03:23 wessels Exp $
+ * $Id: fqdncache.cc,v 1.16 1996/09/12 03:24:03 wessels Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
dnsData->ip_inbuf[0] = '\0';
f = dnsData->data;
f->name_count = x->name_count;
- for (n = 0; n < f->name_count; n++)
+ for (n = 0; n < (int) f->name_count; n++)
f->names[n] = x->names[n];
f->error_message = x->error_message;
f->status = x->status;
/*
- * $Id: main.cc,v 1.69 1996/08/30 22:39:30 wessels Exp $
+ * $Id: main.cc,v 1.70 1996/09/12 03:24:06 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
int opt_zap_disk_store = 0;
int opt_syslog_enable = 0; /* disabled by default */
int opt_no_ipcache = 0; /* use ipcache by default */
+static int opt_send_signal = -1;/* no signal to send */
int vhost_mode = 0;
int unbuffered_logs = 1; /* debug and hierarhcy unbuffered by default */
int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
static time_t mainMaintenance _PARAMS((void));
static void usage _PARAMS((void));
static void mainParseOptions _PARAMS((int, char **));
+static void sendSignal _PARAMS((void));
static void usage()
{
fprintf(stderr, "\
-Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port]\n\
+Usage: %s [-hsvzCDFRUVY] [-f config-file] [-[au] port] [-k signal]\n\
-a port Specify ASCII port number (default: %d).\n\
-f file Use given config-file instead of\n\
%s\n\
- -i Disable IP caching.\n\
-h Print help message.\n\
+ -i Disable IP caching.\n\
+ -k reconfigure|rotate|shutdown|kill|debug|check\n\
+ Send signal to running copy and exit.\n\
-s Enable logging to syslog.\n\
-u port Specify ICP port number (default: %d), disable with 0.\n\
-v Print version.\n\
extern char *optarg;
int c;
- while ((c = getopt(argc, argv, "CDFRUVYa:bf:him:su:vz?")) != -1) {
+ while ((c = getopt(argc, argv, "CDFRUVYa:bf:hik:m:su:vz?")) != -1) {
switch (c) {
case 'C':
opt_catch_signals = 0;
case 'i':
opt_no_ipcache = 1;
break;
+ case 'k':
+ if (strlen(optarg) < 1)
+ usage();
+ if (!strncmp(optarg, "reconfigure", strlen(optarg)))
+ opt_send_signal = SIGHUP;
+ else if (!strncmp(optarg, "rotate", strlen(optarg)))
+ opt_send_signal = SIGUSR1;
+ else if (!strncmp(optarg, "debug", strlen(optarg)))
+ opt_send_signal = SIGUSR2;
+ else if (!strncmp(optarg, "shutdown", strlen(optarg)))
+ opt_send_signal = SIGTERM;
+ else if (!strncmp(optarg, "kill", strlen(optarg)))
+ opt_send_signal = SIGKILL;
+ else if (!strncmp(optarg, "check", strlen(optarg)))
+ opt_send_signal = 0; /* SIGNULL */
+ else
+ usage();
+ break;
case 'm':
#if MALLOC_DBG
malloc_debug_level = atoi(optarg);
}
}
-void rotate_logs(sig)
+static void rotate_logs(sig)
int sig;
{
debug(21, 1, "rotate_logs: SIGUSR1 received.\n");
#endif
}
-void reconfigure(sig)
+static void reconfigure(sig)
int sig;
{
debug(21, 1, "reconfigure: SIGHUP received\n");
theHttpConnection);
if (!httpd_accel_mode || Config.Accel.withProxy) {
- if ((port = Config.Port.icp) > 0) {
+ if ((port = Config.Port.icp) > (u_short) 0) {
theInIcpConnection = comm_open(COMM_NONBLOCKING | COMM_DGRAM,
Config.Addrs.udp_incoming,
port,
mainParseOptions(argc, argv);
+ /* send signal to running copy and exit */
+ if (opt_send_signal != -1) {
+ sendSignal();
+ /* NOTREACHED */
+ }
+
setMaxFD();
if (opt_catch_signals)
/* NOTREACHED */
return 0;
}
+
+static void sendSignal()
+{
+ int pid;
+ debug_log = stderr;
+ if (ConfigFile == NULL)
+ ConfigFile = xstrdup(DefaultConfigFile);
+ parseConfigFile(ConfigFile);
+ pid = readPidFile();
+ if (pid > 1) {
+ if (kill(pid, opt_send_signal) &&
+ /* ignore permissions if just running check */
+ !(opt_send_signal == 0 && errno == EPERM)) {
+ fprintf(stderr, "%s: ERROR: Could not send ", appname);
+ fprintf(stderr, "signal %d to process %d: %s\n",
+ opt_send_signal, pid, xstrerror());
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "%s: ERROR: No running copy\n", appname);
+ exit(1);
+ }
+ /* signal successfully sent */
+ exit(0);
+ }
/*
- * $Id: neighbors.cc,v 1.47 1996/09/12 00:31:12 wessels Exp $
+ * $Id: neighbors.cc,v 1.48 1996/09/12 03:24:06 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
return friends->edges_head;
}
-void neighborRemove(target)
+static void neighborRemove(target)
edge *target;
{
edge *e = NULL;
/*
- * $Id: tools.cc,v 1.53 1996/09/11 22:41:15 wessels Exp $
+ * $Id: tools.cc,v 1.54 1996/09/12 03:24:08 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
}
+int readPidFile()
+{
+ FILE *pid_fp = NULL;
+ char *f = NULL;
+ int pid = -1;
+
+ if ((f = Config.pidFilename) == NULL) {
+ fprintf(stderr, "%s: ERROR: No pid file name defined\n", appname);
+ exit(1);
+ }
+ pid_fp = fopen(f, "r");
+ if (pid_fp != NULL) {
+ if (fscanf(pid_fp, "%d", &pid) != 1)
+ pid = 0;
+ fclose(pid_fp);
+ } else {
+ if (errno != ENOENT) {
+ fprintf(stderr, "%s: ERROR: Could not read pid file\n", appname);
+ fprintf(stderr, "\t%s: %s\n", f, xstrerror());
+ exit(1);
+ }
+ }
+ return pid;
+}
+
+
void setMaxFD()
{
#if HAVE_SETRLIMIT