diff -cr squid-1.0.beta1/ChangeLog squid-1.0.beta2/ChangeLog *** squid-1.0.beta1/ChangeLog Fri Apr 19 09:55:04 1996 --- squid-1.0.beta2/ChangeLog Sun Apr 21 18:43:03 1996 *************** *** 68,70 **** --- 68,81 ---- - Removed all code and references to binary port. - Removed dual logging to stderr/cache.log. - Removed old IP access controls ('proxy_allow', etc.) + + Changes to 1.0.beta2 + + - Fixed /bin/csh "$#argv" leftover in RunCache. + - Fixed ACL day-of-week bitmask bug. + - Fixed missing checks for WAIS in some places. + - Fixed chdir(swappath(0)) bug; do chdir() after storeInit(). + - Changed enumerated structure members to be defined outside + of the structure itself (for AIX). + - Changed ftpget to fork before reading the request and make + sure the entire request is read. diff -cr squid-1.0.beta1/configure squid-1.0.beta2/configure *** squid-1.0.beta1/configure Tue Apr 16 11:34:11 1996 --- squid-1.0.beta2/configure Sat Apr 20 12:57:37 1996 *************** *** 517,523 **** ! # From configure.in Revision: 1.17 ac_aux_dir= for ac_dir in aux $srcdir/aux; do if test -f $ac_dir/install-sh; then --- 517,523 ---- ! # From configure.in Revision: 1.18.2.1 ac_aux_dir= for ac_dir in aux $srcdir/aux; do if test -f $ac_dir/install-sh; then *************** *** 1269,1274 **** --- 1269,1275 ---- sys/select.h\ sys/time.h \ sys/types.h \ + sys/syscall.h \ unistd.h \ regex.h \ syslog.h \ *************** *** 1280,1286 **** echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF --- 1281,1287 ---- echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF *************** *** 1311,1317 **** echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6 cat > conftest.$ac_ext < #include --- 1312,1318 ---- echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6 cat > conftest.$ac_ext < #include *************** *** 1337,1343 **** echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6 cat > conftest.$ac_ext < #include --- 1338,1344 ---- echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6 cat > conftest.$ac_ext < #include *************** *** 1369,1375 **** { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() --- 1370,1376 ---- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() *************** *** 1403,1409 **** { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() --- 1404,1410 ---- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() *************** *** 1437,1443 **** echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } --- 1438,1444 ---- echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return 0; } *************** *** 1469,1475 **** echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < header file. */ #undef HAVE_SYS_SELECT_H + /* Define if you have the header file. */ + #undef HAVE_SYS_SYSCALL_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H diff -cr squid-1.0.beta1/lib/Makefile.in squid-1.0.beta2/lib/Makefile.in *** squid-1.0.beta1/lib/Makefile.in Mon Mar 25 21:12:07 1996 --- squid-1.0.beta2/lib/Makefile.in Sat Apr 20 13:25:12 1996 *************** *** 3,15 **** # # Darren Hardy, hardy@cs.colorado.edu, April 1994 # ! # $Id: Makefile.in,v 1.7 1996/03/26 05:12:07 wessels Exp $ # ! prefix = @prefix@ ! INSTALL_BINDIR = $(prefix)/bin ! INSTALL_LIBDIR = $(prefix)/lib ! INSTALL_MANDIR = $(prefix)/man CC = @CC@ INSTALL = @INSTALL@ INSTALL_BIN = @INSTALL_PROGRAM@ --- 3,15 ---- # # Darren Hardy, hardy@cs.colorado.edu, April 1994 # ! # $Id: Makefile.in,v 1.7.2.2 1996/04/20 20:25:12 wessels Exp $ # ! prefix = @prefix@ ! srcdir = @srcdir@ ! VPATH = @srcdir@ + CC = @CC@ INSTALL = @INSTALL@ INSTALL_BIN = @INSTALL_PROGRAM@ *************** *** 20,26 **** XTRA_LIBS = @XTRA_LIBS@ XTRA_CFLAGS = @XTRA_CFLAGS@ ! INCLUDE = -I../include UTILOBJS = rfc850.o \ rfc1738.o \ util.o \ --- 20,26 ---- XTRA_LIBS = @XTRA_LIBS@ XTRA_CFLAGS = @XTRA_CFLAGS@ ! INCLUDE = -I../include -I$(srcdir)/../include UTILOBJS = rfc850.o \ rfc1738.o \ util.o \ diff -cr squid-1.0.beta1/scripts/Makefile.in squid-1.0.beta2/scripts/Makefile.in *** squid-1.0.beta1/scripts/Makefile.in Fri Mar 22 13:13:14 1996 --- squid-1.0.beta2/scripts/Makefile.in Sat Apr 20 12:57:00 1996 *************** *** 3,12 **** # Cache Manager is a manager program for Internet Object Cache. # ! prefix = @prefix@ ! INSTALL_BINDIR = $(prefix)/bin ! INSTALL_LIBDIR = $(prefix)/lib ! INSTALL_MANDIR = $(prefix)/man CC = @CC@ INSTALL = @INSTALL@ --- 3,15 ---- # Cache Manager is a manager program for Internet Object Cache. # ! prefix = @prefix@ ! exec_prefix = @exec_prefix@ ! top_srcdir = @top_srcdir@ ! bindir = @bindir@ ! sysconfdir = @sysconfdir@ ! srcdir = @srcdir@ ! VPATH = @srcdir@ CC = @CC@ INSTALL = @INSTALL@ *************** *** 22,33 **** echo "mkdir $(prefix)"; \ mkdir $(prefix); \ fi ! @if test ! -d $(INSTALL_BINDIR); then \ ! echo "mkdir $(INSTALL_BINDIR)"; \ ! mkdir $(INSTALL_BINDIR); \ fi ! $(INSTALL_BIN) RunCache $(INSTALL_BINDIR) ! $(INSTALL_BIN) RunAccel $(INSTALL_BINDIR) clean: --- 25,36 ---- echo "mkdir $(prefix)"; \ mkdir $(prefix); \ fi ! @if test ! -d $(bindir); then \ ! echo "mkdir $(bindir)"; \ ! mkdir $(bindir); \ fi ! $(INSTALL_BIN) RunCache $(bindir) ! $(INSTALL_BIN) RunAccel $(bindir) clean: diff -cr squid-1.0.beta1/scripts/RunCache.in squid-1.0.beta2/scripts/RunCache.in *** squid-1.0.beta1/scripts/RunCache.in Mon Apr 15 22:48:20 1996 --- squid-1.0.beta2/scripts/RunCache.in Sat Apr 20 12:39:06 1996 *************** *** 1,11 **** #!/bin/sh # ! # $Id: RunCache.in,v 1.3 1996/04/16 05:48:20 wessels Exp $ PATH=@prefix@/bin:/bin export PATH ! if test $#argv = 1 ; then conf="-f $1" shift; fi --- 1,12 ---- #!/bin/sh # ! # $Id: RunCache.in,v 1.3.2.1 1996/04/20 19:39:06 wessels Exp $ PATH=@prefix@/bin:/bin export PATH ! conf="" ! if test "$1" ; then conf="-f $1" shift; fi diff -cr squid-1.0.beta1/src/Makefile.in squid-1.0.beta2/src/Makefile.in *** squid-1.0.beta1/src/Makefile.in Tue Apr 16 13:53:32 1996 --- squid-1.0.beta2/src/Makefile.in Sat Apr 20 13:25:12 1996 *************** *** 1,7 **** # # Makefile for the Squid Object Cache server # ! # $Id: Makefile.in,v 1.22 1996/04/16 20:53:32 wessels Exp $ # # Uncomment and customize the following to suit your needs: # --- 1,7 ---- # # Makefile for the Squid Object Cache server # ! # $Id: Makefile.in,v 1.22.2.2 1996/04/20 20:25:12 wessels Exp $ # # Uncomment and customize the following to suit your needs: # *************** *** 14,19 **** --- 14,21 ---- top_srcdir = @top_srcdir@ bindir = @bindir@ sysconfdir = @sysconfdir@ + srcdir = @srcdir@ + VPATH = @srcdir@ CC = @CC@ INSTALL = @INSTALL@ *************** *** 31,37 **** SHELL = /bin/sh ! INCLUDE = -I. -I../include # MUST use -I. first CFLAGS = $(STD_CFLAGS) $(XTRA_CFLAGS) $(INCLUDE) $(DEFINES) LDFLAGS = $(STD_LDFLAGS) LIBS = -L../lib -lregex -lutil $(XTRA_LIBS) --- 33,39 ---- SHELL = /bin/sh ! INCLUDE = -I. -I../include -I$(srcdir)/../include CFLAGS = $(STD_CFLAGS) $(XTRA_CFLAGS) $(INCLUDE) $(DEFINES) LDFLAGS = $(STD_LDFLAGS) LIBS = -L../lib -lregex -lutil $(XTRA_LIBS) *************** *** 65,71 **** $(CC) -o $@ $(LDFLAGS) $(OBJS) $(CRYPT_LIB) $(LIBS) cache_cf.o: cache_cf.c ! $(CC) -c cache_cf.c $(CFLAGS) $(DEFAULTS) client: client.o $(CC) -o $@ $(LDFLAGS) $@.o $(CLIENT_LIBS) --- 67,73 ---- $(CC) -o $@ $(LDFLAGS) $(OBJS) $(CRYPT_LIB) $(LIBS) cache_cf.o: cache_cf.c ! $(CC) -c $< $(CFLAGS) $(DEFAULTS) client: client.o $(CC) -o $@ $(LDFLAGS) $@.o $(CLIENT_LIBS) diff -cr squid-1.0.beta1/src/acl.c squid-1.0.beta2/src/acl.c *** squid-1.0.beta1/src/acl.c Mon Apr 15 22:05:17 1996 --- squid-1.0.beta2/src/acl.c Sat Apr 20 12:55:59 1996 *************** *** 1,4 **** ! #ident "$Id: acl.c,v 1.12 1996/04/16 05:05:17 wessels Exp $" /* * DEBUG: Section 28 acl --- 1,4 ---- ! /* "$Id: acl.c,v 1.12.2.2 1996/04/20 19:55:59 wessels Exp $" */ /* * DEBUG: Section 28 acl *************** *** 478,484 **** t = (time_t) (tm.tm_hour * 60 + tm.tm_min); if (t < data->start || t > data->stop) return 0; ! return data->weekbits & tm.tm_wday ? 1 : 0; } static int aclMatchAcl(acl, c, m, pr, h, po, r) --- 478,484 ---- t = (time_t) (tm.tm_hour * 60 + tm.tm_min); if (t < data->start || t > data->stop) return 0; ! return data->weekbits & (1 << tm.tm_wday) ? 1 : 0; } static int aclMatchAcl(acl, c, m, pr, h, po, r) diff -cr squid-1.0.beta1/src/ftp.c squid-1.0.beta2/src/ftp.c *** squid-1.0.beta1/src/ftp.c Wed Apr 17 11:06:24 1996 --- squid-1.0.beta2/src/ftp.c Sat Apr 20 15:52:36 1996 *************** *** 1,4 **** ! /* $Id: ftp.c,v 1.37 1996/04/17 18:06:24 wessels Exp $ */ /* * DEBUG: Section 9 ftp: FTP --- 1,4 ---- ! /* $Id: ftp.c,v 1.37.2.1 1996/04/20 22:52:36 wessels Exp $ */ /* * DEBUG: Section 9 ftp: FTP *************** *** 513,519 **** strcat(buf, data->user); strcat(buf, space); strcat(buf, data->password); ! strcat(buf, space); debug(9, 5, "ftpSendRequest: FD %d: buf '%s'\n", fd, buf); data->icp_rwd_ptr = icpWrite(fd, buf, --- 513,519 ---- strcat(buf, data->user); strcat(buf, space); strcat(buf, data->password); ! strcat(buf, "\n"); debug(9, 5, "ftpSendRequest: FD %d: buf '%s'\n", fd, buf); data->icp_rwd_ptr = icpWrite(fd, buf, diff -cr squid-1.0.beta1/src/ftpget.c squid-1.0.beta2/src/ftpget.c *** squid-1.0.beta1/src/ftpget.c Wed Apr 17 13:16:49 1996 --- squid-1.0.beta2/src/ftpget.c Sun Apr 21 18:48:34 1996 *************** *** 1,4 **** ! /* $Id: ftpget.c,v 1.23 1996/04/17 20:16:49 wessels Exp $ */ /* * NOTES --- 1,4 ---- ! /* $Id: ftpget.c,v 1.23.2.4 1996/04/22 01:48:34 wessels Exp $ */ /* * NOTES *************** *** 79,84 **** --- 79,87 ---- #include #include #include /* for select(2) */ + #ifdef HAVE_SYS_SELECT_H + #include + #endif #include #include #include *************** *** 2022,2027 **** --- 2025,2031 ---- int n; static char *w_space = " \t\n\r"; static char buf[BUFSIZ]; + int buflen; setsid(); /* become session leader */ *************** *** 2071,2085 **** log_errno2(__FILE__, __LINE__, "accept"); exit(1); } ! buf[0] = '\0'; ! /* XXX Assume we get the whole request in one read! */ ! /* Probably okay since it should be coming on the loopback */ ! if ((n = read(c, buf, BUFSIZ)) <= 0) { ! log_errno2(__FILE__, __LINE__, "read"); close(c); continue; } ! buf[n] = '\0'; /* Must terminate it */ i = 0; t = strtok(buf, w_space); while (t && i < MAX_ARGS - 1) { --- 2075,2095 ---- log_errno2(__FILE__, __LINE__, "accept"); exit(1); } ! if (fork()) { ! /* parent */ close(c); continue; } ! buflen = 0; ! memset(buf, '\0', BUFSIZ); ! do { ! if ((n = read(c, &buf[buflen], BUFSIZ - buflen - 1)) <= 0) { ! log_errno2(__FILE__, __LINE__, "read"); ! close(c); ! _exit(1); ! } ! buflen += n; ! } while (!strchr(buf, '\n')); i = 0; t = strtok(buf, w_space); while (t && i < MAX_ARGS - 1) { *************** *** 2089,2099 **** i++; } args[i] = NULL; ! if (fork()) { ! /* parent */ ! close(c); ! continue; ! } dup2(c, 1); close(c); execvp(fullprogname, args); --- 2099,2105 ---- i++; } args[i] = NULL; ! dup2(c, 1); close(c); execvp(fullprogname, args); *************** *** 2103,2112 **** return 1; } ! void usage() { fprintf(stderr, "usage: %s options filename host path A,I user pass\n", progname); fprintf(stderr, "Options:\n"); fprintf(stderr, "\t-c num[:delay] Max connect attempts and retry delay\n"); fprintf(stderr, "\t-l num[:delay] Max login attempts and retry delay\n"); --- 2109,2121 ---- return 1; } ! void usage(argcount) ! int argcount; { fprintf(stderr, "usage: %s options filename host path A,I user pass\n", progname); + if (argcount != 0) + return; fprintf(stderr, "Options:\n"); fprintf(stderr, "\t-c num[:delay] Max connect attempts and retry delay\n"); fprintf(stderr, "\t-l num[:delay] Max login attempts and retry delay\n"); *************** *** 2186,2201 **** continue; } else if (!strcmp(*argv, "-S")) { if (--argc < 1) ! usage(); argv++; j = atoi(*argv); Debug(26, 1, ("argv=%s j=%d\n", *argv, j)); if (j > 0) return (ftpget_srv_mode(j)); ! usage(); } else if (!strcmp(*argv, "-t")) { if (--argc < 1) ! usage(); argv++; j = atoi(*argv); if (j > 0) --- 2195,2210 ---- continue; } else if (!strcmp(*argv, "-S")) { if (--argc < 1) ! usage(argc); argv++; j = atoi(*argv); Debug(26, 1, ("argv=%s j=%d\n", *argv, j)); if (j > 0) return (ftpget_srv_mode(j)); ! usage(argc); } else if (!strcmp(*argv, "-t")) { if (--argc < 1) ! usage(argc); argv++; j = atoi(*argv); if (j > 0) *************** *** 2203,2209 **** continue; } else if (!strcmp(*argv, "-w")) { if (--argc < 1) ! usage(); argv++; j = atoi(*argv); if (j > 0) --- 2212,2218 ---- continue; } else if (!strcmp(*argv, "-w")) { if (--argc < 1) ! usage(argc); argv++; j = atoi(*argv); if (j > 0) *************** *** 2211,2217 **** continue; } else if (!strcmp(*argv, "-n")) { if (--argc < 1) ! usage(); argv++; j = atoi(*argv); if (j > 0) --- 2220,2226 ---- continue; } else if (!strcmp(*argv, "-n")) { if (--argc < 1) ! usage(argc); argv++; j = atoi(*argv); if (j > 0) *************** *** 2219,2237 **** continue; } else if (!strcmp(*argv, "-p")) { if (--argc < 1) ! usage(); argv++; o_iconprefix = xstrdup(*argv); continue; } else if (!strcmp(*argv, "-s")) { if (--argc < 1) ! usage(); argv++; o_iconsuffix = xstrdup(*argv); continue; } else if (!strcmp(*argv, "-c")) { if (--argc < 1) ! usage(); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); --- 2228,2246 ---- continue; } else if (!strcmp(*argv, "-p")) { if (--argc < 1) ! usage(argc); argv++; o_iconprefix = xstrdup(*argv); continue; } else if (!strcmp(*argv, "-s")) { if (--argc < 1) ! usage(argc); argv++; o_iconsuffix = xstrdup(*argv); continue; } else if (!strcmp(*argv, "-c")) { if (--argc < 1) ! usage(argc); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); *************** *** 2242,2248 **** continue; } else if (!strcmp(*argv, "-l")) { if (--argc < 1) ! usage(); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); --- 2251,2257 ---- continue; } else if (!strcmp(*argv, "-l")) { if (--argc < 1) ! usage(argc); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); *************** *** 2253,2259 **** continue; } else if (!strcmp(*argv, "-r")) { if (--argc < 1) ! usage(); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); --- 2262,2268 ---- continue; } else if (!strcmp(*argv, "-r")) { if (--argc < 1) ! usage(argc); argv++; j = k = 0; sscanf(*argv, "%d:%d", &j, &k); *************** *** 2268,2274 **** o_list_wrap = 1; } else if (!strcmp(*argv, "-P")) { if (--argc < 1) ! usage(); argv++; j = atoi(*argv); if (j > 0) --- 2277,2283 ---- o_list_wrap = 1; } else if (!strcmp(*argv, "-P")) { if (--argc < 1) ! usage(argc); argv++; j = atoi(*argv); if (j > 0) *************** *** 2278,2291 **** printf("%s version %s\n", progname, SQUID_VERSION); exit(0); } else { ! usage(); exit(1); } } if (argc != 6) { ! fprintf(stderr, "Too many arguments left (%d)\n", argc); ! usage(); } r = (request_t *) xmalloc(sizeof(request_t)); memset(r, '\0', sizeof(request_t)); --- 2287,2300 ---- printf("%s version %s\n", progname, SQUID_VERSION); exit(0); } else { ! usage(argc); exit(1); } } if (argc != 6) { ! fprintf(stderr, "Wrong number of arguments left (%d)\n", argc); ! usage(argc); } r = (request_t *) xmalloc(sizeof(request_t)); memset(r, '\0', sizeof(request_t)); *************** *** 2312,2318 **** if (*(r->type) != 'A' && *(r->type) != 'I') { errorlog("Invalid transfer type: %s\n", r->type); ! usage(); } cleanup_path(r); --- 2321,2327 ---- if (*(r->type) != 'A' && *(r->type) != 'I') { errorlog("Invalid transfer type: %s\n", r->type); ! usage(argc); } cleanup_path(r); diff -cr squid-1.0.beta1/src/icp.c squid-1.0.beta2/src/icp.c *** squid-1.0.beta1/src/icp.c Fri Apr 19 14:38:10 1996 --- squid-1.0.beta2/src/icp.c Sat Apr 20 13:11:10 1996 *************** *** 1,6 **** ! /* $Id: icp.c,v 1.61.2.4 1996/04/19 21:38:10 wessels Exp $ */ /* * DEBUG: Section 12 icp: --- 1,6 ---- ! /* $Id: icp.c,v 1.61.2.5 1996/04/20 20:11:10 wessels Exp $ */ /* * DEBUG: Section 12 icp: *************** *** 472,478 **** header->opcode = ICP_OP_DATABEG; } else if ((entry->mem_obj->e_current_len == entry->object_len) && ((entry->object_len - state->offset) == len) && ! (entry->status != STORE_PENDING)) { /* No more data; this is the last message. */ header->opcode = ICP_OP_DATAEND; } else { --- 472,478 ---- header->opcode = ICP_OP_DATABEG; } else if ((entry->mem_obj->e_current_len == entry->object_len) && ((entry->object_len - state->offset) == len) && ! (entry->store_status != STORE_PENDING)) { /* No more data; this is the last message. */ header->opcode = ICP_OP_DATAEND; } else { *************** *** 506,512 **** debug(12, 5, "icpHandleStore: FD %d: off %d: \n", fd, state->offset, entry->url); ! if (entry->status == STORE_ABORTED) { state->log_type = entry->mem_obj->abort_code; debug(12, 3, "icpHandleStore: abort_code=%d\n", entry->mem_obj->abort_code); state->ptr_to_4k_page = NULL; /* Nothing to deallocate */ --- 506,512 ---- debug(12, 5, "icpHandleStore: FD %d: off %d: \n", fd, state->offset, entry->url); ! if (entry->store_status == STORE_ABORTED) { state->log_type = entry->mem_obj->abort_code; debug(12, 3, "icpHandleStore: abort_code=%d\n", entry->mem_obj->abort_code); state->ptr_to_4k_page = NULL; /* Nothing to deallocate */ *************** *** 555,561 **** } else /* We're finished case */ if (state->offset == entry->object_len && ! entry->status != STORE_PENDING) { CacheInfo->proto_touchobject(CacheInfo, CacheInfo->proto_id(entry->url), state->offset); --- 555,561 ---- } else /* We're finished case */ if (state->offset == entry->object_len && ! entry->store_status != STORE_PENDING) { CacheInfo->proto_touchobject(CacheInfo, CacheInfo->proto_id(entry->url), state->offset); *************** *** 879,885 **** entry = storeGet(storeGeneratePublicKey(url, METHOD_GET)); debug(12, 5, "icpHandleUdp: OPCODE %s\n", IcpOpcodeStr[header.opcode]); if (entry && ! (entry->status == STORE_OK) && (entry->expires > (squid_curtime + getNegativeTTL()))) { /* Send "HIT" message. */ CacheInfo->log_append(CacheInfo, /* UDP_HIT */ --- 879,885 ---- entry = storeGet(storeGeneratePublicKey(url, METHOD_GET)); debug(12, 5, "icpHandleUdp: OPCODE %s\n", IcpOpcodeStr[header.opcode]); if (entry && ! (entry->store_status == STORE_OK) && (entry->expires > (squid_curtime + getNegativeTTL()))) { /* Send "HIT" message. */ CacheInfo->log_append(CacheInfo, /* UDP_HIT */ *************** *** 1425,1431 **** return; if (astm->entry->lock_count != 1) return; ! if (astm->entry->status == STORE_OK) return; BIT_SET(astm->entry->flag, CLIENT_ABORT_REQUEST); storeReleaseRequest(astm->entry); --- 1425,1431 ---- return; if (astm->entry->lock_count != 1) return; ! if (astm->entry->store_status == STORE_OK) return; BIT_SET(astm->entry->flag, CLIENT_ABORT_REQUEST); storeReleaseRequest(astm->entry); diff -cr squid-1.0.beta1/src/ipcache.h squid-1.0.beta2/src/ipcache.h *** squid-1.0.beta1/src/ipcache.h Wed Apr 10 13:45:29 1996 --- squid-1.0.beta2/src/ipcache.h Sun Apr 21 18:48:35 1996 *************** *** 1,4 **** ! /* $Id: ipcache.h,v 1.7 1996/04/10 20:45:29 wessels Exp $ */ #ifndef _IPCACHE_H_ #define _IPCACHE_H_ --- 1,4 ---- ! /* $Id: ipcache.h,v 1.7.2.2 1996/04/22 01:48:35 wessels Exp $ */ #ifndef _IPCACHE_H_ #define _IPCACHE_H_ *************** *** 5,11 **** --- 5,17 ---- typedef int (*IPH) _PARAMS((int, struct hostent *, void *)); + typedef enum { + CACHED, + PENDING, + NEGATIVE_CACHED + } ipcache_status_t; + typedef struct _ipcache_entry { /* first two items must be equivalent to hash_link in hash.h */ char *name; *************** *** 15,26 **** long ttl; unsigned char addr_count; unsigned char alias_count; - enum { - CACHED, PENDING, NEGATIVE_CACHED - } status:3; struct hostent entry; struct _ip_pending *pending_head; struct _ip_pending *pending_tail; } ipcache_entry; extern int ipcache_nbgethostbyname _PARAMS((char *, int, IPH, void *)); --- 21,30 ---- long ttl; unsigned char addr_count; unsigned char alias_count; struct hostent entry; struct _ip_pending *pending_head; struct _ip_pending *pending_tail; + ipcache_status_t status:3; } ipcache_entry; extern int ipcache_nbgethostbyname _PARAMS((char *, int, IPH, void *)); diff -cr squid-1.0.beta1/src/main.c squid-1.0.beta2/src/main.c *** squid-1.0.beta1/src/main.c Fri Apr 19 09:37:17 1996 --- squid-1.0.beta2/src/main.c Sat Apr 20 12:42:20 1996 *************** *** 1,4 **** ! /* $Id: main.c,v 1.44.4.1 1996/04/19 16:37:17 wessels Exp $ */ /* DEBUG: Section 1 main: startup and main loop */ --- 1,4 ---- ! /* $Id: main.c,v 1.44.4.2 1996/04/20 19:42:20 wessels Exp $ */ /* DEBUG: Section 1 main: startup and main loop */ *************** *** 233,238 **** --- 233,246 ---- stmemInit(); writePidFile(); + if (getEffectiveUser()) { + /* we were probably started as root, so cd to a swap + * directory in case we dump core */ + if (chdir(swappath(0)) < 0) { + debug(1, 0, "%s: %s\n", swappath(0), xstrerror()); + fatal_dump("Cannot cd to swap directory?"); + } + } /* after this point we want to see the mallinfo() output */ do_mallinfo = 1; } diff -cr squid-1.0.beta1/src/proto.c squid-1.0.beta2/src/proto.c *** squid-1.0.beta1/src/proto.c Fri Apr 19 09:46:57 1996 --- squid-1.0.beta2/src/proto.c Sat Apr 20 13:11:11 1996 *************** *** 1,4 **** ! /* $Id: proto.c,v 1.27.2.1 1996/04/19 16:46:57 wessels Exp $ */ /* * DEBUG: Section 17 proto: --- 1,4 ---- ! /* $Id: proto.c,v 1.27.2.2 1996/04/20 20:11:11 wessels Exp $ */ /* * DEBUG: Section 17 proto: *************** *** 141,147 **** return 0; } else if (neighborsUdpPing(protoData)) { /* call neighborUdpPing and start timeout routine */ ! if ((entry->ping_status == DONE) || entry->status == STORE_OK) { debug(17, 0, "Starting a source ping for a valid object %s!\n", storeToString(entry)); fatal_dump(NULL); --- 141,147 ---- return 0; } else if (neighborsUdpPing(protoData)) { /* call neighborUdpPing and start timeout routine */ ! if ((entry->ping_status == DONE) || entry->store_status == STORE_OK) { debug(17, 0, "Starting a source ping for a valid object %s!\n", storeToString(entry)); fatal_dump(NULL); diff -cr squid-1.0.beta1/src/squid.h squid-1.0.beta2/src/squid.h *** squid-1.0.beta1/src/squid.h Mon Apr 15 22:13:37 1996 --- squid-1.0.beta2/src/squid.h Sat Apr 20 12:56:41 1996 *************** *** 1,5 **** ! /* $Id: squid.h,v 1.19 1996/04/16 05:13:37 wessels Exp $ */ #include "config.h" #include "autoconf.h" --- 1,5 ---- ! /* $Id: squid.h,v 1.19.4.1 1996/04/20 19:56:41 wessels Exp $ */ #include "config.h" #include "autoconf.h" *************** *** 25,33 **** #include #include #include - #include #include #include #ifdef HAVE_STRING_H #include --- 25,36 ---- #include #include #include #include #include + + #ifdef HAVE_SYS_SYSCALL_H + #include + #endif #ifdef HAVE_STRING_H #include diff -cr squid-1.0.beta1/src/stat.c squid-1.0.beta2/src/stat.c *** squid-1.0.beta1/src/stat.c Fri Apr 19 09:37:18 1996 --- squid-1.0.beta2/src/stat.c Sat Apr 20 13:24:42 1996 *************** *** 1,4 **** ! /* $Id: stat.c,v 1.28.4.3 1996/04/19 16:37:18 wessels Exp $ */ /* * DEBUG: Section 18 stat --- 1,4 ---- ! /* $Id: stat.c,v 1.28.4.7 1996/04/20 20:24:42 wessels Exp $ */ /* * DEBUG: Section 18 stat *************** *** 8,14 **** #include "squid.h" #ifdef _SQUID_HPUX_ - #include #define getrusage(a, b) syscall(SYS_GETRUSAGE, a, b) #define getpagesize( ) sysconf(_SC_PAGE_SIZE) #endif /* _SQUID_HPUX_ */ --- 8,13 ---- *************** *** 59,64 **** --- 58,64 ---- storeAppend(sentry, open_bracket, (int) strlen(open_bracket)); + strcpy(p->protoname, "TOTAL"); p->object_count = 0; p->kb.max = 0; p->kb.min = 0; *************** *** 1008,1013 **** --- 1008,1016 ---- case PROTO_FTP: strcpy(obj->proto_stat_data[i].protoname, "FTP"); break; + case PROTO_WAIS: + strcpy(obj->proto_stat_data[i].protoname, "WAIS"); + break; case PROTO_CACHEOBJ: strcpy(obj->proto_stat_data[i].protoname, "CACHE_OBJ"); break; *************** *** 1043,1049 **** static char state[256]; state[0] = '\0'; ! switch (entry->status) { case STORE_OK: strncat(state, "STORE-OK", sizeof(state)); break; --- 1046,1052 ---- static char state[256]; state[0] = '\0'; ! switch (entry->store_status) { case STORE_OK: strncat(state, "STORE-OK", sizeof(state)); break; diff -cr squid-1.0.beta1/src/store.c squid-1.0.beta2/src/store.c *** squid-1.0.beta1/src/store.c Fri Apr 19 15:08:14 1996 --- squid-1.0.beta2/src/store.c Sun Apr 21 18:48:36 1996 *************** *** 1,6 **** ! /* $Id: store.c,v 1.61.4.1 1996/04/19 22:08:14 wessels Exp $ */ ! #ident "$Id: store.c,v 1.61.4.1 1996/04/19 22:08:14 wessels Exp $" /* * DEBUG: Section 20 store --- 1,5 ---- ! /* $Id: store.c,v 1.61.4.4 1996/04/22 01:48:36 wessels Exp $ */ /* * DEBUG: Section 20 store *************** *** 229,235 **** /* * maintain the in-mem hash table according to the changes of mem_status ! * This routine replaces the instruction "e->status = status;" */ void storeSetMemStatus(e, status) --- 228,234 ---- /* * maintain the in-mem hash table according to the changes of mem_status ! * This routine replaces the instruction "e->store_status = status;" */ void storeSetMemStatus(e, status) *************** *** 394,400 **** if ((e->mem_status == NOT_IN_MEMORY) && /* Not in memory */ (e->swap_status != SWAP_OK) && /* Not on disk */ ! (e->status != STORE_PENDING) /* Not being fetched */ ) { debug(20, 0, "storeLockObject: NOT_IN_MEMORY && !SWAP_OK && !STORE_PENDING conflict: . aborting...\n", e->url); /* If this sanity check fails, we should just ... */ --- 393,399 ---- if ((e->mem_status == NOT_IN_MEMORY) && /* Not in memory */ (e->swap_status != SWAP_OK) && /* Not on disk */ ! (e->store_status != STORE_PENDING) /* Not being fetched */ ) { debug(20, 0, "storeLockObject: NOT_IN_MEMORY && !SWAP_OK && !STORE_PENDING conflict: . aborting...\n", e->url); /* If this sanity check fails, we should just ... */ *************** *** 633,639 **** if (BIT_TEST(flags, REQ_HTML)) BIT_SET(e->flag, ENTRY_HTML); ! e->status = STORE_PENDING; storeSetMemStatus(e, NOT_IN_MEMORY); e->swap_status = NO_SWAP; e->swap_file_number = -1; --- 632,638 ---- if (BIT_TEST(flags, REQ_HTML)) BIT_SET(e->flag, ENTRY_HTML); ! e->store_status = STORE_PENDING; storeSetMemStatus(e, NOT_IN_MEMORY); e->swap_status = NO_SWAP; e->swap_file_number = -1; *************** *** 686,692 **** BIT_SET(e->flag, CACHABLE); BIT_RESET(e->flag, RELEASE_REQUEST); BIT_SET(e->flag, ENTRY_HTML); ! e->status = STORE_OK; storeSetMemStatus(e, NOT_IN_MEMORY); e->swap_status = SWAP_OK; e->swap_file_number = file_number; --- 685,691 ---- BIT_SET(e->flag, CACHABLE); BIT_RESET(e->flag, RELEASE_REQUEST); BIT_SET(e->flag, ENTRY_HTML); ! e->store_status = STORE_OK; storeSetMemStatus(e, NOT_IN_MEMORY); e->swap_status = SWAP_OK; e->swap_file_number = file_number; *************** *** 918,924 **** debug(20, 8, "storeAppend: e_current_len = %d\n", e->mem_obj->e_current_len); } ! if ((e->status != STORE_ABORTED) && !(e->flag & DELAY_SENDING)) InvokeHandlers(e); } --- 917,923 ---- debug(20, 8, "storeAppend: e_current_len = %d\n", e->mem_obj->e_current_len); } ! if ((e->store_status != STORE_ABORTED) && !(e->flag & DELAY_SENDING)) InvokeHandlers(e); } *************** *** 1515,1521 **** e->object_len = e->mem_obj->e_current_len; InvokeHandlers(e); e->lastref = squid_curtime; ! e->status = STORE_OK; storeSetMemStatus(e, IN_MEMORY); e->swap_status = NO_SWAP; if (storeCheckSwapable(e)) --- 1514,1520 ---- e->object_len = e->mem_obj->e_current_len; InvokeHandlers(e); e->lastref = squid_curtime; ! e->store_status = STORE_OK; storeSetMemStatus(e, IN_MEMORY); e->swap_status = NO_SWAP; if (storeCheckSwapable(e)) *************** *** 1541,1547 **** debug(20, 6, "storeAbort: '%s'\n", e->key); e->expires = squid_curtime + getNegativeTTL(); ! e->status = STORE_ABORTED; storeSetMemStatus(e, IN_MEMORY); /* No DISK swap for negative cached object */ e->swap_status = NO_SWAP; --- 1540,1546 ---- debug(20, 6, "storeAbort: '%s'\n", e->key); e->expires = squid_curtime + getNegativeTTL(); ! e->store_status = STORE_ABORTED; storeSetMemStatus(e, IN_MEMORY); /* No DISK swap for negative cached object */ e->swap_status = NO_SWAP; *************** *** 1676,1682 **** debug(20, 6, "removeOldEntry: * time-to-live: %8ld\n", e->expires - squid_curtime); ! if ((squid_curtime > e->expires) && (e->status != STORE_PENDING)) { return (storeRelease(e) == 0 ? 1 : 0); } return 0; --- 1675,1681 ---- debug(20, 6, "removeOldEntry: * time-to-live: %8ld\n", e->expires - squid_curtime); ! if ((squid_curtime > e->expires) && (e->store_status != STORE_PENDING)) { return (storeRelease(e) == 0 ? 1 : 0); } return 0; *************** *** 1736,1742 **** n_inmem++; ! if (e->status == STORE_PENDING) { if (!(e->flag & DELETE_BEHIND)) { /* it's not deleting behind, we can do something about it. */ insert_dynamic_array(pending_entry_list, e); --- 1735,1741 ---- n_inmem++; ! if (e->store_status == STORE_PENDING) { if (!(e->flag & DELETE_BEHIND)) { /* it's not deleting behind, we can do something about it. */ insert_dynamic_array(pending_entry_list, e); *************** *** 1753,1759 **** if ((e->swap_status == SWAP_OK) && (e->mem_status != SWAPPING_IN) && (e->lock_count == 0)) { insert_dynamic_array(LRU_list, e); ! } else if (((e->status == STORE_ABORTED) || (e->swap_status == NO_SWAP)) && (e->lock_count == 0)) { n_aborted++; --- 1752,1758 ---- if ((e->swap_status == SWAP_OK) && (e->mem_status != SWAPPING_IN) && (e->lock_count == 0)) { insert_dynamic_array(LRU_list, e); ! } else if (((e->store_status == STORE_ABORTED) || (e->swap_status == NO_SWAP)) && (e->lock_count == 0)) { n_aborted++; *************** *** 1789,1795 **** /* look for vm slot */ for (i = 0; (i < LRU_list->index) && (meta_data.hot_vm > store_hotobj_low); ++i) { if ((LRU = (StoreEntry *) LRU_list->collection[i])) ! if ((LRU->status != STORE_PENDING) && (LRU->swap_status == NO_SWAP)) { n_released++; storeRelease(LRU); } else { --- 1788,1794 ---- /* look for vm slot */ for (i = 0; (i < LRU_list->index) && (meta_data.hot_vm > store_hotobj_low); ++i) { if ((LRU = (StoreEntry *) LRU_list->collection[i])) ! if ((LRU->store_status != STORE_PENDING) && (LRU->swap_status == NO_SWAP)) { n_released++; storeRelease(LRU); } else { *************** *** 1801,1807 **** /* look for space */ for (i = 0; (i < LRU_list->index) && ((store_mem_size + size) > store_mem_low); ++i) { if ((LRU = (StoreEntry *) LRU_list->collection[i])) ! if ((LRU->status != STORE_PENDING) && (LRU->swap_status == NO_SWAP)) { n_released++; storeRelease(LRU); } else { --- 1800,1806 ---- /* look for space */ for (i = 0; (i < LRU_list->index) && ((store_mem_size + size) > store_mem_low); ++i) { if ((LRU = (StoreEntry *) LRU_list->collection[i])) ! if ((LRU->store_status != STORE_PENDING) && (LRU->swap_status == NO_SWAP)) { n_released++; storeRelease(LRU); } else { *************** *** 1972,1978 **** e = (StoreEntry *) link_ptr; /* Identify objects that aren't locked, for replacement */ ! if ((e->status != STORE_PENDING) && /* We're still fetching the object */ (e->swap_status == SWAP_OK) && /* Only release it if it is on disk */ (e->lock_count == 0) && /* Be overly cautious */ (e->mem_status != SWAPPING_IN)) { /* Not if it's being faulted into memory */ --- 1971,1977 ---- e = (StoreEntry *) link_ptr; /* Identify objects that aren't locked, for replacement */ ! if ((e->store_status != STORE_PENDING) && /* We're still fetching the object */ (e->swap_status == SWAP_OK) && /* Only release it if it is on disk */ (e->lock_count == 0) && /* Be overly cautious */ (e->mem_status != SWAPPING_IN)) { /* Not if it's being faulted into memory */ *************** *** 2167,2173 **** fatal_dump(NULL); } return ((e->lock_count) || ! (e->status == STORE_PENDING) || (e->swap_status == SWAPPING_OUT) || (e->mem_status == SWAPPING_IN) ); --- 2166,2172 ---- fatal_dump(NULL); } return ((e->lock_count) || ! (e->store_status == STORE_PENDING) || (e->swap_status == SWAPPING_OUT) || (e->mem_status == SWAPPING_IN) ); *************** *** 2327,2333 **** { if (squid_curtime < e->expires) return 1; ! if (e->expires == 0 && e->status == STORE_PENDING) return 1; return 0; } --- 2326,2332 ---- { if (squid_curtime < e->expires) return 1; ! if (e->expires == 0 && e->store_status == STORE_PENDING) return 1; return 0; } diff -cr squid-1.0.beta1/src/store.h squid-1.0.beta2/src/store.h *** squid-1.0.beta1/src/store.h Mon Apr 15 21:23:17 1996 --- squid-1.0.beta2/src/store.h Sat Apr 20 13:03:47 1996 *************** *** 1,5 **** ! /* $Id: store.h,v 1.26 1996/04/16 04:23:17 wessels Exp $ */ #ifndef _STORE_H_ #define _STORE_H_ --- 1,5 ---- ! /* $Id: store.h,v 1.26.2.1 1996/04/20 20:03:47 wessels Exp $ */ #ifndef _STORE_H_ #define _STORE_H_ *************** *** 86,91 **** --- 86,116 ---- request_t *request; } MemObject; + typedef enum { + NOT_IN_MEMORY, + SWAPPING_IN, + IN_MEMORY + } mem_status_t; + + typedef enum { + WAITING, + TIMEOUT, + DONE, + NOPING + } ping_status_t; + + typedef enum { + STORE_OK, + STORE_PENDING, + STORE_ABORTED + } store_status_t; + + typedef enum { + NO_SWAP, + SWAPPING_OUT, + SWAP_OK + } swap_status_t; + /* A cut down structure for store manager */ struct sentry { /* first two items must be same as hash_link in hash.h */ *************** *** 105,123 **** int object_len; int swap_file_number; ! enum { ! NOT_IN_MEMORY, SWAPPING_IN, IN_MEMORY ! } mem_status:3; ! enum { ! WAITING, TIMEOUT, DONE, NOPING ! } ping_status:3; ! enum { ! STORE_OK, STORE_PENDING, STORE_ABORTED ! } status:3; ! enum { ! NO_SWAP, SWAPPING_OUT, SWAP_OK ! } swap_status:3; ! unsigned int method:3; /* WARNING: Explicit assummption that fewer than 256 * WARNING: clients all hop onto the same object. The code --- 130,140 ---- int object_len; int swap_file_number; ! mem_status_t mem_status:3; ! ping_status_t ping_status:3; ! store_status_t store_status:3; ! swap_status_t swap_status:3; ! method_t method:3; /* WARNING: Explicit assummption that fewer than 256 * WARNING: clients all hop onto the same object. The code diff -cr squid-1.0.beta1/src/storetoString.c squid-1.0.beta2/src/storetoString.c *** squid-1.0.beta1/src/storetoString.c Mon Apr 15 22:05:32 1996 --- squid-1.0.beta2/src/storetoString.c Sat Apr 20 13:11:13 1996 *************** *** 1,4 **** ! /* $Id: storetoString.c,v 1.8 1996/04/16 05:05:32 wessels Exp $ */ #include "squid.h" --- 1,4 ---- ! /* $Id: storetoString.c,v 1.8.2.1 1996/04/20 20:11:13 wessels Exp $ */ #include "squid.h" *************** *** 75,81 **** strcat(stsbuf, tmpbuf); sprintf(tmpbuf, "Status: "); ! switch (e->status) { case STORE_OK: strcat(tmpbuf, "STORE_OK\n"); --- 75,81 ---- strcat(stsbuf, tmpbuf); sprintf(tmpbuf, "Status: "); ! switch (e->store_status) { case STORE_OK: strcat(tmpbuf, "STORE_OK\n"); diff -cr squid-1.0.beta1/src/tools.c squid-1.0.beta2/src/tools.c *** squid-1.0.beta1/src/tools.c Fri Apr 19 15:09:09 1996 --- squid-1.0.beta2/src/tools.c Sat Apr 20 12:42:21 1996 *************** *** 1,5 **** ! /* $Id: tools.c,v 1.40.2.3 1996/04/19 22:09:09 wessels Exp $ */ /* * DEBUG: Section 21 tools --- 1,5 ---- ! /* $Id: tools.c,v 1.40.2.4 1996/04/20 19:42:21 wessels Exp $ */ /* * DEBUG: Section 21 tools *************** *** 341,351 **** return; if ((pwd = getpwnam(getEffectiveUser())) == NULL) return; - /* change current directory to swap space so we can get core */ - if (chdir(swappath(0)) < 0) { - debug(21, 0, "%s: %s\n", swappath(0), xstrerror()); - fatal_dump("Cannot cd to swap directory?"); - } if (getEffectiveGroup() && (grp = getgrnam(getEffectiveGroup()))) { setgid(grp->gr_gid); } else { --- 341,346 ---- diff -cr squid-1.0.beta1/src/url.c squid-1.0.beta2/src/url.c *** squid-1.0.beta1/src/url.c Fri Apr 19 09:46:57 1996 --- squid-1.0.beta2/src/url.c Sat Apr 20 12:42:52 1996 *************** *** 1,4 **** ! /* $Id: url.c,v 1.19.2.1 1996/04/19 16:46:57 wessels Exp $ */ /* * DEBUG: Section 23 url --- 1,4 ---- ! /* $Id: url.c,v 1.19.2.3 1996/04/20 19:42:52 wessels Exp $ */ /* * DEBUG: Section 23 url *************** *** 127,132 **** --- 127,134 ---- #endif if (strncasecmp(s, "gopher", 6) == 0) return PROTO_GOPHER; + if (strncasecmp(s, "wais", 4) == 0) + return PROTO_WAIS; if (strncasecmp(s, "cache_object", 12) == 0) return PROTO_CACHEOBJ; if (strncasecmp(s, "file", 4) == 0) *************** *** 145,150 **** --- 147,154 ---- return 21; case PROTO_GOPHER: return 70; + case PROTO_WAIS: + return 210; case PROTO_CACHEOBJ: return CACHE_HTTP_PORT; default: