--------------------- PatchSet 4000 Date: 2007/01/23 23:21:29 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Patch Housekeeping. Dropping files from branch which are not in HEAD and appear to have no branch code. Members: mkrelease.sh:1.5->1.5.8.1(DEAD) mksnapshot-cron.sh:1.2->1.2.10.1(DEAD) mksnapshot.sh:1.5->1.5.8.1(DEAD) src/client.cc:1.10.4.4->1.10.4.5(DEAD) src/leakfinder.cc:1.2->1.2.10.1(DEAD) src/squid_windows.h:1.1->1.1.12.1(DEAD) src/tests/stub_cache_manager.cc:1.1->1.1.8.1(DEAD) test-suite/http_range_test.cc:1.12->1.12.8.1(DEAD) --- squid3/mkrelease.sh Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,63 +0,0 @@ -#!/bin/sh -ex -if [ $# -ne 1 -a $# -ne 2 ]; then - echo "Usage: $0 revision [destination]" - exit 1 -fi -package=squid -module=squid3 -rev=`echo $1 | sed -e "s/^${package}-//"` -name=${package}-${rev} -tag=`echo ${name} | tr a-z.- A-Z__` -startdir=$PWD/ -dst=${2:-$PWD}/ -RELEASE_TIME=`date +%s` - -tmpdir=${TMPDIR:-${PWD}}/${name}-mkrelease - -CVSROOT=${CVSROOT:-/server/cvs-server/squid} -export CVSROOT - -rm -rf $name.tar.gz $tmpdir -trap "rm -rf $tmpdir" 0 - -cvs -Q export -d $tmpdir -r $tag $module -if [ ! -f $tmpdir/configure ]; then - echo "ERROR! Tag $tag not found in $module" -fi - -cd $tmpdir -eval `grep "^ *VERSION=" configure | sed -e 's/-CVS//'` -eval `grep "^ *PACKAGE=" configure` -if [ ${name} != ${PACKAGE}-${VERSION} ]; then - echo "ERROR! The version numbers does not match!" - echo "${name} != ${PACKAGE}-${VERSION}" - exit 1 -fi -RELEASE=`echo $VERSION | cut -d. -f1,2 | cut -d- -f1` -ed -s configure.in </dev/null - -make_snapshot() -{ { - set -e - cd ../release - mksnap=$1 - tag=$2 - dir=$3 - ver=$4 - save=${5:-3} - dst=$versions/$dir/$ver - $mksnap $tag 2>&1 | grep -v "set owner/group" - for file in `cat $tag.out` ; do - type=`echo $file | sed -e 's/.*\.tar\.gz/.tar.gz/' -e 's/.*\.tar\.bz2/.tar.bz2/' -e 's/.*\.patch/.patch/' -e 's/.*\.diff/.diff/' -e 's/.*-RELEASENOTES.html/-RELEASENOTES.html/' -e 's/^.*ChangeLog.txt$/-ChangeLog.txt/'` - - # move tarball - rm -f $dst/$file - cp -p $file $dst/$file - rm -f $file - - # update snapshot symlink - rm -f $dst/squid-$ver.snapshot$type - ln -s $file $dst/squid-$ver.snapshot$type - - # cleanup old snapshots - ls -t $dst/*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$type | tail +$save | xargs rm -f - done - - # update web page - if [ -x $dst/make.sh ]; then - $dst/make.sh - fi - -} } - -set +e - -../commit/bootstrap squid -make_snapshot ../commit/squid/mksnapshot.sh HEAD v3 HEAD 6 - -rm -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new -cp ../commit/squid/CONTRIBUTORS /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new -chmod 444 /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new -mv -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.txt - -rm -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new -cp ../commit/squid/SPONSORS /server/httpd/htdocs/squid-cache.org/SPONSORS.new -chmod 444 /server/httpd/htdocs/squid-cache.org/SPONSORS.new -mv -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new /server/httpd/htdocs/squid-cache.org/SPONSORS.txt - -#../commit/bootstrap squid-3.0 -#make_snapshot ../commit/squid/mksnapshot.sh SQUID_3_0 v3 3.0 3 -make_snapshot ../commit/squid/mksnapshot.sh HEAD v3 3.0 3 - -#../commit/bootstrap squid-2 -#make_snapshot ../commit/squid-2/mksnapshot.sh HEAD v2 2.6 6 - -../commit/bootstrap squid-2.5 -make_snapshot ../commit/squid-2.5/mksnapshot.sh SQUID_2_5 v2 2.5 3 - -#../commit/squid3-SQUID2.sync --- squid3/mksnapshot.sh Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,62 +0,0 @@ -#!/bin/sh -e -if [ $# -gt 1 ]; then - echo "Usage: $0 [branch]" - exit 1 -fi -module=squid3 -tag=${1:-HEAD} -startdir=$PWD -date=`env TZ=GMT date +%Y%m%d` - -tmpdir=${TMPDIR:-${PWD}}/${module}-${tag}-mksnapshot - -CVSROOT=${CVSROOT:-/server/cvs-server/squid} -export CVSROOT - -rm -rf $tmpdir -trap "rm -rf $tmpdir" 0 - -rm -f ${tag}.out -cvs -Q export -d $tmpdir -r $tag $module -if [ ! -f $tmpdir/configure ]; then - echo "ERROR! Tag $tag not found in $module" -fi - -cd $tmpdir -eval `grep "^ *VERSION=" configure | sed -e 's/-CVS//'` -eval `grep "^ *PACKAGE=" configure` -ed -s configure.in <>${tag}.out -cp -p $tmpdir/${PACKAGE}-${VERSION}-${date}.tar.bz2 . -echo ${PACKAGE}-${VERSION}-${date}.tar.bz2 >>${tag}.out - -relnotes=$tmpdir/doc/release-notes/release-`echo $VERSION | cut -d. -f1,2 | cut -d- -f1`.html -if [ -f $relnotes ]; then - cp -p $relnotes ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html - echo ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html >>${tag}.out - ed -s ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html <>${tag}.out - -if (echo $VERSION | grep PRE) || (echo $VERSION | grep STABLE); then - echo "Differences from ${PACKAGE}-${VERSION} to ${PACKAGE}-${VERSION}-${date}" >${PACKAGE}-${VERSION}-${date}.diff - cvs -q rdiff -u -r SQUID_`echo $VERSION | tr .- __` -r $tag $module >>${PACKAGE}-${VERSION}-${date}.diff - echo ${PACKAGE}-${VERSION}-${date}.diff >>${tag}.out -fi --- squid3/src/client.cc Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,653 +0,0 @@ - -/* - * $Id: client.cc,v 1.10.4.4 2005/05/22 14:21:35 rmartinez Exp $ - * - * DEBUG: section 0 WWW Client - * AUTHOR: Harvest Derived - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" - -#ifndef BUFSIZ -#define BUFSIZ 8192 -#endif - -/* Local functions */ -static int client_comm_bind(int, const char *); - -static int client_comm_connect(int, const char *, u_short, struct timeval *); -static void usage(const char *progname); - -static int Now(struct timeval *); -static SIGHDLR catchSignal; -static SIGHDLR pipe_handler; -static void set_our_signal(void); -#ifndef _SQUID_MSWIN_ -static ssize_t myread(int fd, void *buf, size_t len); -static ssize_t mywrite(int fd, void *buf, size_t len); -#endif -static int put_fd; -static char *put_file = NULL; - -static struct stat sb; -int total_bytes = 0; -int io_timeout = 120; - -static void -usage(const char *progname) -{ - fprintf(stderr, - "Usage: %s [-arsv] [-i IMS] [-h remote host] [-l local host] [-p port] [-m method] [-t count] [-I ping-interval] [-H 'strings'] [-T timeout] url\n" - "Options:\n" - " -P file PUT request.\n" - " -a Do NOT include Accept: header.\n" - " -r Force cache to reload URL.\n" - " -s Silent. Do not print data to stdout.\n" - " -v Verbose. Print outgoing message to stderr.\n" - " -i IMS If-Modified-Since time (in Epoch seconds).\n" - " -h host Retrieve URL from cache on hostname. Default is localhost.\n" - " -l host Specify a local IP address to bind to. Default is none.\n" - " -p port Port number of cache. Default is %d.\n" - " -m method Request method, default is GET.\n" - " -t count Trace count cache-hops\n" - " -g count Ping mode, \"count\" iterations (0 to loop until interrupted).\n" - " -I interval Ping interval in seconds (default 1 second).\n" - " -H 'string' Extra headers to send. Use '\\n' for new lines.\n" - " -T timeout Timeout value (seconds) for read/write operations.\n" - " -u user Proxy authentication username\n" - " -w password Proxy authentication password\n" - " -U user WWW authentication username\n" - " -W password WWW authentication password\n", - progname, CACHE_HTTP_PORT); - exit(1); -} - -static int interrupted = 0; -int -main(int argc, char *argv[]) -{ - int conn, c, len, bytesWritten; - int port, to_stdout, reload; - int ping, pcount; - int keep_alive = 0; - int opt_noaccept = 0; - int opt_verbose = 0; - const char *hostname, *localhost; - char url[BUFSIZ], msg[BUFSIZ], buf[BUFSIZ]; - char extra_hdrs[BUFSIZ]; - const char *method = "GET"; - extern char *optarg; - time_t ims = 0; - int max_forwards = -1; - - struct timeval tv1, tv2; - int i = 0, loops; - long ping_int; - long ping_min = 0, ping_max = 0, ping_sum = 0, ping_mean = 0; - char *proxy_user = NULL; - char *proxy_password = NULL; - char *www_user = NULL; - char *www_password = NULL; - - /* set the defaults */ - hostname = "localhost"; - localhost = NULL; - extra_hdrs[0] = '\0'; - port = CACHE_HTTP_PORT; - to_stdout = 1; - reload = 0; - ping = 0; - pcount = 0; - ping_int = 1 * 1000; - - if (argc < 2) { - usage(argv[0]); /* need URL */ - } else if (argc >= 2) { - strncpy(url, argv[argc - 1], BUFSIZ); - url[BUFSIZ - 1] = '\0'; - - if (url[0] == '-') - usage(argv[0]); - - while ((c = getopt(argc, argv, "ah:l:P:i:km:p:rsvt:g:p:I:H:T:u:U:w:W:?")) != -1) - switch (c) { - - case 'a': - opt_noaccept = 1; - break; - - case 'h': /* remote host */ - - if (optarg != NULL) - hostname = optarg; - - break; - - case 'l': /* local host */ - if (optarg != NULL) - localhost = optarg; - - break; - - case 's': /* silent */ - to_stdout = 0; - - break; - - case 'k': /* backward compat */ - keep_alive = 1; - - break; - - case 'r': /* reload */ - reload = 1; - - break; - - case 'p': /* port number */ - sscanf(optarg, "%d", &port); - - if (port < 1) - port = CACHE_HTTP_PORT; /* default */ - - break; - - case 'P': - put_file = xstrdup(optarg); - - break; - - case 'i': /* IMS */ - ims = (time_t) atoi(optarg); - - break; - - case 'm': - method = xstrdup(optarg); - - break; - - case 't': - method = xstrdup("TRACE"); - - max_forwards = atoi(optarg); - - break; - - case 'g': - ping = 1; - - pcount = atoi(optarg); - - to_stdout = 0; - - break; - - case 'I': - if ((ping_int = atoi(optarg) * 1000) <= 0) - usage(argv[0]); - - break; - - case 'H': - if (strlen(optarg)) { - char *t; - strncpy(extra_hdrs, optarg, sizeof(extra_hdrs)); - - while ((t = strstr(extra_hdrs, "\\n"))) - *t = '\r', *(t + 1) = '\n'; - } - - break; - - case 'T': - io_timeout = atoi(optarg); - break; - - case 'u': - proxy_user = optarg; - break; - - case 'w': - proxy_password = optarg; - break; - - case 'U': - www_user = optarg; - break; - - case 'W': - www_password = optarg; - break; - - case 'v': - /* undocumented: may increase verb-level by giving more -v's */ - opt_verbose++; - break; - - case '?': /* usage */ - - default: - usage(argv[0]); - break; - } - } - -#ifdef _SQUID_MSWIN_ - { - WSADATA wsaData; - WSAStartup(2, &wsaData); - } -#endif - /* Build the HTTP request */ - if (strncmp(url, "mgr:", 4) == 0) { - char *t = xstrdup(url + 4); - snprintf(url, BUFSIZ, "cache_object://%s/%s", hostname, t); - xfree(t); - } - - if (put_file) { - put_fd = open(put_file, O_RDONLY); - set_our_signal(); - - if (put_fd < 0) { - fprintf(stderr, "%s: can't open file (%s)\n", argv[0], - xstrerror()); - exit(-1); - } - -#ifdef _SQUID_WIN32_ - setmode(put_fd, O_BINARY); - -#endif - - fstat(put_fd, &sb); - } - - snprintf(msg, BUFSIZ, "%s %s HTTP/1.0\r\n", method, url); - - if (reload) { - snprintf(buf, BUFSIZ, "Pragma: no-cache\r\n"); - strcat(msg, buf); - } - - if (put_fd > 0) { - snprintf(buf, BUFSIZ, "Content-length: %d\r\n", (int) sb.st_size); - strcat(msg, buf); - } - - if (opt_noaccept == 0) { - snprintf(buf, BUFSIZ, "Accept: */*\r\n"); - strcat(msg, buf); - } - - if (ims) { - snprintf(buf, BUFSIZ, "If-Modified-Since: %s\r\n", mkrfc1123(ims)); - strcat(msg, buf); - } - - if (max_forwards > -1) { - snprintf(buf, BUFSIZ, "Max-Forwards: %d\r\n", max_forwards); - strcat(msg, buf); - } - - if (proxy_user) { - char *user = proxy_user; - char *password = proxy_password; -#if HAVE_GETPASS - - if (!password) - password = getpass("Proxy password: "); - -#endif - - if (!password) { - fprintf(stderr, "ERROR: Proxy password missing\n"); - exit(1); - } - - snprintf(buf, BUFSIZ, "%s:%s", user, password); - snprintf(buf, BUFSIZ, "Proxy-Authorization: Basic %s\r\n", base64_encode(buf)); - strcat(msg, buf); - } - - if (www_user) { - char *user = www_user; - char *password = www_password; -#if HAVE_GETPASS - - if (!password) - password = getpass("WWW password: "); - -#endif - - if (!password) { - fprintf(stderr, "ERROR: WWW password missing\n"); - exit(1); - } - - snprintf(buf, BUFSIZ, "%s:%s", user, password); - snprintf(buf, BUFSIZ, "Authorization: Basic %s\r\n", base64_encode(buf)); - strcat(msg, buf); - } - - if (keep_alive) { - if (port != 80) - snprintf(buf, BUFSIZ, "Proxy-Connection: keep-alive\r\n"); - else - snprintf(buf, BUFSIZ, "Connection: keep-alive\r\n"); - - strcat(msg, buf); - } - - strcat(msg, extra_hdrs); - snprintf(buf, BUFSIZ, "\r\n"); - strcat(msg, buf); - - if (opt_verbose) - fprintf(stderr, "headers: '%s'\n", msg); - - if (ping) { -#if HAVE_SIGACTION - - struct sigaction sa, osa; - - if (sigaction(SIGINT, NULL, &osa) == 0 && osa.sa_handler == SIG_DFL) { - sa.sa_handler = catchSignal; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - (void) sigaction(SIGINT, &sa, NULL); - } - -#else - void (*osig) (int); - - if ((osig = signal(SIGINT, catchSignal)) != SIG_DFL) - (void) signal(SIGINT, osig); - -#endif - - } - - loops = ping ? pcount : 1; - - for (i = 0; loops == 0 || i < loops; i++) { - int fsize = 0; - /* Connect to the server */ - - if ((conn = socket(PF_FAMILY, SOCK_STREAM, 0)) < 0) { - perror("client: socket"); - exit(1); - } - - if (localhost && client_comm_bind(conn, localhost) < 0) { - perror("client: bind"); - exit(1); - } - - if (client_comm_connect(conn, hostname, port, ping ? &tv1 : NULL) < 0) { - if (errno == 0) { - fprintf(stderr, "client: ERROR: Cannot connect to %s:%d: Host unknown.\n", hostname, port); - } else { - char tbuf[BUFSIZ]; - snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s:%d", - hostname, port); - perror(tbuf); - } - - exit(1); - } - - /* Send the HTTP request */ -#ifdef _SQUID_MSWIN_ - bytesWritten = send(conn, (const void *) msg, strlen(msg), 0); - -#else - - bytesWritten = mywrite(conn, msg, strlen(msg)); - -#endif - - if (bytesWritten < 0) { - perror("client: ERROR: write"); - exit(1); - } else if ((unsigned) bytesWritten != strlen(msg)) { - fprintf(stderr, "client: ERROR: Cannot send request?: %s\n", msg); - exit(1); - } - - if (put_file) { - int x; - lseek(put_fd, 0, SEEK_SET); -#ifdef _SQUID_MSWIN_ - - while ((x = read(put_fd, buf, sizeof(buf))) > 0) { - x = write(conn, buf, x); -#else - - while ((x = myread(put_fd, buf, sizeof(buf))) > 0) { - x = mywrite(conn, buf, x); -#endif - - total_bytes += x; - - if (x <= 0) - break; - } - - if (x != 0) - fprintf(stderr, "client: ERROR: Cannot send file.\n"); - } - - /* Read the data */ - -#ifdef _SQUID_MSWIN_ - setmode(1, O_BINARY); - - while ((len = recv(conn, (void *) buf, sizeof(buf), 0)) > 0) { -#else - - while ((len = myread(conn, buf, sizeof(buf))) > 0) { -#endif - fsize += len; - - if (to_stdout) - fwrite(buf, len, 1, stdout); - } - -#ifdef _SQUID_MSWIN_ - setmode(1, O_TEXT); - -#endif - - (void) close(conn); /* done with socket */ - - if (interrupted) - break; - - if (ping) { - - struct tm *tmp; - time_t t2s; - long elapsed_msec; - - (void) Now(&tv2); - elapsed_msec = tvSubMsec(tv1, tv2); - t2s = tv2.tv_sec; - tmp = localtime(&t2s); - fprintf(stderr, "%d-%02d-%02d %02d:%02d:%02d [%d]: %ld.%03ld secs, %f KB/s\n", - tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, - tmp->tm_hour, tmp->tm_min, tmp->tm_sec, i + 1, - elapsed_msec / 1000, elapsed_msec % 1000, - elapsed_msec ? (double) fsize / elapsed_msec : -1.0); - - if (i == 0 || elapsed_msec < ping_min) - ping_min = elapsed_msec; - - if (i == 0 || elapsed_msec > ping_max) - ping_max = elapsed_msec; - - ping_sum += elapsed_msec; - - /* Delay until next "ping_int" boundary */ - if ((loops == 0 || i + 1 < loops) && elapsed_msec < ping_int) { - - struct timeval tvs; - long msec_left = ping_int - elapsed_msec; - - tvs.tv_sec = msec_left / 1000; - tvs.tv_usec = (msec_left % 1000) * 1000; - select(0, NULL, NULL, NULL, &tvs); - } - } - } - - if (ping && i) { - ping_mean = ping_sum / i; - fprintf(stderr, "%d requests, round-trip (secs) min/avg/max = " - "%ld.%03ld/%ld.%03ld/%ld.%03ld\n", i, - ping_min / 1000, ping_min % 1000, ping_mean / 1000, ping_mean % 1000, - ping_max / 1000, ping_max % 1000); - } - - exit(0); - /*NOTREACHED */ - return 0; -} - -static int -client_comm_bind(int sock, const char *local_host) { - - static const struct hostent *hp = NULL; - - static struct SOCKADDR_IN from_addr; - - /* Set up the source socket address from which to send. */ - - if (hp == NULL) { - - FAMILY_FROM_SA(from_addr)= AF_FAMILY; - - if ((hp = GETHOSTBYNAME(local_host)) == 0) { - return (-1); - } - - xmemcpy(&ADDR_FROM_SA(from_addr), hp->h_addr, hp->h_length); - PORT_FROM_SA(from_addr) = 0; - } - - return bind(sock, (struct sockaddr *) &from_addr, sizeof(struct SOCKADDR_IN)); -} - -static int - -client_comm_connect(int sock, const char *dest_host, u_short dest_port, struct timeval *tvp) { - - static const struct hostent *hp = NULL; - - static struct SOCKADDR_IN to_addr; - - /* Set up the destination socket address for message to send to. */ - - if (hp == NULL) - { - FAMILY_FROM_SA(to_addr) = AF_FAMILY; - - if ((hp = GETHOSTBYNAME(dest_host)) == 0) { - return (-1); - } - - xmemcpy(&ADDR_FROM_SA(to_addr), hp->h_addr, hp->h_length); - PORT_FROM_SA(to_addr) = htons(dest_port); - } - - if (tvp) - (void) Now(tvp); - - return connect(sock, (struct sockaddr *) &to_addr, sizeof(struct SOCKADDR_IN)); -} - -static int - -Now(struct timeval *tp) { -#if GETTIMEOFDAY_NO_TZP - return gettimeofday(tp); -#else - - return gettimeofday(tp, NULL); -#endif -} /* ARGSUSED */ - -static void -catchSignal(int sig) { - interrupted = 1; - fprintf(stderr, "Interrupted.\n"); -} - -static void -pipe_handler(int sig) { - fprintf(stderr, "SIGPIPE received.\n"); -} - -static void -set_our_signal(void) { -#if HAVE_SIGACTION - - struct sigaction sa; - sa.sa_handler = pipe_handler; - sa.sa_flags = SA_RESTART; - sigemptyset(&sa.sa_mask); - - if (sigaction(SIGPIPE, &sa, NULL) < 0) { - fprintf(stderr, "Cannot set PIPE signal.\n"); - exit(-1); - } - -#else - signal(SIGPIPE, pipe_handler); - -#endif - -} - -#ifndef _SQUID_MSWIN_ -static ssize_t -myread(int fd, void *buf, size_t len) { - alarm(io_timeout); - return read(fd, buf, len); -} - -static ssize_t -mywrite(int fd, void *buf, size_t len) { - alarm(io_timeout); - return write(fd, buf, len); -} - -#endif --- squid3/src/leakfinder.cc Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,146 +0,0 @@ - -/* - * $Id: leakfinder.cc,v 1.2 2003/02/22 03:14:34 squidadm Exp $ - * - * DEBUG: section 45 Callback Data Registry - * AUTHOR: Duane Wessels - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -/* - * Use these to find memory leaks - */ - -#include "squid.h" -#include "Store.h" - -static hash_table *htable = NULL; - -static int leakCount = 0; - -typedef struct _ptr -{ - hash_link hash; /* must be first */ - void *key; - - struct _ptr *next; - const char *file; - int line; - time_t when; -} - -ptr; - -static HASHCMP ptr_cmp; -static HASHHASH ptr_hash; -static OBJH ptrDump; - -/* ========================================================================= */ - -void -leakInit(void) -{ - debug(45, 3) ("ptrInit\n"); - htable = hash_create(ptr_cmp, 1 << 8, ptr_hash); - cachemgrRegister("leaks", - "Memory Leak Tracking", - ptrDump, 0, 1); -} - -void * -leakAddFL(void *p, const char *file, int line) -{ - ptr *c; - assert(p); - assert(htable != NULL); - assert(hash_lookup(htable, p) == NULL); - c = (ptr *)xcalloc(1, sizeof(*c)); - c->key = p; - c->file = file; - c->line = line; - c->when = squid_curtime; - hash_join(htable, &c->hash); - leakCount++; - return p; -} - -void * -leakTouchFL(void *p, const char *file, int line) -{ - ptr *c = (ptr *) hash_lookup(htable, p); - assert(p); - assert(htable != NULL); - assert(c); - c->file = file; - c->line = line; - c->when = squid_curtime; - return p; -} - -void * -leakFreeFL(void *p, const char *file, int line) -{ - ptr *c = (ptr *) hash_lookup(htable, p); - assert(p); - assert(c != NULL); - hash_remove_link(htable, (hash_link *) c); - leakCount--; - xfree(c); - return p; -} - -/* ========================================================================= */ - -static int -ptr_cmp(const void *p1, const void *p2) -{ - return (char *) p1 - (char *) p2; -} - -static unsigned int -ptr_hash(const void *p, unsigned int mod) -{ - return ((unsigned long) p >> 8) % mod; -} - - -static void -ptrDump(StoreEntry * sentry) -{ - hash_link *hptr; - ptr *c; - storeAppendPrintf(sentry, "Tracking %d pointers\n", leakCount); - hash_first(htable); - - while ((hptr = (hash_link *)hash_next(htable))) { - c = (ptr *) hptr; - storeAppendPrintf(sentry, "%20p last used %9d seconds ago by %s:%d\n", - c->key, (int)(squid_curtime - c->when), c->file, c->line); - } -} --- squid3/src/squid_windows.h Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,42 +0,0 @@ -/* - * $Id: squid_windows.h,v 1.1 2003/04/22 02:13:27 squidadm Exp $ - * - * AUTHOR: Guido Serassio - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#ifndef ACL -#define ACL WindowsACL -#define _MSWIN_ACL_WAS_NOT_DEFINED 1 -#endif -#include -#if _MSWIN_ACL_WAS_NOT_DEFINED -#undef ACL -#undef _MSWIN_ACL_WAS_NOT_DEFINED -#endif --- squid3/src/tests/stub_cache_manager.cc Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,44 +0,0 @@ -/* - * $Id: stub_cache_manager.cc,v 1.1 2004/08/31 02:14:30 squidadm Exp $ - * - * DEBUG: section 16 Cache Manager Objects - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" - -void -cachemgrRegister(const char *action, const char *desc, OBJH * handler, int pw_req_flag, int atomic) -{} - -/* - * DO NOT MODIFY: - * arch-tag: 4b6d624e-0e69-415f-bb92-f5991db65dd3 - */ --- squid3/test-suite/http_range_test.cc Wed Feb 14 13:38:34 2007 +++ /dev/null Wed Feb 14 13:37:19 2007 @@ -1,283 +0,0 @@ - -/* - * $Id: http_range_test.cc,v 1.12 2003/09/23 02:12:33 squidadm Exp $ - * - * DEBUG: section 64 HTTP Range Header - * AUTHOR: Alex Rousskov - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" -#include "Mem.h" -//#include "Store.h" -#include "HttpHeaderRange.h" -//#include "client_side_request.h" -#include "ACLChecklist.h" - -/* Stub routines */ -SQUIDCEXTERN void -cachemgrRegister(const char *, const char *, OBJH *, int, int) -{} - -SQUIDCEXTERN void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, const char *str) -{ - fatal ("dummy function\n"); -} - -#if STDC_HEADERS -SQUIDCEXTERN void -storeAppendPrintf(StoreEntry *, const char *,...) -#else -SQUIDCEXTERN void storeAppendPrintf() -#endif -{ - fatal ("dummy function\n"); -} - -extern -void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void -storeBuffer(StoreEntry * e) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void -storeBufferFlush(StoreEntry * e) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void storeAppendVPrintf(StoreEntry *, const char *, va_list ap) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN HttpHeaderEntry *httpHeaderGetEntry(const HttpHeader * hdr, HttpHeaderPos * pos) -{ - fatal ("dummy function\n"); - return NULL; -} - -int -ACLChecklist::fastCheck() -{ - fatal ("dummy function\n"); - return 0; -} - -void -ACLChecklist::operator delete (void *address) -{ - safe_free( address); -} - -ACLChecklist::~ACLChecklist(){} - -SQUIDCEXTERN ACLChecklist *aclChecklistCreate(const acl_access *, - HttpRequest *, - const char *ident) -{ - fatal ("dummy function\n"); - return NULL; -} - -extern String httpHeaderGetList(const HttpHeader * hdr, http_hdr_type id) -{ - fatal ("dummy function\n"); - return String(); -} - -SQUIDCEXTERN int httpHeaderHas(const HttpHeader * hdr, http_hdr_type type) -{ - fatal ("dummy function\n"); - return 0; -} - -SQUIDCEXTERN void httpHdrContRangeDestroy(HttpHdrContRange * crange) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void httpHdrContRangeSet(HttpHdrContRange *, HttpHdrRangeSpec, ssize_t) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN void httpHeaderPutContRange(HttpHeader * hdr, const HttpHdrContRange * cr) -{ - fatal ("dummy function\n"); -} - -SQUIDCEXTERN HttpHdrContRange *httpHdrContRangeCreate(void) -{ - fatal ("dummy function\n"); - return NULL; -} - -void -testRangeParser(char const *rangestring) -{ - String aString (rangestring); - HttpHdrRange *range = HttpHdrRange::ParseCreate (&aString); - - if (!range) - exit (1); - - HttpHdrRange copy(*range); - - assert (copy.specs.count == range->specs.count); - - HttpHdrRange::iterator pos = range->begin(); - - assert (*pos); - - delete range; -} - -HttpHdrRange * -rangeFromString(char const *rangestring) -{ - String aString (rangestring); - HttpHdrRange *range = HttpHdrRange::ParseCreate (&aString); - - if (!range) - exit (1); - - return range; -} - -void -testRangeIter () -{ - HttpHdrRange *range=rangeFromString("bytes=0-3, 1-, -2"); - assert (range->specs.count == 3); - size_t counter = 0; - HttpHdrRange::iterator i = range->begin(); - - while (i != range->end()) { - ++counter; - ++i; - } - - assert (counter == 3); - i = range->begin(); - assert (i - range->begin() == 0); - ++i; - assert (i - range->begin() == 1); - assert (i - range->end() == -2); -} - -void -testRangeCanonization() -{ - HttpHdrRange *range=rangeFromString("bytes=0-3, 1-, -2"); - assert (range->specs.count == 3); - - /* 0-3 needs a content length of 4 */ - /* This passes in the extant code - but should it? */ - - if (!range->canonize(3)) - exit(1); - - assert (range->specs.count == 3); - - delete range; - - range=rangeFromString("bytes=0-3, 1-, -2"); - - assert (range->specs.count == 3); - - /* 0-3 needs a content length of 4 */ - if (!range->canonize(4)) - exit(1); - - delete range; - - range=rangeFromString("bytes=3-6"); - - assert (range->specs.count == 1); - - /* 3-6 needs a content length of 4 or more */ - if (range->canonize(3)) - exit(1); - - delete range; - - range=rangeFromString("bytes=3-6"); - - assert (range->specs.count == 1); - - /* 3-6 needs a content length of 4 or more */ - if (!range->canonize(4)) - exit(1); - - delete range; - - range=rangeFromString("bytes=1-1,2-3"); - - assert (range->specs.count == 2); - - if (!range->canonize(4)) - exit(1); - - assert (range->specs.count == 2); - - delete range; -} - -int -main (int argc, char **argv) -{ - Mem::Init(); - /* enable for debugging to console */ - // _db_init (NULL, NULL); - // Debug::Levels[64] = 9; - testRangeParser ("bytes=0-3"); - testRangeParser ("bytes=-3"); - testRangeParser ("bytes=1-"); - testRangeParser ("bytes=0-3, 1-, -2"); - testRangeIter (); - testRangeCanonization(); - return 0; -}