- report all error pages to the debug log
- Added -i option which forces IP cache entry to be invalidated
just after an object retrieval begins.
+ - Includes all squid-1.0 changes up to squid-1.0.10.
Changes to squid-1.1.alpha11:
==============================================================================
+Changes to squid-1.0.10 (August 26, 1996):
+
+ - Fixed INADDR_NONE not being set for ftpget.c.
+ - Remove "Connection: Keep-Alive" lines from HTTP requests
+ since Squid doesn't support them.
+ - Fixed IP Address/netmask bug. Now 1.2.3.4/255.255.255.0 is
+ equivalent to 1.2.3.0/255.255.255.0.
+
+Changes to squid-1.0.9 (August 22, 1996):
+
+ - Cleaned up ipcache_purgerlu().
+ - Fixed ipcache_gethostbyname() to release expired entries.
+ - Added check for numeric addresses to ipcache_nbgethostbyname().
+ - Added Date: field to ftpget's HTTP header output.
+ - Added temporary hack to httpProcessReplyHeaders() to allow
+ caching of non-HTTP objects fetched from neighbors when
+ the header does not have Date, Expires, or Last-Modified.
+ - Added a check for a valid ICP socket before sending ICP
+ queries.
+ - Fixed SSL code to unregister DNS lookups if client aborts.
+ - Removed lib/host_cache.c from distribution.
+ - Made IP cache stats output sorted by last reference.
+ - Added ICP internet-draft to docs directory.
+
Changes to squid-1.0.8 (August 19, 1996):
- Added ftpget fixes from carson@lehman.com and moy@parc.xerox.com.
/*
- * $Id: util.h,v 1.8 1996/07/22 16:41:04 wessels Exp $
+ * $Id: util.h,v 1.9 1996/08/26 19:56:59 wessels Exp $
*
* AUTHOR: Harvest Derived
*
#endif
void debug_flag _PARAMS((char *));
-#ifdef UNUSED_CODE
-void debug_enable _PARAMS((int, int));
-void debug_disable _PARAMS((int));
-void debug_reset _PARAMS((void));
-int debug_ok _PARAMS((int, int));
-#endif /* UNUSED_CODE */
-
-#define HOST_CACHE_TTL 3600
-
-typedef struct _host {
- char key[SQUIDHOSTNAMELEN]; /* www.bar.com */
- char fqdn[SQUIDHOSTNAMELEN]; /* real.bar.com */
- char dotaddr[16]; /* 128.138.213.10 */
- char ipaddr[4];
- time_t last_t; /* last access of this info */
- int n; /* # of requests for this host */
- int addrlen; /* length of 'ipaddr', always 4 */
- struct _host *next;
-} Host;
-
-extern Host *thisHost;
-
-Host *get_host _PARAMS((char *hostname));
-int delete_host _PARAMS((Host * h));
-int expire_host_cache _PARAMS((time_t timeout));
-#ifdef UNUSED_CODE
-void dump_host_cache _PARAMS((int, int));
-#endif
char *mkhttpdlogtime _PARAMS((time_t *));
extern char *mkrfc850 _PARAMS((time_t *));
#
# Darren Hardy, hardy@cs.colorado.edu, April 1994
#
-# $Id: Makefile.in,v 1.10 1996/07/16 01:50:15 wessels Exp $
+# $Id: Makefile.in,v 1.11 1996/08/26 19:57:00 wessels Exp $
#
prefix = @prefix@
srcdir = @srcdir@
UTILOBJS = rfc850.o \
rfc1738.o \
util.o \
- host_cache.o \
getfullhostname.o \
debug.o \
log.o \
/*
- * $Id: acl.cc,v 1.27 1996/08/19 22:44:48 wessels Exp $
+ * $Id: acl.cc,v 1.28 1996/08/26 19:57:02 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
static wordlist *aclParseWordList _PARAMS((void));
static wordlist *aclParseDomainList _PARAMS((void));
static squid_acl aclType _PARAMS((char *s));
+static int decode_addr _PARAMS((char *, struct in_addr *, struct in_addr *));
static squid_acl aclType(s)
char *s;
mask->s_addr = htonl(0xFFFFFF00);
else
mask->s_addr = htonl(0xFFFFFFFF);
+ addr->s_addr &= mask->s_addr;
+ /* 1.2.3.4/255.255.255.0 --> 1.2.3.0 */
}
return 1;
}
/*
- * $Id: cachemgr.cc,v 1.15 1996/08/21 20:11:54 wessels Exp $
+ * $Id: cachemgr.cc,v 1.16 1996/08/26 19:57:02 wessels Exp $
*
* DEBUG: Section 0 CGI Cache Manager
* AUTHOR: Harvest Derived
sscanf(reserve, "%s %d %d %d %d %f %d %d %d",
s1, &d1, &d2, &d3, &d4, &f1, &d5, &d6, &d7);
if (hasTables)
- printf("<tr><td><B>%s</B><td>%d<td>%d<td>%d<td>%d<td>%4.2f<td>%d<td>%d<td>%d",
+ printf("<tr><td align=right><B>%s</B><td align=right>%d<td align=right>%d<td align=right>%d<td align=right>%d<td align=right>%4.2f<td align=right>%d<td align=right>%d<td align=right>%d",
s1, d1, d2, d3, d4, f1, d5, d6, d7);
else
printf("%8s %7d %10d %10d %9d %4.2f %10d %10d %10d<BR>\n",
/*
- * $Id: comm.cc,v 1.57 1996/08/26 19:09:34 wessels Exp $
+ * $Id: comm.cc,v 1.58 1996/08/26 19:57:03 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
FD_ZERO(&write_x);
FD_ZERO(&except_x);
tv.tv_sec = tv.tv_usec = 0;
- if ((FD_ISSET(fd, readfds)) ||
- (FD_ISSET(fd, writefds)) ||
- (FD_ISSET(fd, exceptfds))) {
+ if (FD_ISSET(fd, readfds))
FD_SET(fd, &read_x);
- num = select(FD_SETSIZE, &read_x, &read_x, &read_x, &tv);
- if (num < 0) {
- f = &fd_table[fd];
- debug(5, 0, "WARNING: FD %d has handlers, but it's invalid.\n", fd);
- debug(5, 0, "FD %d is a %s\n", fd, fdstatTypeStr[fdstatGetType(fd)]);
- debug(5, 0, "--> %s\n", fd_note(fd, NULL));
- debug(5, 0, "lifetm:%p tmout:%p read:%p write:%p expt:%p\n",
- f->lifetime_handler,
- f->timeout_handler,
- f->read_handler,
- f->write_handler,
- f->except_handler);
- for (ch = f->close_handler; ch; ch = ch->next)
- debug(5, 0, " close handler: %p\n", ch->handler);
- if (f->close_handler) {
- for (ch = f->close_handler; ch; ch = next) {
- next = ch->next;
- ch->handler(fd, ch->data);
- safe_free(ch);
- }
- } else if (f->lifetime_handler) {
- debug(5, 0, "examine_select: Calling Lifetime Handler\n");
- f->lifetime_handler(fd, f->lifetime_data);
- } else if (f->timeout_handler) {
- debug(5, 0, "examine_select: Calling Timeout Handler\n");
- f->timeout_handler(fd, f->timeout_data);
- }
- f->close_handler = 0;
- f->lifetime_handler = 0;
- f->timeout_handler = 0;
- f->read_handler = 0;
- f->write_handler = 0;
- f->except_handler = 0;
- FD_CLR(fd, readfds);
- FD_CLR(fd, writefds);
- FD_CLR(fd, exceptfds);
+ else if (FD_ISSET(fd, writefds))
+ FD_SET(fd, &write_x);
+ else if (FD_ISSET(fd, exceptfds))
+ FD_SET(fd, &except_x);
+ else
+ continue;
+ num = select(FD_SETSIZE, &read_x, &write_x, &except_x, &tv);
+ if (num > -1) {
+ debug(5, 5, "FD %d is valid.\n", fd);
+ continue;
+ }
+ f = &fd_table[fd];
+ debug(5, 0, "WARNING: FD %d has handlers, but it's invalid.\n", fd);
+ debug(5, 0, "FD %d is a %s\n", fd, fdstatTypeStr[fdstatGetType(fd)]);
+ debug(5, 0, "--> %s\n", fd_note(fd, NULL));
+ debug(5, 0, "lifetm:%p tmout:%p read:%p write:%p expt:%p\n",
+ f->lifetime_handler,
+ f->timeout_handler,
+ f->read_handler,
+ f->write_handler,
+ f->except_handler);
+ for (ch = f->close_handler; ch; ch = ch->next)
+ debug(5, 0, " close handler: %p\n", ch->handler);
+ if (f->close_handler) {
+ for (ch = f->close_handler; ch; ch = next) {
+ next = ch->next;
+ ch->handler(fd, ch->data);
+ safe_free(ch);
}
+ } else if (f->lifetime_handler) {
+ debug(5, 0, "examine_select: Calling Lifetime Handler\n");
+ f->lifetime_handler(fd, f->lifetime_data);
+ } else if (f->timeout_handler) {
+ debug(5, 0, "examine_select: Calling Timeout Handler\n");
+ f->timeout_handler(fd, f->timeout_data);
}
+ f->close_handler = NULL;
+ f->lifetime_handler = NULL;
+ f->timeout_handler = NULL;
+ f->read_handler = NULL;
+ f->write_handler = NULL;
+ f->except_handler = NULL;
+ FD_CLR(fd, readfds);
+ FD_CLR(fd, writefds);
+ FD_CLR(fd, exceptfds);
}
return 0;
}
/*
- * $Id: dnsserver.cc,v 1.12 1996/08/19 22:44:51 wessels Exp $
+ * $Id: dnsserver.cc,v 1.13 1996/08/26 19:57:04 wessels Exp $
*
* DEBUG: section 0 DNS Resolver
* AUTHOR: Harvest Derived
* re-implementations of code complying to this set of standards.
*/
-#include "squid.h"
+
+
+
+#include "config.h"
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_GRP_H
+#include <grp.h>
+#endif
+#if HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#include <malloc.h>
+#endif
+#if HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#if HAVE_NETDB_H && !defined(_SQUID_NETDB_H_) /* protect NEXTSTEP */
+#define _SQUID_NETDB_H_
+#include <netdb.h>
+#endif
+#if HAVE_PWD_H
+#include <pwd.h>
+#endif
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#if HAVE_TIME_H
+#include <time.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h> /* needs sys/time.h above it */
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_LIBC_H
+#include <libc.h>
+#endif
+#ifdef HAVE_SYS_SYSCALL_H
+#include <sys/syscall.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#if HAVE_BSTRING_H
+#include <bstring.h>
+#endif
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
#if HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#include <resolv.h>
#endif
+#ifndef INADDR_NONE
+#define INADDR_NONE -1
+#endif
+
+#include "util.h"
+
extern int h_errno;
int do_debug = 0;
/*
- * $Id: http.cc,v 1.68 1996/08/26 19:16:06 wessels Exp $
+ * $Id: http.cc,v 1.69 1996/08/26 19:57:05 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
httpMakePublic(entry);
else if (*reply->expires)
httpMakePublic(entry);
+ else if (entry->mem_obj->request->protocol != PROTO_HTTP)
+ /* XXX Remove this check after a while. DW 8/21/96
+ * We won't keep some FTP objects from neighbors running
+ * 1.0.8 or earlier because their ftpget's don't
+ * add a Date: field */
+ httpMakePublic(entry);
else
httpMakePrivate(entry);
break;
memset(ybuf, '\0', SM_PAGE_SIZE);
sprintf(ybuf, "%s %s %s", t, VIA_PROXY_TEXT, version_string);
t = ybuf;
- }
+ } else if (strncasecmp(t, "Connection:", 11) == 0)
+ continue;
if (len + (int) strlen(t) > buflen - 10)
continue;
strcat(buf, t);
/*
- * $Id: ipcache.cc,v 1.42 1996/08/26 19:17:59 wessels Exp $
+ * $Id: ipcache.cc,v 1.43 1996/08/26 19:57:07 wessels Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
static int ipcache_testname _PARAMS((void));
static int ipcache_compareLastRef _PARAMS((ipcache_entry **, ipcache_entry **));
+static int ipcache_reverseLastRef _PARAMS((ipcache_entry **, ipcache_entry **));
static int ipcache_dnsHandleRead _PARAMS((int, dnsserver_t *));
static int ipcache_parsebuffer _PARAMS((char *buf, unsigned int offset, dnsserver_t *));
static void ipcache_release _PARAMS((ipcache_entry *));
static void ipcacheEnqueue _PARAMS((ipcache_entry *));
static void *ipcacheDequeue _PARAMS((void));
static void ipcache_dnsDispatch _PARAMS((dnsserver_t *, ipcache_entry *));
+static struct hostent *ipcacheCheckNumeric _PARAMS((char *name));
+static void ipcacheStatPrint _PARAMS((ipcache_entry *, StoreEntry *));
static struct hostent *static_result = NULL;
static HashID ip_table = 0;
return (0);
}
+static int ipcache_reverseLastRef(e1, e2)
+ ipcache_entry **e1, **e2;
+{
+ if ((*e1)->lastref < (*e2)->lastref)
+ return (1);
+ if ((*e1)->lastref > (*e2)->lastref)
+ return (-1);
+ return (0);
+}
+
static int ipcacheExpiredEntry(i)
ipcache_entry *i;
{
return 0;
if (i->status == IP_DISPATCHED)
return 0;
- if (i->ttl + i->timestamp > squid_curtime)
+ if (i->expires > squid_curtime)
return 0;
return 1;
}
int k;
ipcache_entry **LRU_list = NULL;
int LRU_list_count = 0;
- int LRU_cur_size = meta_data.ipcache_count;
- LRU_list = xcalloc(LRU_cur_size, sizeof(ipcache_entry *));
+ LRU_list = xcalloc(meta_data.ipcache_count, sizeof(ipcache_entry *));
for (i = ipcache_GetFirst(); i; i = ipcache_GetNext()) {
if (ipcacheExpiredEntry(i)) {
}
local_ip_count++;
- if (LRU_list_count >= LRU_cur_size) {
- /* have to realloc */
- LRU_cur_size += 16;
- debug(14, 3, "ipcache_purgelru: Have to grow LRU_list to %d. This shouldn't happen.\n",
- LRU_cur_size);
- LRU_list = xrealloc((char *) LRU_list,
- LRU_cur_size * sizeof(ipcache_entry *));
- }
+ if (LRU_list_count == meta_data.ipcache_count)
+ break;
if (i->status == IP_PENDING)
continue;
if (i->status == IP_DISPATCHED)
LRU_list_count,
sizeof(ipcache_entry *),
(QS) ipcache_compareLastRef);
- for (k = 0; LRU_list[k] && (meta_data.ipcache_count > ipcache_low)
- && k < LRU_list_count;
- ++k) {
+ for (k = 0; k < LRU_list_count; k++) {
+ if (meta_data.ipcache_count < ipcache_low)
+ break;
+ if (LRU_list[k] == NULL)
+ break;
ipcache_release(LRU_list[k]);
removed++;
}
/* set default to 4, in case parser fail to get token $h_length from
* dnsserver. */
new->entry.h_length = 4;
+ new->expires = squid_curtime + Config.negativeDnsTtl;
return new;
}
}
i->entry.h_length = hp->h_length;
i->entry.h_name = xstrdup(hp->h_name);
- i->lastref = i->timestamp = squid_curtime;
i->status = IP_CACHED;
- i->ttl = Config.positiveDnsTtl;
+ i->expires = squid_curtime + Config.positiveDnsTtl;
} else {
- i->lastref = i->timestamp = squid_curtime;
i->status = IP_NEGATIVE_CACHED;
- i->ttl = Config.negativeDnsTtl;
+ i->expires = squid_curtime + Config.negativeDnsTtl;
}
ipcache_add_to_hash(i);
}
} else {
line_cur = line_head->next;
i = dnsData->data;
- i->lastref = i->timestamp = squid_curtime;
- i->ttl = Config.negativeDnsTtl;
+ i->expires = squid_curtime + Config.negativeDnsTtl;
i->status = IP_NEGATIVE_CACHED;
if (line_cur && !strncmp(line_cur->line, "$message", 8))
i->error_message = xstrdup(line_cur->line + 8);
if (i->status != IP_DISPATCHED) {
debug(14, 0, "ipcache_parsebuffer: DNS record already resolved.\n");
} else {
- i->lastref = i->timestamp = squid_curtime;
- i->ttl = Config.positiveDnsTtl;
+ i->expires = squid_curtime + Config.positiveDnsTtl;
i->status = IP_CACHED;
line_cur = line_head->next;
{
struct _ip_pending *pending = xcalloc(1, sizeof(struct _ip_pending));
struct _ip_pending **I = NULL;
-
+ i->lastref = squid_curtime;
pending->fd = fd;
pending->handler = handler;
pending->handlerData = handlerData;
-
for (I = &(i->pending_head); *I; I = &((*I)->next));
*I = pending;
}
-int ipcache_nbgethostbyname(name, fd, handler, handlerData)
+void ipcache_nbgethostbyname(name, fd, handler, handlerData)
char *name;
int fd;
IPH handler;
{
ipcache_entry *i = NULL;
dnsserver_t *dnsData = NULL;
+ struct hostent *hp = NULL;
if (!handler)
fatal_dump("ipcache_nbgethostbyname: NULL handler");
if (name == NULL || name[0] == '\0') {
debug(14, 4, "ipcache_nbgethostbyname: Invalid name!\n");
ipcache_call_pending_badname(fd, handler, handlerData);
- return 0;
+ return;
+ }
+ if ((hp = ipcacheCheckNumeric(name))) {
+ handler(fd, hp, handlerData);
+ return;
}
if ((i = ipcache_get(name))) {
if (ipcacheExpiredEntry(i)) {
IpcacheStats.hits++;
ipcacheAddPending(i, fd, handler, handlerData);
ipcache_call_pending(i);
- return 0;
+ return;
} else if (i->status == IP_PENDING || i->status == IP_DISPATCHED) {
debug(14, 4, "ipcache_nbgethostbyname: PENDING for '%s'\n", name);
IpcacheStats.pending_hits++;
ipcacheAddPending(i, fd, handler, handlerData);
- return 0;
+ return;
} else {
fatal_dump("ipcache_nbgethostbyname: BAD ipcache_entry status");
}
ipcache_dnsDispatch(dnsData, i);
else
ipcacheEnqueue(i);
- return 0;
}
static void ipcache_dnsDispatch(dns, i)
{
ipcache_entry *i = NULL;
struct hostent *hp = NULL;
- unsigned int ip;
if (!name)
fatal_dump("ipcache_gethostbyname: NULL name");
IpcacheStats.requests++;
if ((i = ipcache_get(name))) {
+ if (ipcacheExpiredEntry(i)) {
+ ipcache_release(i);
+ i = NULL;
+ }
+ }
+ if (i) {
if (i->status == IP_PENDING || i->status == IP_DISPATCHED) {
IpcacheStats.pending_hits++;
return NULL;
}
}
IpcacheStats.misses++;
- /* check if it's already a IP address in text form. */
- if ((ip = inet_addr(name)) != INADDR_NONE) {
- *((u_num32 *) (void *) (*static_result->h_addr_list + 0)) = ip;
- strncpy(static_result->h_name, name, MAX_HOST_NAME);
- return static_result;
- }
+ if ((hp = ipcacheCheckNumeric(name)))
+ return hp;
if (flags & IP_BLOCKING_LOOKUP) {
IpcacheStats.ghbn_calls++;
hp = gethostbyname(name);
/* good address, cached */
ipcache_add(name, ipcache_create(), hp, 1);
i = ipcache_get(name);
+ i->lastref = squid_curtime;
+ i->expires = squid_curtime + Config.positiveDnsTtl;
return &i->entry;
}
/* bad address, negative cached */
- if (ip_table)
+ if (ip_table) {
ipcache_add(name, ipcache_create(), hp, 0);
- return NULL;
+ i = ipcache_get(name);
+ i->lastref = squid_curtime;
+ i->expires = squid_curtime + Config.negativeDnsTtl;
+ return NULL;
+ }
}
if (flags & IP_LOOKUP_IF_MISS)
ipcache_nbgethostbyname(name, -1, dummy_handler, NULL);
return NULL;
}
+static void ipcacheStatPrint(i, sentry)
+ ipcache_entry *i;
+ StoreEntry *sentry;
+{
+ int k;
+ storeAppendPrintf(sentry, " {%-32.32s %c %6d %6d %d",
+ i->name,
+ ipcache_status_char[i->status],
+ (int) (squid_curtime - i->lastref),
+ (int) (i->expires - squid_curtime),
+ i->addr_count);
+ for (k = 0; k < (int) i->addr_count; k++) {
+ struct in_addr addr;
+ xmemcpy(&addr, i->entry.h_addr_list[k], i->entry.h_length);
+ storeAppendPrintf(sentry, " %15s", inet_ntoa(addr));
+ }
+ for (k = 0; k < (int) i->alias_count; k++) {
+ storeAppendPrintf(sentry, " %s", i->entry.h_aliases[k]);
+ }
+ if (i->entry.h_name && strncmp(i->name, i->entry.h_name, MAX_LINELEN)) {
+ storeAppendPrintf(sentry, " %s", i->entry.h_name);
+ }
+ storeAppendPrintf(sentry, close_bracket);
+}
/* process objects list */
void stat_ipcache_get(sentry)
StoreEntry *sentry;
{
- ipcache_entry *i = NULL;
int k;
- int ttl;
-
+ int N;
+ ipcache_entry *i = NULL;
+ ipcache_entry **list = NULL;
if (!ip_table)
return;
-
storeAppendPrintf(sentry, "{IP Cache Statistics:\n");
storeAppendPrintf(sentry, "{IPcache Entries: %d}\n",
meta_data.ipcache_count);
IpcacheStats.avg_svc_time);
storeAppendPrintf(sentry, "}\n\n");
storeAppendPrintf(sentry, "{IP Cache Contents:\n\n");
-
+ storeAppendPrintf(sentry, " {%-29.29s %5s %6s %6s %1s}\n",
+ "Hostname",
+ "Flags",
+ "lstref",
+ "TTL",
+ "N");
+ list = xcalloc(meta_data.ipcache_count, sizeof(ipcache_entry *));
+ N = 0;
for (i = ipcache_GetFirst(); i; i = ipcache_GetNext()) {
- if (i->status == IP_PENDING || i->status == IP_DISPATCHED)
- ttl = 0;
- else
- ttl = (i->ttl + i->timestamp - squid_curtime);
- storeAppendPrintf(sentry, " {%-32.32s %c %6d %d",
- i->name,
- ipcache_status_char[i->status],
- ttl,
- (int) i->addr_count);
- for (k = 0; k < (int) i->addr_count; k++) {
- struct in_addr addr;
- xmemcpy(&addr, *(i->entry.h_addr_list + k), i->entry.h_length);
- storeAppendPrintf(sentry, " %15s", inet_ntoa(addr));
- }
- for (k = 0; k < (int) i->alias_count; k++) {
- storeAppendPrintf(sentry, " %s", i->entry.h_aliases[k]);
- }
- if (i->entry.h_name && strncmp(i->name, i->entry.h_name, MAX_LINELEN)) {
- storeAppendPrintf(sentry, " %s", i->entry.h_name);
- }
- storeAppendPrintf(sentry, close_bracket);
+ *(list + N) = i;
+ if (++N > meta_data.ipcache_count)
+ fatal_dump("stat_ipcache_get: meta_data.ipcache_count mismatch");
}
+ qsort((char *) list,
+ N,
+ sizeof(ipcache_entry *),
+ (QS) ipcache_reverseLastRef);
+ for (k = 0; k < N; k++)
+ ipcacheStatPrint(*(list + k), sentry);
storeAppendPrintf(sentry, close_bracket);
}
if ((i = ipcache_get(name)) == NULL)
return;
if (i->status != IP_CACHED)
- i->ttl = 0;
+ i->expires = squid_curtime;
else
ipcache_release(i);
}
+
+static struct hostent *ipcacheCheckNumeric(name)
+ char *name;
+{
+ unsigned int ip;
+ /* check if it's already a IP address in text form. */
+ if ((ip = inet_addr(name)) == INADDR_NONE)
+ return NULL;
+ *((u_num32 *) (void *) static_result->h_addr_list[0]) = ip;
+ strncpy(static_result->h_name, name, MAX_HOST_NAME);
+ return static_result;
+}
/*
- * $Id: neighbors.cc,v 1.43 1996/08/23 21:29:57 wessels Exp $
+ * $Id: neighbors.cc,v 1.44 1996/08/26 19:57:08 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
memset(&name, '\0', sizeof(struct sockaddr_in));
if (getsockname(fd, (struct sockaddr *) &name, &len) < 0)
debug(15, 1, "getsockname(%d,%p,%p) failed.\n", fd, &name, &len);
- friends->fd = fd;
/* Prepare neighbor connections, one at a time */
E = &friends->edges_head;
if (friends->edges_head == NULL)
return 0;
-
+ if (theOutIcpConnection < 0) {
+ debug(15, 0, "neighborsUdpPing: There is no ICP socket!\n");
+ debug(15, 0, "Cannot query neighbors for '%s'.\n", url);
+ debug(15, 0, "Check 'icp_port' in your config file\n");
+ fatal_dump(NULL);
+ }
for (i = 0, e = friends->first_ping; i++ < friends->n; e = e->next) {
if (entry->swap_status != NO_SWAP)
fatal_dump("neighborsUdpPing: bad swap_status");
if (e->icp_port == echo_port) {
debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
echo_hdr.reqnum = reqnum;
- icpUdpSend(friends->fd,
+ icpUdpSend(theOutIcpConnection,
url,
&echo_hdr,
&e->in_addr,
LOG_TAG_NONE);
} else {
e->header.reqnum = reqnum;
- icpUdpSend(friends->fd,
+ icpUdpSend(theOutIcpConnection,
url,
&e->header,
&e->in_addr,
xmemcpy(&to_addr.sin_addr, hep->h_addr, hep->h_length);
to_addr.sin_port = htons(echo_port);
echo_hdr.reqnum = reqnum;
- icpUdpSend(friends->fd,
+ icpUdpSend(theOutIcpConnection,
url,
&echo_hdr,
&to_addr,
/*
- * $Id: squid.h,v 1.38 1996/08/26 19:15:41 wessels Exp $
+ * $Id: squid.h,v 1.39 1996/08/26 19:57:11 wessels Exp $
*
* AUTHOR: Duane Wessels
*
#define SA_RESETHAND 0
#endif
#if SA_RESETHAND == 0 && defined(SA_ONESHOT)
+#undef SA_RESETHAND
#define SA_RESETHAND SA_ONESHOT
#endif
/*
- * $Id: ssl.cc,v 1.11 1996/08/26 19:16:08 wessels Exp $
+ * $Id: ssl.cc,v 1.12 1996/08/26 19:57:11 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
debug(26, 3, "sslClientClosed: FD %d\n", fd);
/* we have been called from comm_close for the client side, so
* just need to clean up the server side */
+ protoUnregister(sslState->server.fd,
+ NULL,
+ sslState->request,
+ no_addr);
comm_close(sslState->server.fd);
return 0;
}
/*
- * $Id: tunnel.cc,v 1.11 1996/08/26 19:16:08 wessels Exp $
+ * $Id: tunnel.cc,v 1.12 1996/08/26 19:57:11 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
debug(26, 3, "sslClientClosed: FD %d\n", fd);
/* we have been called from comm_close for the client side, so
* just need to clean up the server side */
+ protoUnregister(sslState->server.fd,
+ NULL,
+ sslState->request,
+ no_addr);
comm_close(sslState->server.fd);
return 0;
}