- Added "-k parse" command line option: parses the config file
but does not send a signal unlike other -k options.
-Changes to Squid-2.1 ():
+Changes to Squid-2.1 (November 16, 1998):
- Changed delayPoolsUpdate() to be called as an event.
- Replaced comm_select FD scanning loops with global fd_set
authentication information. (Henrik Nordstrom)
- Changed refreshCheck() so that objects with negative age
are always stale.
+ - Fixed "plain" FTP listings (Henrik Nordstrom).
+ - Fixed showing banner/logon message for top-level FTP
+ directories (Henrik Nordstrom).
+ * Changes below have been made to SQUID_2_1_PATCH1
+ - Fixed pinger packet size assertion.
+ - Fixed WAIS forwarding.
+ - Fixed dnsserver coredump bug caused by using both -D and
+ -s options.
Changes to Squid-2.0 (October 2, 1998):
# URLs to request. Run N of these at the same time to simulate a heavy
# neighbor cache load.
-require 'getopts.pl';
-require 'fcntl.ph';
+use Fcntl;
+use Getopt::Std;
+use IO::Socket;
$|=1;
-&Getopts('nr');
+getopts('qlnr');
$host=(shift || 'localhost') ;
$port=(shift || '3130') ;
"ICP_END"
);
-require 'sys/socket.ph';
-
-$sockaddr = 'S n a4 x8';
-($name, $aliases, $proto) = getprotobyname("udp");
-($fqdn, $aliases, $type, $len, $themaddr) = gethostbyname($host);
-$thissock = pack($sockaddr, &AF_INET, 0, "\0\0\0\0");
-$them = pack($sockaddr, &AF_INET, $port, $themaddr);
+$sock = IO::Socket::INET->new(PeerAddr => "$host:$port", Proto => 'udp');
+die "socket: $!\n" unless defined($sock);
chop($me=`uname -a|cut -f2 -d' '`);
$myip=(gethostbyname($me))[4];
-die "socket: $!\n" unless
- socket (SOCK, &AF_INET, &SOCK_DGRAM, $proto);
-
-$flags = fcntl (SOCK, &F_GETFL, 0);
+$flags = fcntl ($sock, &F_GETFL, 0);
$flags |= &O_NONBLOCK;
die "fcntl O_NONBLOCK: $!\n" unless
- fcntl (SOCK, &F_SETFL, $flags);
+ fcntl ($sock, &F_SETFL, $flags);
$flags = 0;
$flags |= 0x80000000;
$start = time;
while (<>) {
chop;
+
+ if ($opt_l) { # it's a Squid log file
+ @stuff = split(/\s+/, $_);
+ $_ = $stuff[6];
+ }
+
$len = length($_) + 1;
$request_template = sprintf 'CCnNNa4a4x4a%d', $len;
$request = pack($request_template,
$myip, # a4 shostid
$_); # a%d payload
die "send: $!\n" unless
- send(SOCK, $request, 0, $them);
+ send($sock, $request, 0, $them);
$nsent++;
$rin = '';
- vec($rin,fileno(SOCK),1) = 1;
+ vec($rin,fileno($sock),1) = 1;
($nfound,$timeleft) = select($rout=$rin, undef, undef, 2.0);
next if ($nfound == 0);
while (1) {
- last unless ($theiraddr = recv(SOCK, $reply, 1024, 0));
+ last unless ($theiraddr = recv($sock, $reply, 1024, 0));
+ next if $opt_q; # quietly carry on
$nrecv++;
if ($opt_r) {
# only print send/receive rates
/*
- * $Id: StatHist.cc,v 1.19 1998/11/12 06:27:52 wessels Exp $
+ * $Id: StatHist.cc,v 1.20 1998/11/21 16:54:25 wessels Exp $
*
* DEBUG: section 62 Generic Histogram
* AUTHOR: Duane Wessels
static double
statHistVal(const StatHist * H, int bin)
{
- return H->val_out(bin / H->scale) + H->min;
+ return H->val_out((double) bin / H->scale) + H->min;
}
double
#
-# $Id: cf.data.pre,v 1.125 1998/11/12 06:33:31 wessels Exp $
+# $Id: cf.data.pre,v 1.126 1998/11/21 16:54:26 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
-acl Safe_ports port 80 21 70 1025-65535
+acl Safe_ports port 80 21 443 563 70 210 1025-65535
acl CONNECT method CONNECT
NOCOMMENT_END
DOC_END
cache, instead of going direct, then turn this option off.
prefer_direct on
DOC_END
+
EOF
/*
- * $Id: dnsserver.cc,v 1.53 1998/11/12 06:28:03 wessels Exp $
+ * $Id: dnsserver.cc,v 1.54 1998/11/21 16:54:26 wessels Exp $
*
* DEBUG: section 0 DNS Resolver
* AUTHOR: Harvest Derived
#if HAVE_RES_INIT
if (opt_s == 0) {
_res.nscount = 0;
+ /*
+ * Setting RES_INIT here causes coredumps when -s is
+ * used with -D option. It looks to me like setting
+ * RES_INIT is wrong. The resolver code sets RES_INIT
+ * after calling res_init(). When we change the _res
+ * structure and set RES_INIT, some internal resolver
+ * structures get confused. -DW 2.1.p1
+ */
+#if SEEMS_WRONG
_res.options |= RES_INIT;
+#endif
opt_s = 1;
+ } else if (_res.nscount == MAXNS) {
+ fprintf(stderr, "Too many -s options, only %d are allowed\n",
+ MAXNS);
+ break;
}
#if HAVE_RES_NSADDR_LIST
+ _res.nsaddr_list[_res.nscount]=_res.nsaddr_list[0];
safe_inet_addr(optarg, &_res.nsaddr_list[_res.nscount++].sin_addr);
#elif HAVE_RES_NS_LIST
+ _res.ns_list[_res.nscount]=_res.ns_list[0];
safe_inet_addr(optarg, &_res.ns_list[_res.nscount++].addr.sin_addr);
-#endif
+#else /* Unknown NS list format */
fprintf(stderr, "-s is not supported on this resolver\n");
-#else
+#endif
+#else /* !HAVE_RES_INIT */
fprintf(stderr, "-s is not supported on this resolver\n");
#endif /* HAVE_RES_INIT */
break;
/*
- * $Id: forward.cc,v 1.31 1998/11/12 06:28:05 wessels Exp $
+ * $Id: forward.cc,v 1.32 1998/11/21 16:54:27 wessels Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
s->host = xstrdup(p->host);
s->port = p->http_port;
s->peer = p;
+ } else if (fwdState->request->protocol == PROTO_WAIS) {
+ if (!Config.Wais.relayHost) {
+ fwdStartFail(NULL, fwdState);
+ return;
+ } else {
+ s->host = xstrdup(Config.Wais.relayHost);
+ s->port = Config.Wais.relayPort;
+ }
} else {
s->host = xstrdup(fwdState->request->host);
s->port = fwdState->request->port;
/*
- * $Id: ftp.cc,v 1.254 1998/11/12 06:28:07 wessels Exp $
+ * $Id: ftp.cc,v 1.255 1998/11/21 16:54:27 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
if ((t = strRChr(request->urlpath, ';')) != NULL) {
if (strncasecmp(t + 1, "type=", 5) == 0) {
ftpState->typecode = (char) toupper((int) *(t + 6));
- strSet(request->urlpath, t, '\0');
+ strCutPtr(request->urlpath, t);
}
}
l = strLen(request->urlpath);
ftpHandleControlReply(FtpStateData * ftpState)
{
char *oldbuf;
- wordlist **W;
+ wordlist **W, **T;
int bytes_used = 0;
wordlistDestroy(&ftpState->ctrl.message);
ftpState->ctrl.message = ftpParseControlReply(ftpState->ctrl.buf,
xmemmove(ftpState->ctrl.buf, ftpState->ctrl.buf + bytes_used,
ftpState->ctrl.offset);
}
- for (W = &ftpState->ctrl.message; *W && (*W)->next; W = &(*W)->next);
+ /* Extract reply message (last line) */
+ for (T = NULL, W = &ftpState->ctrl.message; *W && (*W)->next; W = &(*W)->next) {
+ /* Skip trailing blank lines */
+ if (strlen((*W)->key) == 0) {
+ if (T == NULL)
+ T = W;
+ } else if ((*W)->next) {
+ T = NULL;
+ }
+ }
safe_free(ftpState->ctrl.last_reply);
ftpState->ctrl.last_reply = (*W)->key;
safe_free(*W);
+ if (T)
+ wordlistDestroy(T);
debug(9, 8) ("ftpReadControlReply: state=%d, code=%d\n", ftpState->state,
ftpState->ctrl.replycode);
FTP_SM_FUNCS[ftpState->state] (ftpState);
if (ftpState->flags.pasv_only)
ftpState->login_att++;
if (code == 220) {
- if (ftpState->ctrl.message)
+ if (ftpState->ctrl.message) {
if (strstr(ftpState->ctrl.message->key, "NetWare"))
ftpState->flags.skip_whitespace = 1;
+ if (ftpState->cwd_message)
+ wordlistDestroy(&ftpState->cwd_message);
+ ftpState->cwd_message = ftpState->ctrl.message;
+ ftpState->ctrl.message = NULL;
+ }
ftpSendUser(ftpState);
} else if (code == 120) {
if (NULL != ftpState->ctrl.message)
{
int code = ftpState->ctrl.replycode;
debug(9, 3) ("ftpReadPass\n");
+ if (ftpState->ctrl.message) {
+ if (ftpState->cwd_message)
+ wordlistDestroy(&ftpState->cwd_message);
+ ftpState->cwd_message = ftpState->ctrl.message;
+ ftpState->ctrl.message = NULL;
+ }
if (code == 230) {
ftpSendType(ftpState);
} else {
/*
- * $Id: pinger.cc,v 1.38 1998/11/13 20:50:54 wessels Exp $
+ * $Id: pinger.cc,v 1.39 1998/11/21 16:54:28 wessels Exp $
*
* DEBUG: section 42 ICMP Pinger program
* AUTHOR: Duane Wessels
#define MAX_PKT_SZ 8192
#define MAX_PAYLOAD (MAX_PKT_SZ - sizeof(struct icmphdr) - sizeof (char) - sizeof(struct timeval) - 1)
#else
-#define MAX_PAYLOAD (sizeof(struct icmphdr) + sizeof (char) + sizeof(struct timeval) + 1)
-#define MAX_PKT_SZ MAX_PAYLOAD
+#define MAX_PAYLOAD SQUIDHOSTNAMELEN
+#define MAX_PKT_SZ (MAX_PAYLOAD + sizeof(struct timeval) + sizeof (char) + sizeof(struct icmphdr) + 1)
#endif
typedef struct {
n = recv(0, (char *) &pecho, sizeof(pecho), 0);
if (n < 0)
return n;
- guess_size = n - (sizeof(pingerEchoData) - MAX_PKT_SZ);
+ guess_size = n - (sizeof(pingerEchoData) - PINGER_PAYLOAD_SZ);
if (guess_size != pecho.psize)
fprintf(stderr, "size mismatch, guess=%d psize=%d\n",
guess_size, pecho.psize);
/*
- * $Id: protos.h,v 1.290 1998/11/18 00:16:38 glenn Exp $
+ * $Id: protos.h,v 1.291 1998/11/21 16:54:29 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
#define strCaseCmp(s,str) strcasecmp(strBuf(s), (str))
#define strNCaseCmp(s,str,n) strncasecmp(strBuf(s), (str), (n))
#define strSet(s,ptr,ch) (s).buf[ptr-(s).buf] = (ch)
-#define strCut(s,pos) (s).buf[pos] = '\0'
+#define strCut(s,pos) (((s).len = pos) , ((s).buf[pos] = '\0'))
+#define strCutPtr(s,ptr) (((s).len = (ptr)-(s).buf) , ((s).buf[(s).len] = '\0'))
/* #define strCat(s,str) stringAppend(&(s), (str), strlen(str)+1) */
extern void stringInit(String * s, const char *str);
extern void stringLimitInit(String * s, const char *str, int len);
/*
- * $Id: structs.h,v 1.249 1998/11/13 21:02:11 rousskov Exp $
+ * $Id: structs.h,v 1.250 1998/11/21 16:54:29 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
};
struct _PeerDigest {
- peer *peer; /* pointer back to peer structure, argh */
- CacheDigest *cd; /* actual digest structure */
- String host; /* copy of peer->host */
+ peer *peer; /* pointer back to peer structure, argh */
+ CacheDigest *cd; /* actual digest structure */
+ String host; /* copy of peer->host */
const char *req_result; /* text status of the last request */
struct {
- unsigned int needed:1; /* there were requests for this digest */
+ unsigned int needed:1; /* there were requests for this digest */
unsigned int usable:1; /* can be used for lookups */
unsigned int requested:1; /* in process of receiving [fresh] digest */
} flags;
time_t next_check; /* next scheduled check/refresh event */
time_t retry_delay; /* delay before re-checking _invalid_ digest */
time_t requested; /* requested a fresh copy of a digest */
- time_t req_delay; /* last request response time */
+ time_t req_delay; /* last request response time */
time_t received; /* received the current copy of a digest */
time_t disabled; /* disabled for good */
} times;
/*
- * $Id: wais.cc,v 1.122 1998/10/12 21:39:06 wessels Exp $
+ * $Id: wais.cc,v 1.123 1998/11/21 16:54:30 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
int fd;
StoreEntry *entry;
method_t method;
- char *relayhost;
- int relayport;
const HttpHeader *request_hdr;
char url[MAX_URL];
request_t *request;
return;
if (errflag) {
ErrorState *err;
- err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
+ err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE);
err->xerrno = errno;
- err->host = xstrdup(waisState->relayhost);
- err->port = waisState->relayport;
err->request = requestLink(waisState->request);
errorAppendEntry(entry, err);
comm_close(fd);
MemBuf mb;
const char *Method = RequestMethodStr[waisState->method];
debug(24, 5) ("waisSendRequest: FD %d\n", fd);
- memBufPrintf(&mb, "%s %s", Method, waisState->url);
+ memBufDefInit(&mb);
+ memBufPrintf(&mb, "%s %s HTTP/1.0\r\n", Method, waisState->url);
if (waisState->request_hdr) {
Packer p;
packerToMemInit(&p, &mb);
debug(24, 3) ("waisStart: \"%s %s\"\n", RequestMethodStr[method], url);
Counter.server.all.requests++;
Counter.server.other.requests++;
- if (!Config.Wais.relayHost) {
- ErrorState *err;
- debug(24, 0) ("waisStart: Failed because no relay host defined!\n");
- err = errorCon(ERR_NO_RELAY, HTTP_INTERNAL_SERVER_ERROR);
- err->request = requestLink(request);
- errorAppendEntry(entry, err);
- return;
- }
waisState = xcalloc(1, sizeof(WaisStateData));
cbdataAdd(waisState, MEM_NONE);
waisState->method = method;
- waisState->relayhost = Config.Wais.relayHost;
- waisState->relayport = Config.Wais.relayPort;
waisState->request_hdr = &request->header;
waisState->fd = fd;
waisState->entry = entry;