From: wessels <> Date: Thu, 17 Jul 1997 02:31:45 +0000 (+0000) Subject: successful compile after merging 1.1.10 thru 1.1.14 X-Git-Tag: SQUID_3_0_PRE1~4879 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8873879072298d87402309ab70eb85938d040624;p=thirdparty%2Fsquid.git successful compile after merging 1.1.10 thru 1.1.14 --- diff --git a/ChangeLog b/ChangeLog index fbf3b6a142..898589463b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Changes to squid-1.2.alpha5 (): + + - New configuration system. Everything is generated from + 'cf.data.pre', including the main parser, setting defaults, + outputting current values, and freeing memory. + This also involved moving some of the local data structures + (e.g. struct _acl *AclList in acl.c) to the Config + structure. (Max Okumoto) + - No more '/i' for regular expressions. Now insert a '-i' + to switch to case-insensitive. Use '+i' for case-sensitive. + - When you have a variable named the same as its type, sizeof() + gets the wrong one (fde). + - Need to flush unbuffered logs before fork(). + - Added two fields swap log: refcount and e->flag. + - Removed all the .h files for each .c file. Now #include stuff + is in either: defines.h, enums.h, typedefs.h, structs.h, + or protos.h, globals.h. This greatly reduces dependencies + between the various source files. + - globals.c is generated from globals.h by a Perl script. + Changes to squid-1.2.alpha4 (): - New MIME configuration, regular expression based @@ -61,6 +81,95 @@ Changes to squid-1.2.alpha1 (): ============================================================================== +Changes to squid-1.1.14 (July 11, 1997): + + - Another try at log_url crap. Added icpState->log_url + member. Set mem_obj->log_url in new_MemObject() which + means passing more args to storeCreateEntry(). Also added + urlClean() which calls urlParse(); needed for ICP logging. + - Clean URLs will be truncated at '?' if present. + - Give fd_note() the clean URL. + +Changes to squid-1.1.13 (July 9, 1997): + + - Fixed storeLog() coredump on mem->log_url. + - Fixed string bounds bug if a redirector returns a short + hostname which require appending 'append_domain' (David + Lamkin). + - Added 'fake_user_agent' to configuration because HTTP + anonymizing strips the User-Agent which some servers require. + +Changes to squid-1.1.12 (July 5, 1997): + + - Fixed dnsserver buffer overflow bug and other problems related + to long, bogus domain names. + - Fixed occasional incorrect ERR_DNS_FAIL errors caused when + an IP cache entry gets released about the same time an + ICP query timeout occurs. + - Fixed setrlimit() bugs seen on DUNIX 4.0; rl.rlim_max == 0. + - Only strip 'Proxy-authorization' header when USE_PROXY_AUTH + is defined and proxy_auth is configured (Ron Gomes). + - Added missing calls to reset socket timeouts for SSL + and passthrough requests. + - Fixed "Available number of file descriptors" value in + cachemgr info output. + - Fixed coredump in proxyAuthenticate() if password file + has an entry with only a user name (Jordan Hrycaj). + - Security patch for usernames and passwords in URLs. + + ftpget would insert a BASE URL including the username and + password for directory listings IF the original request did + NOT include the the trailing slash. This could be disabled + with a command line option, but is enabled by default. Now + its #ifdefd out. + + Usernames and passwords could be logged to access.log and + store.log. Now a new element, + StoreEntry->MemObject->log_url, holds a copy of the requested + URL without the name and password. This isn't 100% fixed yet + because log_url gets generated when the StoreEntry gets + created. If the StoreEntry never gets created, then the URL + with name and password will get logged. Also, the name and + password are not stripped from ICP requests. Also, this + changes store.log. Previously we logged StoreEntry->key + which would look different than the URL for private entries, + but now we'll always log the URL. + + Finally, we now set REQ_AUTH for any request that includes a + name or password. This prevents the request from being + cached (!) and prevents it from being sent to neighbor + caches. In other words, its treated just as if an + Authorization request header were present. + - Fixed Byte-Range handling so that valid, whole objects + are not released. + +Changes to squid-1.1.11 (June 14, 1997): + + - Clean up NeXTStep compiler warnings (Karsten Heinze, Ed Knowles). + - Don't forward 'Proxy-Authorization' headers (Chris Pascoe). + - Fixed up Host: header parsing (Henrik Nordstrom). + - Changed DefaultObjectsPerBucket to 20 in cache_cf.c. + - Fixed parsePathname() bug for magic word "none". + - Fixed ipcache_release to rename entries which get stuck with locks. + - Fixed "eventDelete(peerCheckConnect, e);" bug when the DNS lookup + is pending. + - Add sys/types.h to lib/safe_inet_addr.c for NeXTSTEP (Timo + Hennerich). + - Fixed cur_len decrement bug in diskHandleRead() + (Michael O'Reilly). + - Added contrib/rredir.pl from Peter Eisenhauer. + - Always forward requests with 'Byte-Range' headers (Ron Gomes). + - Fixed StoreEntry client offset bug which could trigger a + fatal_dump(). + - Fixed noticing that dnsservers have shut down during restart. + - Added contrib/nextstep installer package from Gerben Wierda. + - Modified storeDirClean() to remove swap files where the + number is being used, but the file is in the wrong directory. + - Allow PURGE method on all protocols. + - Added 'icp_hit_stale' option. + - Fixed proxy auth refresh bug (Chris Pascoe). + - Don't check for other filename extensions if an FTP URL + ends with .txt (Ed Knowles). + - Relocated ERR_NO_CLIENT_BIG_OBJ check to eliminate incorrect + (but harmless) error message. + Changes to squid-1.1.10 (April 24, 1997): - Require 0 <= multicast ttl <= 128. diff --git a/configure b/configure index 8a42903a34..4af7d1a805 100755 --- a/configure +++ b/configure @@ -1531,6 +1531,7 @@ for ac_hdr in \ errno.h \ fcntl.h \ getopt.h \ + gnumalloc.h \ grp.h \ libc.h \ limits.h \ @@ -1570,17 +1571,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1574: checking for $ac_hdr" >&5 +echo "configure:1575: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1608,12 +1609,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1612: checking for working const" >&5 +echo "configure:1613: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1684,16 +1685,16 @@ fi echo $ac_n "checking if ANSI prototypes work""... $ac_c" 1>&6 -echo "configure:1688: checking if ANSI prototypes work" >&5 +echo "configure:1689: checking if ANSI prototypes work" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ANSI_PROTOTYPES 1 @@ -1709,9 +1710,9 @@ fi rm -f conftest* echo $ac_n "checking for tm->tm_gmtoff""... $ac_c" 1>&6 -echo "configure:1713: checking for tm->tm_gmtoff" >&5 +echo "configure:1714: checking for tm->tm_gmtoff" >&5 cat > conftest.$ac_ext < #include @@ -1720,7 +1721,7 @@ struct tm foo; foo.tm_gmtoff = 0; ; return 0; } EOF -if { (eval echo configure:1724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TM_GMTOFF 1 @@ -1736,9 +1737,9 @@ fi rm -f conftest* echo $ac_n "checking for extended mallinfo""... $ac_c" 1>&6 -echo "configure:1740: checking for extended mallinfo" >&5 +echo "configure:1741: checking for extended mallinfo" >&5 cat > conftest.$ac_ext < #include @@ -1747,7 +1748,7 @@ struct mallinfo foo; foo.mxfast = 0; ; return 0; } EOF -if { (eval echo configure:1751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1752: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_EXT_MALLINFO 1 @@ -1763,9 +1764,9 @@ fi rm -f conftest* echo $ac_n "checking for ip->ip_hl""... $ac_c" 1>&6 -echo "configure:1767: checking for ip->ip_hl" >&5 +echo "configure:1768: checking for ip->ip_hl" >&5 cat > conftest.$ac_ext < #include @@ -1782,7 +1783,7 @@ struct iphdr ip; ip.ip_hl= 0; ; return 0; } EOF -if { (eval echo configure:1786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_IP_HL 1 @@ -1798,7 +1799,7 @@ fi rm -f conftest* echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1802: checking size of int" >&5 +echo "configure:1803: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1806,7 +1807,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1817,7 +1818,7 @@ main() exit(0); } EOF -if { (eval echo configure:1821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1837,7 +1838,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1841: checking size of long" >&5 +echo "configure:1842: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1845,7 +1846,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1856,7 +1857,7 @@ main() exit(0); } EOF -if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1879,19 +1880,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1883: checking for working alloca.h" >&5 +echo "configure:1884: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1912,12 +1913,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1916: checking for alloca" >&5 +echo "configure:1917: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1972,12 +1973,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1976: checking whether alloca needs Cray hooks" >&5 +echo "configure:1977: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2006: checking for $ac_func" >&5 +echo "configure:2007: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2057,7 +2058,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2061: checking stack direction for C alloca" >&5 +echo "configure:2062: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2065,7 +2066,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2107,12 +2108,12 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2111: checking for pid_t" >&5 +echo "configure:2112: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2140,12 +2141,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2144: checking for size_t" >&5 +echo "configure:2145: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2173,12 +2174,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:2177: checking for ssize_t" >&5 +echo "configure:2178: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2206,12 +2207,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2210: checking for off_t" >&5 +echo "configure:2211: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2239,12 +2240,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:2243: checking for mode_t" >&5 +echo "configure:2244: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2273,7 +2274,7 @@ fi echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:2277: checking for main in -lnsl" >&5 +echo "configure:2278: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2281,14 +2282,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2316,7 +2317,7 @@ else fi echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:2320: checking for main in -lsocket" >&5 +echo "configure:2321: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2324,14 +2325,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2359,7 +2360,7 @@ else fi echo $ac_n "checking for main in -lgnumalloc""... $ac_c" 1>&6 -echo "configure:2363: checking for main in -lgnumalloc" >&5 +echo "configure:2364: checking for main in -lgnumalloc" >&5 ac_lib_var=`echo gnumalloc'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2367,14 +2368,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lgnumalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2411,7 +2412,7 @@ if test "$ac_cv_lib_gnumalloc_main" = "no"; then ;; *) echo $ac_n "checking for main in -lmalloc""... $ac_c" 1>&6 -echo "configure:2415: checking for main in -lmalloc" >&5 +echo "configure:2416: checking for main in -lmalloc" >&5 ac_lib_var=`echo malloc'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2419,14 +2420,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmalloc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2457,7 +2458,7 @@ fi esac fi echo $ac_n "checking for main in -lbsd""... $ac_c" 1>&6 -echo "configure:2461: checking for main in -lbsd" >&5 +echo "configure:2462: checking for main in -lbsd" >&5 ac_lib_var=`echo bsd'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2465,14 +2466,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2500,7 +2501,7 @@ else fi echo $ac_n "checking for main in -lregex""... $ac_c" 1>&6 -echo "configure:2504: checking for main in -lregex" >&5 +echo "configure:2505: checking for main in -lregex" >&5 ac_lib_var=`echo regex'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2508,14 +2509,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lregex $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2536,7 +2537,7 @@ else fi echo $ac_n "checking for inet_aton in -lresolv""... $ac_c" 1>&6 -echo "configure:2540: checking for inet_aton in -lresolv" >&5 +echo "configure:2541: checking for inet_aton in -lresolv" >&5 ac_lib_var=`echo resolv'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2544,7 +2545,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2571,7 +2572,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for inet_aton in -l44bsd""... $ac_c" 1>&6 -echo "configure:2575: checking for inet_aton in -l44bsd" >&5 +echo "configure:2576: checking for inet_aton in -l44bsd" >&5 ac_lib_var=`echo 44bsd'_'inet_aton | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2579,7 +2580,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l44bsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2622,7 +2623,7 @@ else fi echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6 -echo "configure:2626: checking for main in -lresolv" >&5 +echo "configure:2627: checking for main in -lresolv" >&5 ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2630,14 +2631,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2665,7 +2666,7 @@ else fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:2669: checking for main in -lm" >&5 +echo "configure:2670: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2673,14 +2674,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2709,7 +2710,7 @@ fi echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:2713: checking for crypt in -lcrypt" >&5 +echo "configure:2714: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2717,7 +2718,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2751,7 +2752,7 @@ fi case "$host" in - i386-*-solaris2.?) + i386-*-solaris2.*) if test "$GCC" = "yes"; then echo "Removing -O for gcc on $host" CFLAGS="`echo $CFLAGS | sed -e 's/-O[0-9]*//'`" @@ -2808,6 +2809,7 @@ for ac_func in \ memcpy \ memmove \ mktime \ + mstats \ poll \ random \ regcomp \ @@ -2829,12 +2831,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2833: checking for $ac_func" >&5 +echo "configure:2835: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2883,7 +2885,7 @@ done echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6 -echo "configure:2887: checking if GNUregex needs to be compiled" >&5 +echo "configure:2889: checking if GNUregex needs to be compiled" >&5 if test "$ac_cv_func_regcomp" = "no" ; then USE_GNUREGEX="yes" else @@ -2916,12 +2918,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2920: checking for $ac_func" >&5 +echo "configure:2922: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2972,12 +2974,12 @@ done echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6 -echo "configure:2976: checking Default FD_SETSIZE value" >&5 +echo "configure:2978: checking Default FD_SETSIZE value" >&5 if test "$cross_compiling" = yes; then DEFAULT_FD_SETSIZE=256 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then DEFAULT_FD_SETSIZE=`cat conftestval` else @@ -3020,12 +3022,12 @@ EOF echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6 -echo "configure:3024: checking Maximum number of filedescriptors we can open" >&5 +echo "configure:3026: checking Maximum number of filedescriptors we can open" >&5 if test "$cross_compiling" = yes; then SQUID_MAXFD=256 else cat > conftest.$ac_ext < @@ -3077,7 +3079,7 @@ main() { } EOF -if { (eval echo configure:3081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_MAXFD=`cat conftestval` else @@ -3096,12 +3098,12 @@ EOF echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6 -echo "configure:3100: checking Default UDP send buffer size" >&5 +echo "configure:3102: checking Default UDP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -3120,7 +3122,7 @@ main () } EOF -if { (eval echo configure:3124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_SNDBUF=`cat conftestval` else @@ -3139,12 +3141,12 @@ EOF echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6 -echo "configure:3143: checking Default UDP receive buffer size" >&5 +echo "configure:3145: checking Default UDP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -3163,7 +3165,7 @@ main () } EOF -if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_RCVBUF=`cat conftestval` else @@ -3182,12 +3184,12 @@ EOF echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6 -echo "configure:3186: checking Default TCP send buffer size" >&5 +echo "configure:3188: checking Default TCP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -3206,7 +3208,7 @@ main () } EOF -if { (eval echo configure:3210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_SNDBUF=`cat conftestval` else @@ -3225,12 +3227,12 @@ EOF echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6 -echo "configure:3229: checking Default TCP receive buffer size" >&5 +echo "configure:3231: checking Default TCP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -3249,7 +3251,7 @@ main () } EOF -if { (eval echo configure:3253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_RCVBUF=`cat conftestval` else @@ -3268,16 +3270,16 @@ EOF echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6 -echo "configure:3272: checking if sys_errlist is already defined" >&5 +echo "configure:3274: checking if sys_errlist is already defined" >&5 cat > conftest.$ac_ext < int main() { char *s = sys_errlist[0]; ; return 0; } EOF -if { (eval echo configure:3281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3293,16 +3295,16 @@ fi rm -f conftest* echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6 -echo "configure:3297: checking for libresolv _dns_ttl_ hack" >&5 +echo "configure:3299: checking for libresolv _dns_ttl_ hack" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF diff --git a/configure.in b/configure.in index da5b670061..127fd01e0b 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.73 1997/06/20 00:03:25 wessels Exp $ +dnl $Id: configure.in,v 1.74 1997/07/16 20:31:47 wessels Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.73 $)dnl +AC_REVISION($Revision: 1.74 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(aux) @@ -143,6 +143,7 @@ AC_CHECK_HEADERS( \ errno.h \ fcntl.h \ getopt.h \ + gnumalloc.h \ grp.h \ libc.h \ limits.h \ @@ -268,7 +269,7 @@ AC_SUBST(CRYPTLIB) dnl System-specific library modifications dnl case "$host" in - i386-*-solaris2.?) + i386-*-solaris2.*) if test "$GCC" = "yes"; then echo "Removing -O for gcc on $host" CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`" @@ -323,6 +324,7 @@ AC_CHECK_FUNCS(\ memcpy \ memmove \ mktime \ + mstats \ poll \ random \ regcomp \ diff --git a/contrib/rredir.pl b/contrib/rredir.pl new file mode 100755 index 0000000000..ec053a038e --- /dev/null +++ b/contrib/rredir.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl -T -w +# +# rredir.pl +# +# Author: Peter Eisenhauer +# First Version: 26. May 1997 +# +# Description: Direct all request to files who are in a local dir to +# this directory +# +use File::Basename; +use URI::URL; + +# customization part + +# Local Domainame from which no redirects should be done +$localdomain = 'pipetronix.de'; +# Local domainame qouted for regexps +$regexlocaldomain = quotemeta($localdomain); +# Path under which the scripts accesses the local dir (must end with /) +$access_local_dir='/opt/utils/etc/httpd/htdocs/local-rredir/'; +# Information for the redirected URL (redirect_path must end with /) +$redirect_scheme = 'http'; +$redirect_host = 'ws-server.pipetronix.de'; +$redirect_path = 'local-rredir/'; + +# end of customization part + +# flush after every print +$| = 1; + +# Process lines of the form 'URL ip-address/fqdn ident method' +# See release notes of Squid 1.1 for details +while ( <> ) { + ($url, $addr, $fqdn, $ident, $method) = m:(\S*) (\S*)/(\S*) (\S*) (\S*):; + + $url = url $url; + $host = lc($url->host); + + # do not process hosts in local domain or unqualified hostnames + if ( $host =~ /$regexlocaldomain/ || $host !~ /\./ ) { + next; + } + + # just the file, without any host or path parts + # and just in case: lowercase the file name, so you should make sure + # all the files in the local dir are only lowercase !! + $file = lc(basename($url->path)); + + # look if in local dir, if yes redirect + if ( $file && -r $access_local_dir . $file + && $file ne '.' && $file ne '..' ) { + $url->scheme($redirect_scheme); + $url->host($redirect_host); + $url->path($redirect_path . $file); + } + +} continue { + print "$url $addr/$fqdn $ident $method\n" +} diff --git a/doc/HTTP-codes.txt b/doc/HTTP-codes.txt index 887d69e316..502cb14aa2 100644 --- a/doc/HTTP-codes.txt +++ b/doc/HTTP-codes.txt @@ -43,7 +43,7 @@ Notes: * HTTP 1.1 c Cached unless a query response without expiry information C Cached -E Negatively cached if no expiry headers. +E Negatively cached if no expiry headers t Cached only if expiry information - Not cached diff --git a/include/autoconf.h.in b/include/autoconf.h.in index c22ec3225c..aa78804ff3 100644 --- a/include/autoconf.h.in +++ b/include/autoconf.h.in @@ -130,6 +130,9 @@ /* Define if you have the mktime function. */ #undef HAVE_MKTIME +/* Define if you have the mstats function. */ +#undef HAVE_MSTATS + /* Define if you have the poll function. */ #undef HAVE_POLL @@ -226,6 +229,9 @@ /* Define if you have the header file. */ #undef HAVE_GETOPT_H +/* Define if you have the header file. */ +#undef HAVE_GNUMALLOC_H + /* Define if you have the header file. */ #undef HAVE_GRP_H diff --git a/include/util.h b/include/util.h index 96a4f91803..f77044283a 100644 --- a/include/util.h +++ b/include/util.h @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.30 1997/05/26 04:04:52 wessels Exp $ + * $Id: util.h,v 1.31 1997/07/16 20:31:53 wessels Exp $ * * AUTHOR: Harvest Derived * @@ -134,6 +134,7 @@ extern char *uudecode _PARAMS((const char *)); extern char *xstrdup _PARAMS((const char *)); extern const char *xstrerror _PARAMS((void)); extern int tvSubMsec _PARAMS((struct timeval, struct timeval)); +extern int tvSubUsec _PARAMS((struct timeval, struct timeval)); extern char *xstrncpy _PARAMS((char *, const char *, size_t)); extern time_t parse_rfc1123 _PARAMS((const char *str)); extern void *xcalloc _PARAMS((int, size_t)); diff --git a/lib/getfullhostname.c b/lib/getfullhostname.c index 045108304a..51a68cd4f5 100644 --- a/lib/getfullhostname.c +++ b/lib/getfullhostname.c @@ -1,6 +1,6 @@ /* - * $Id: getfullhostname.c,v 1.13 1997/04/28 04:30:04 wessels Exp $ + * $Id: getfullhostname.c,v 1.14 1997/07/16 20:31:53 wessels Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -107,6 +107,9 @@ #include "config.h" +#if HAVE_LIBC_H +#include +#endif #if HAVE_STDIO_H #include #endif diff --git a/lib/safe_inet_addr.c b/lib/safe_inet_addr.c index ce29c0f372..156c0f72f4 100644 --- a/lib/safe_inet_addr.c +++ b/lib/safe_inet_addr.c @@ -9,6 +9,12 @@ #if HAVE_UNISTD_H #include #endif +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_SYS_SOCKET_H +#include +#endif #if HAVE_NETINET_IN_H #include #endif diff --git a/lib/tempnam.c b/lib/tempnam.c index 082787ad85..1529d4fbd6 100644 --- a/lib/tempnam.c +++ b/lib/tempnam.c @@ -10,9 +10,15 @@ #include "config.h" +#if HAVE_LIBC_H +#include +#endif #if HAVE_STDIO_H #include #endif +#if HAVE_TYPES_H +#include +#endif #if HAVE_LIMITS_H #include #endif diff --git a/lib/util.c b/lib/util.c index 60a6e40d0c..f0b38eb432 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1,5 +1,5 @@ /* - * $Id: util.c,v 1.29 1997/02/21 16:28:36 wessels Exp $ + * $Id: util.c,v 1.30 1997/07/16 20:31:55 wessels Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -120,7 +120,9 @@ #if HAVE_UNISTD_H #include #endif -#if HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) +#if HAVE_GNUMALLLOC_H +#include +#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) #include #endif #if HAVE_ERRNO_H @@ -459,6 +461,13 @@ tvSubMsec(struct timeval t1, struct timeval t2) (t2.tv_usec - t1.tv_usec) / 1000; } +int +tvSubUsec(struct timeval t1, struct timeval t2) +{ + return (t2.tv_sec - t1.tv_sec) * 1000000 + + (t2.tv_usec - t1.tv_usec); +} + /* * xstrncpy() - similar to strncpy(3) but terminates string * always with '\0' if n != 0, and doesn't do padding diff --git a/scripts/fileno-to-pathname.pl b/scripts/fileno-to-pathname.pl new file mode 100755 index 0000000000..7d2f328806 --- /dev/null +++ b/scripts/fileno-to-pathname.pl @@ -0,0 +1,45 @@ +#!/usr/local/bin/perl + +# $Id: fileno-to-pathname.pl,v 1.2 1997/07/16 20:31:55 wessels Exp $ +# Convert hexadecimal cache file numbers (from swap log) into full pathnames. +# Duane Wessels 6/30/97 + +require 'getopts.pl'; + +&Getopts('c:'); +$L1 = 16; +$L2 = 256; + +$CF = $opt_c || '/usr/local/squid/etc/squid.conf'; +&usage unless (open (CF)); +$ncache_dirs = 0; +while () { + $CD[$ncache_dirs++] = $1 if (/^cache_dir\s+(\S+)/); + $L1 = $1 if (/^swap_level1_dirs\s+(\d+)/); + $L2 = $1 if (/^swap_level2_dirs\s+(\d+)/); +} +close(CF); +unless ($ncache_dirs) { + $CD[$ncache_dirs++] = '/usr/local/squid/cache'; +} + + +while (<>) { + chop; + print &storeSwapFullPath(hex($_)), "\n"; +} + +sub storeSwapFullPath { + local($fn) = @_; + sprintf "%s/%02X/%02X/%08X", + $CD[$fn % $ncache_dirs], + ($fn / $ncache_dirs) % $L1, + ($fn / $ncache_dirs) / $L1 % $L2, + $fn; +} + +sub usage { + print STDERR "usage: $0 -c config\n"; + print STDERR "hexadecimal file numbers are read from stdin\n"; + exit 1; +} diff --git a/src/cache_cf.cc b/src/cache_cf.cc index dae1df5e4e..9f8016b3d2 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.209 1997/07/16 05:25:04 wessels Exp $ + * $Id: cache_cf.cc,v 1.210 1997/07/16 20:31:57 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -55,7 +55,6 @@ static void configDoConfigure _PARAMS((void)); static void parse_refreshpattern _PARAMS((refresh_t **)); static int parseTimeUnits _PARAMS((const char *unit)); static void parseTimeLine _PARAMS((time_t * tptr, const char *units)); - static void parse_string _PARAMS((char **)); static void parse_wordlist _PARAMS((wordlist **)); static void default_all _PARAMS((void)); @@ -502,7 +501,7 @@ debug(0,0)("token = %p\n", token); } p->host = xstrdup(token); if ((token = strtok(NULL, w_space)) == NULL) { - debug(0,0)("bad type\n"); + debug(0, 0) ("bad type\n"); self_destruct(); } p->type = parseNeighborType(token); diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 418dad062f..be0ac59237 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -1,7 +1,7 @@ /* - * $Id: cachemgr.cc,v 1.55 1997/07/15 23:23:16 wessels Exp $ + * $Id: cachemgr.cc,v 1.56 1997/07/16 20:31:58 wessels Exp $ * * DEBUG: section 0 CGI Cache Manager * AUTHOR: Harvest Derived @@ -131,7 +131,9 @@ #if HAVE_GRP_H #include #endif -#if HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) +#if HAVE_GNUMALLOC_H +#include +#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) #include #endif #if HAVE_MEMORY_H @@ -984,7 +986,7 @@ main(int argc, char *argv[]) printf("\n\n"); print_trailer(); - (void) close(conn); + close(conn); exit(0); /* NOTREACHED */ return 0; diff --git a/src/cf.data.pre b/src/cf.data.pre index 266fd97188..194b6275d1 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1595,6 +1595,21 @@ DOC_START log_icp_queries on DOC_END +NAME: icp_hit_stale +COMMENT: on|off +TYPE: onoff +DEFAULT: off +LOC: Config.Options.icp_hit_stale +DOC_START + If you want to return ICP_HIT for stale cache objects, set this + option to 'on'. If you have sibling relationships with caches + in other administrative domains, this should be 'off'. If you only + have sibling relationships with caches under your control, then + it is probably okay to set this to 'on'. + +icp_hit_stale off +DOC_END + NAME: minimum_direct_hops TYPE: int @@ -1803,4 +1818,21 @@ DOC_END # XXX need docs #DOC_END +NAME: fake_user_agent +TYPE: eol +LOC: Config.fake_ua +DEFAULT: none +DOC_START + If you use the paranoid http_anonymizer setting, Squid will strip + your User-agent string from the request. Some Web servers will + refuse your request without a User-agent string. Use this to + fake one up. For example: + + fake_user_agent Nutscrape/1.0 (CP/M; 8-bit) + (credit to Paul Southworth pauls@etext.org for this one!) + +fake_user_agent none +DOC_END + + EOF diff --git a/src/client.cc b/src/client.cc index cbd163b9cc..ffc874a7db 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,8 +1,7 @@ - /* - * $Id: client.cc,v 1.19 1997/07/15 23:23:18 wessels Exp $ + * $Id: client.cc,v 1.20 1997/07/16 20:31:59 wessels Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -120,14 +119,16 @@ static void usage(const char *progname) { fprintf(stderr, - "Usage: %s [-rs] [-i IMS_time] [-h host] [-p port] [-m method] url\n" + "Usage: %s [-ars] [-i IMS] [-h host] [-p port] [-m method] [-t count] url\n" "Options:\n" + " -a Do NOT include Accept: header.\n" " -r Force cache to reload URL.\n" " -s Silent. Do not print data to stdout.\n" " -i IMS If-Modified-Since time (in Epoch seconds).\n" " -h host Retrieve URL from cache on hostname. Default is localhost.\n" " -p port Port number of cache. Default is %d.\n" - " -m method Request method, default is GET.\n", + " -m method Request method, default is GET.\n" + " -t count Trace count cache-hops\n", progname, CACHE_HTTP_PORT); exit(1); } @@ -138,6 +139,7 @@ main(int argc, char *argv[]) int conn, c, len, bytesWritten; int port, to_stdout, reload; int keep_alive = 0; + int opt_noaccept = 0; char url[BUFSIZ], msg[BUFSIZ], buf[BUFSIZ], hostname[BUFSIZ]; const char *method = "GET"; extern char *optarg; @@ -156,15 +158,16 @@ main(int argc, char *argv[]) strcpy(url, argv[argc - 1]); if (url[0] == '-') usage(argv[0]); - while ((c = getopt(argc, argv, "fsrnkp:c:h:i:m:t:?")) != -1) + while ((c = getopt(argc, argv, "ah:i:km:p:rst:?")) != -1) switch (c) { + case 'a': + opt_noaccept = 1; + break; case 'h': /* host:arg */ - case 'c': /* backward compat */ if (optarg != NULL) strcpy(hostname, optarg); break; case 's': /* silent */ - case 'n': /* backward compat */ to_stdout = 0; break; case 'k': /* backward compat */ @@ -216,8 +219,10 @@ main(int argc, char *argv[]) sprintf(buf, "Pragma: no-cache\r\n"); strcat(msg, buf); } - sprintf(buf, "Accept: */*\r\n"); - strcat(msg, buf); + if (opt_noaccept == 0) { + sprintf(buf, "Accept: */*\r\n"); + strcat(msg, buf); + } if (ims) { sprintf(buf, "If-Modified-Since: %s\r\n", mkrfc1123(ims)); strcat(msg, buf); diff --git a/src/client_side.cc b/src/client_side.cc index 3b0917d641..0da37e3414 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.117 1997/07/15 23:23:19 wessels Exp $ + * $Id: client_side.cc,v 1.118 1997/07/16 20:32:00 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -165,6 +165,7 @@ clientRedirectDone(void *data, char *result) { clientHttpRequest *http = data; int fd = http->conn->fd; + size_t l; request_t *new_request = NULL; request_t *old_request = http->request; debug(33, 5) ("clientRedirectDone: '%s' result=%s\n", http->url, @@ -176,7 +177,12 @@ clientRedirectDone(void *data, char *result) new_request = urlParse(old_request->method, result); if (new_request) { safe_free(http->url); - http->url = xstrdup(result); + /* need to malloc because the URL returned by the redirector might + * not be big enough to append the local domain + * -- David Lamkin drl@net-tel.co.uk */ + l = strlen(result) + Config.appendDomainLen + 5; + http->url = xcalloc(l, 1); + xstrncpy(http->url, result, l); new_request->http_ver = old_request->http_ver; new_request->headers = old_request->headers; new_request->headers_sz = old_request->headers_sz; @@ -275,9 +281,9 @@ proxyAuthenticate(const char *headers) debug(33, 5) ("proxyAuthenticate: adding new passwords to hash table\n"); while (user != NULL) { - if (strlen(user) > 1 && strlen(passwd) > 1) { + if (strlen(user) > 1 && passwd && strlen(passwd) > 1) { debug(33, 6) ("proxyAuthenticate: adding %s, %s to hash table\n", user, passwd); - hash_insert(validated, xstrdup(user), xstrdup(passwd)); + hash_insert(validated, xstrdup(user), (void *) xstrdup(passwd)); } user = strtok(NULL, ":"); passwd = strtok(NULL, "\n"); @@ -291,9 +297,8 @@ proxyAuthenticate(const char *headers) Config.proxyAuth.File = NULL; return (dash_str); } + last_time = squid_curtime; } - last_time = squid_curtime; - hashr = hash_lookup(validated, sent_user); if (hashr == NULL) { /* User doesn't exist; deny them */ @@ -337,6 +342,7 @@ icpProcessExpired(int fd, void *data) BIT_SET(http->request->flags, REQ_REFRESH); http->old_entry = http->entry; entry = storeCreateEntry(url, + http->log_url, http->request->flags, http->request->method); /* NOTE, don't call storeLockObject(), storeCreateEntry() does it */ diff --git a/src/comm.cc b/src/comm.cc index c335cf56b7..32490b2375 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,5 @@ - /* - * $Id: comm.cc,v 1.179 1997/07/15 23:23:21 wessels Exp $ + * $Id: comm.cc,v 1.180 1997/07/16 20:32:01 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived diff --git a/src/debug.cc b/src/debug.cc index 3e4eadb1d5..f29494b8e2 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.48 1997/07/14 23:44:58 wessels Exp $ + * $Id: debug.cc,v 1.49 1997/07/16 20:32:02 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -233,7 +233,9 @@ _db_rotate_log(void) int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); +#ifdef S_ISREG struct stat sb; +#endif if (debug_log_file == NULL) return; diff --git a/src/defines.h b/src/defines.h index d519d4ea39..6222423b0e 100644 --- a/src/defines.h +++ b/src/defines.h @@ -217,7 +217,7 @@ #define MAX_LOGIN_SZ 128 /* bitfields for the flags member */ -#define REQ_UNUSED1 0x01 +#define REQ_RANGE 0x01 #define REQ_NOCACHE 0x02 #define REQ_IMS 0x04 #define REQ_AUTH 0x08 diff --git a/src/dns.cc b/src/dns.cc index f028a315df..d51cb57641 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -1,5 +1,6 @@ + /* - * $Id: dns.cc,v 1.37 1997/07/15 05:34:08 wessels Exp $ + * $Id: dns.cc,v 1.38 1997/07/16 20:32:03 wessels Exp $ * * DEBUG: section 34 Dnsserver interface * AUTHOR: Harvest Derived diff --git a/src/dnsserver.cc b/src/dnsserver.cc index ed0aa93123..5048fc4719 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.33 1997/04/28 04:23:05 wessels Exp $ + * $Id: dnsserver.cc,v 1.34 1997/07/16 20:32:03 wessels Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -133,7 +133,9 @@ #if HAVE_GRP_H #include #endif -#if HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) +#if HAVE_GNUMALLOC_H +#include +#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) #include #endif #if HAVE_MEMORY_H @@ -245,11 +247,13 @@ my_h_msgs(int x) return "Unknown DNS problem"; } +#define REQ_SZ 512 + int main(int argc, char *argv[]) { - char request[256]; - char msg[256]; + char request[512]; + char msg[1024]; const struct hostent *result = NULL; FILE *logfile = NULL; long start; @@ -302,13 +306,15 @@ main(int argc, char *argv[]) for (;;) { int retry_count = 0; struct in_addr ip; - memset(request, '\0', 256); + memset(request, '\0', REQ_SZ); /* read from ipcache */ - if (fgets(request, 255, stdin) == NULL) + if (fgets(request, REQ_SZ, stdin) == NULL) exit(1); - if ((t = strrchr(request, '\n')) != NULL) - *t = '\0'; /* strip NL */ + t = strrchr(request, '\n'); + if (t == NULL) /* Ignore if no newline */ + continue; + *t = '\0'; /* strip NL */ if ((t = strrchr(request, '\r')) != NULL) *t = '\0'; /* strip CR */ if (strcmp(request, "$shutdown") == 0) { diff --git a/src/errorpage.cc b/src/errorpage.cc index 32ca17e8dc..0cb30e855a 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.58 1997/07/14 03:33:37 wessels Exp $ + * $Id: errorpage.cc,v 1.59 1997/07/16 20:32:04 wessels Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -80,9 +80,9 @@ static error_data ErrorData[] = {"ERR_LIFETIME_EXP", "Transaction Timeout", "The network or remote site may be down or too slow. Try again later."}, - {"ERR_NO_CLIENTS_BIG_OBJ", + {"ERR_NO_CLIENTS", "No Client", - "All Clients went away before tranmission completed and the object is too big to cache."}, + "All Clients went away before tranmission completed and the object would not be cached."}, {"ERR_READ_ERROR", "Read Error", "The remote site or network may be down. Please try again."}, @@ -152,6 +152,7 @@ errorInitialize(void) meta_data.misc += MAX_URL * 3; } + char * squid_error_url(const char *url, int method, int type, const char *address, int code, const char *msg) { @@ -233,9 +234,9 @@ access_denied_msg(int code, int method, const char *url, const char *client) "

Error

\n" "

Access Denied

\n" "

\n" - "Sorry, you are not currently allowed to request\n" + "Sorry, you are not currently allowed to request:\n" "

    %s
\n" - "From this cache. Please check with the\n" + "from this cache. Please check with the\n" "cache administrator\n" "if you believe this is incorrect.\n" "

\n" @@ -271,7 +272,7 @@ access_denied_redirect(int code, int method, const char *url, const char *client "

Error

\n" "

Access Denied

\n" "

\n" - "Sorry, you are not currently allowed to request\n" + "Sorry, you are not currently allowed to request:\n" "

    %s
\n" "from this cache.\n" "

\n" @@ -305,7 +306,7 @@ authorization_needed_msg(const request_t * request, const char *realm) { sprintf(auth_msg, "Authorization needed\n\

Authorization needed

\n\ -

Sorry, you have to authorize yourself to request\n\ +

Sorry, you have to authorize yourself to request:\n\

    ftp://%s@%s%s
\n\

from this cache. Please check with the\n\ cache administrator\n\ @@ -349,7 +350,7 @@ Content-type: text/html\r\n\ Cache Access Denied\n\

Cache Access Denied

\n\

\n\ -Sorry, you are not currently allowed to request\n\ +Sorry, you are not currently allowed to request:\n\

    %s
\n\ from this cache until you have authenticated yourself.\n\ \n

\ diff --git a/src/globals.h b/src/globals.h index 00b8b10d28..811e05f04a 100644 --- a/src/globals.h +++ b/src/globals.h @@ -36,6 +36,7 @@ extern const char *swapStatusStr[]; extern dnsStatData DnsStats; extern fde *fd_table; /* NULL */ extern int Biggest_FD; /* -1 */ +extern int Number_FD; /* 0 */ extern int HttpSockets[MAXHTTPPORTS]; extern int NDnsServersAlloc; /* 0 */ extern int NHttpSockets; /* 0 */ @@ -86,6 +87,10 @@ extern volatile unsigned long nudpconn; /* 0 */ extern volatile unsigned long ntcpconn; /* 0 */ extern int unlinkd_count; /* 0 */ extern int fileno_stack_count; /* 0 */ +extern int store_rebuilding; /* 1 */ +extern int store_swap_size; /* 0 */ +extern int client_info_sz; /* 0 */ +extern unsigned long store_mem_size; /* 0 */ #ifdef HAVE_SYSLOG extern int _db_level; diff --git a/src/gopher.cc b/src/gopher.cc index 8657e59a13..255f391142 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,6 +1,6 @@ /* - * $Id: gopher.cc,v 1.90 1997/07/15 23:23:23 wessels Exp $ + * $Id: gopher.cc,v 1.91 1997/07/16 20:32:06 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -289,7 +289,7 @@ gopher_url_parser(const char *url, char *host, int *port, char *type_id, char *r request[0] = '\0'; } else { /* convert %xx to char */ - (void) url_convert_hex(request, 0); + url_convert_hex(request, 0); } host[0] = '\0'; diff --git a/src/http.cc b/src/http.cc index 4db89fde8e..995a2b09a8 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.177 1997/07/14 23:45:01 wessels Exp $ + * $Id: http.cc,v 1.178 1997/07/16 20:32:07 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -204,7 +204,7 @@ static PF httpReadReply; static PF httpSendRequest; static PF httpStateFree; static PF httpTimeout; -static void httpAppendRequestHeader _PARAMS((char *hdr, const char *line, size_t * sz, size_t max)); +static void httpAppendRequestHeader _PARAMS((char *hdr, const char *line, size_t * sz, size_t max, int)); static void httpCacheNegatively _PARAMS((StoreEntry *)); static void httpMakePrivate _PARAMS((StoreEntry *)); static void httpMakePublic _PARAMS((StoreEntry *)); @@ -477,6 +477,7 @@ httpCheckPublic(struct _http_reply *reply, HttpStateData * httpState) return -1; break; /* Some responses can never be cached */ + case 206: /* Partial Content -- Not yet supported */ case 303: /* See Other */ case 304: /* Not Modified */ case 401: /* Unauthorized */ @@ -665,17 +666,19 @@ httpSendComplete(int fd, char *buf, int size, int errflag, void *data) } static void -httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, size_t max) +httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, size_t max, int check) { size_t n = *sz + strlen(line) + 2; if (n >= max) return; - if (Config.Options.anonymizer == ANONYMIZER_PARANOID) { - if (!httpAnonAllowed(line)) - return; - } else if (Config.Options.anonymizer == ANONYMIZER_STANDARD) { - if (httpAnonDenied(line)) - return; + if (check) { + if (Config.Options.anonymizer == ANONYMIZER_PARANOID) { + if (!httpAnonAllowed(line)) + return; + } else if (Config.Options.anonymizer == ANONYMIZER_STANDARD) { + if (httpAnonDenied(line)) + return; + } } /* allowed header, explicitly known to be not dangerous */ debug(11, 5) ("httpAppendRequestHeader: %s\n", line); @@ -716,11 +719,11 @@ httpBuildRequestHeader(request_t * request, sprintf(ybuf, "%s %s HTTP/1.0", RequestMethodStr[request->method], *request->urlpath ? request->urlpath : "/"); - httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 1); /* Add IMS header */ if (entry && entry->lastmod && request->method == METHOD_GET) { sprintf(ybuf, "If-Modified-Since: %s", mkrfc1123(entry->lastmod)); - httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 1); EBIT_SET(hdr_flags, HDR_IMS); } end = mime_headers_end(hdr_in); @@ -733,6 +736,11 @@ httpBuildRequestHeader(request_t * request, debug(11, 5) ("httpBuildRequestHeader: %s\n", xbuf); if (strncasecmp(xbuf, "Proxy-Connection:", 17) == 0) continue; +#if USE_PROXY_AUTH + if (strncasecmp(xbuf, "Proxy-authorization:", 20) == 0) + if (Config.proxyAuth.File) + continue; +#endif if (strncasecmp(xbuf, "Connection:", 11) == 0) continue; if (strncasecmp(xbuf, "Host:", 5) == 0) { @@ -763,29 +771,33 @@ httpBuildRequestHeader(request_t * request, sprintf(xbuf, "Max-Forwards: %d", n - 1); } } - httpAppendRequestHeader(hdr_out, xbuf, &len, out_sz - 512); + httpAppendRequestHeader(hdr_out, xbuf, &len, out_sz - 512, 1); + } + hdr_len = t - hdr_in; + if (Config.fake_ua && strstr(hdr_out, "User-Agent") == NULL) { + sprintf(ybuf, "User-Agent: %s", Config.fake_ua); + httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 0); } - hdr_len = end - hdr_in; /* Append Via: */ sprintf(ybuf, "%3.1f %s", orig_request->http_ver, ThisCache); strcat(viabuf, ybuf); - httpAppendRequestHeader(hdr_out, viabuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, viabuf, &len, out_sz, 1); /* Append to X-Forwarded-For: */ strcat(fwdbuf, cfd < 0 ? "unknown" : fd_table[cfd].ipaddr); - httpAppendRequestHeader(hdr_out, fwdbuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, fwdbuf, &len, out_sz, 1); if (!EBIT_TEST(hdr_flags, HDR_HOST)) { sprintf(ybuf, "Host: %s", orig_request->host); - httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 1); } if (!EBIT_TEST(cc_flags, CCC_MAXAGE)) { url = entry ? entry->url : urlCanonical(orig_request, NULL); sprintf(ybuf, "Cache-control: Max-age=%d", (int) getMaxAge(url)); - httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz); + httpAppendRequestHeader(hdr_out, ybuf, &len, out_sz, 1); if (request->urlpath) { assert(strstr(url, request->urlpath)); } } - httpAppendRequestHeader(hdr_out, null_string, &len, out_sz); + httpAppendRequestHeader(hdr_out, null_string, &len, out_sz, 1); put_free_4k_page(xbuf); put_free_4k_page(viabuf); put_free_4k_page(fwdbuf); diff --git a/src/icmp.cc b/src/icmp.cc index 6d9c14c85b..b11946b2a5 100644 --- a/src/icmp.cc +++ b/src/icmp.cc @@ -1,6 +1,6 @@ /* - * $Id: icmp.cc,v 1.40 1997/07/15 05:34:10 wessels Exp $ + * $Id: icmp.cc,v 1.41 1997/07/16 20:32:08 wessels Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -305,8 +305,6 @@ icmpClose(void) return; debug(29, 0) ("Closing ICMP socket on FD %d\n", icmp_sock); comm_close(icmp_sock); - commSetSelect(icmp_sock, COMM_SELECT_READ, NULL, NULL, 0); - commSetSelect(icmp_sock, COMM_SELECT_WRITE, NULL, NULL, 0); icmp_sock = -1; while ((queue = IcmpQueueHead)) { IcmpQueueHead = queue->next; diff --git a/src/ipcache.cc b/src/ipcache.cc index e400a5931c..625f99a976 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.127 1997/07/14 23:48:29 wessels Exp $ + * $Id: ipcache.cc,v 1.128 1997/07/16 20:32:11 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -328,6 +328,9 @@ ipcacheExpiredEntry(ipcache_entry * i) return 0; if (i->expires > squid_curtime) return 0; + if (i->status == IP_CACHED) + if (squid_curtime - i->lastref < 60) + return 0; return 1; } @@ -592,6 +595,10 @@ ipcache_dnsHandleRead(int fd, void *data) dnsData->offset += len; dnsData->ip_inbuf[dnsData->offset] = '\0'; i = dnsData->data; + if (i == NULL) { + debug_trap("NULL ipcache_entry"); + return; + } if (i->status != IP_DISPATCHED) fatal_dump("ipcache_dnsHandleRead: bad status"); if (strstr(dnsData->ip_inbuf, "$end\n")) { diff --git a/src/main.cc b/src/main.cc index dff3a9650d..1e5088b177 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.164 1997/07/16 04:48:29 wessels Exp $ + * $Id: main.cc,v 1.165 1997/07/16 20:32:11 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -292,8 +292,13 @@ shut_down(int sig) debug(1, 1) ("Waiting %d seconds for active connections to finish\n", shutdown_pending > 0 ? Config.shutdownLifetime : 0); #ifdef KILL_PARENT_OPT - debug(1, 1) ("Killing RunCache, pid %d\n", getppid()); - kill(getppid(), sig); + { + pid_t ppid = getppid(); + if (ppid > 1) { + debug(1, 1, "Killing RunCache, pid %d\n", ppid); + kill(ppid, sig); + } + } #endif #if SA_RESETHAND == 0 signal(SIGTERM, SIG_DFL); @@ -414,15 +419,12 @@ serverConnectionsClose(void) theInIcpConnection); if (theInIcpConnection != theOutIcpConnection) comm_close(theInIcpConnection); - commSetSelect(theInIcpConnection, - COMM_SELECT_READ, - NULL, - NULL, 0); - if (theInIcpConnection != theOutIcpConnection) - commSetSelect(theOutIcpConnection, + else + commSetSelect(theInIcpConnection, COMM_SELECT_READ, NULL, - NULL, 0); + NULL, + 0); theInIcpConnection = -1; } if (icmp_sock > -1) @@ -552,6 +554,7 @@ main(int argc, char **argv) int n; /* # of GC'd objects */ time_t loop_delay; + debug_log = stderr; if (FD_SETSIZE < Squid_MaxFD) Squid_MaxFD = FD_SETSIZE; @@ -577,15 +580,7 @@ main(int argc, char **argv) safe_inet_addr("0.0.0.0", &any_addr); memset(&no_addr, '\0', sizeof(struct in_addr)); safe_inet_addr("255.255.255.255", &no_addr); - -#if HAVE_SRANDOM - srandom(time(NULL)); -#elif HAVE_SRAND48 - srand48(time(NULL)); -#else - srand(time(NULL)); -#endif - + squid_srandom(time(NULL)); errorInitialize(); squid_starttime = getCurrentTime(); @@ -613,8 +608,6 @@ main(int argc, char **argv) fd_open(1, FD_LOG, "stdout"); fd_open(2, FD_LOG, "stderr"); - /* preinit for debug module */ - debug_log = stderr; hash_init(0); mainInitialize(); diff --git a/src/neighbors.cc b/src/neighbors.cc index 3ad3441621..364b0d0809 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.152 1997/07/16 04:48:29 wessels Exp $ + * $Id: neighbors.cc,v 1.153 1997/07/16 20:32:12 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -331,6 +331,31 @@ getDefaultParent(request_t * request) return NULL; } +#ifdef HIER_EXPERIMENT +peer * +getRandomParent(request_t * request) +{ + peer *e; + static peer *f = NULL; + peer *next = f; + int n = squid_random() % Peers.n; + int x = n << 1; + while (n && x--) { + e = next ? next : Peers.peers_head; + next = e->next; + if (neighborType(e, request) != PEER_PARENT) + continue; + if (!peerHTTPOkay(e, request)) + continue; + f = e; + n--; + } + if (f && !peerHTTPOkay(f, request)) + return NULL; + return f; +} +#endif + peer * getNextPeer(peer * p) { @@ -715,7 +740,7 @@ peerDestroy(peer * p) struct _domain_ping *nl = NULL; if (p == NULL) return; - if (!p->tcp_up) + if (p->ck_conn_event_pend) eventDelete(peerCheckConnect, p); if (p->type == PEER_MULTICAST) { if (p->mcast.flags & PEER_COUNT_EVENT_PENDING) @@ -791,6 +816,9 @@ peerCheckConnect(void *data) { peer *p = data; int fd; + if (p->ck_conn_event_pend != 1) + debug_trap("bad ck_conn_event_pend counter"); + p->ck_conn_event_pend--; fd = comm_open(SOCK_STREAM, 0, Config.Addrs.tcp_outgoing, 0, COMM_NONBLOCKING, p->host); if (fd < 0) @@ -821,6 +849,7 @@ peerCheckConnectDone(int fd, int status, void *data) debug(15, 0) ("TCP connection to %s/%d succeeded\n", p->host, p->http_port); } else { + p->ck_conn_event_pend++; eventAdd("peerCheckConnect", peerCheckConnect, p, 80); } comm_close(fd); @@ -835,6 +864,7 @@ peerCheckConnectStart(peer * p) debug(15, 0) ("TCP connection to %s/%d failed\n", p->host, p->http_port); p->tcp_up = 0; p->last_fail_time = squid_curtime; + p->ck_conn_event_pend++; eventAdd("peerCheckConnect", peerCheckConnect, p, 80); } @@ -863,7 +893,7 @@ peerCountMcastPeersStart(void *data) fatal_dump("peerCountMcastPeersStart: non-multicast peer"); p->mcast.flags &= ~PEER_COUNT_EVENT_PENDING; sprintf(url, "http://%s/", inet_ntoa(p->in_addr.sin_addr)); - fake = storeCreateEntry(url, 0, METHOD_GET); + fake = storeCreateEntry(url, url, 0, METHOD_GET); psstate->request = requestLink(urlParse(METHOD_GET, url)); psstate->entry = fake; psstate->callback = NULL; diff --git a/src/protos.h b/src/protos.h index 2e538d69b1..cc096492e2 100644 --- a/src/protos.h +++ b/src/protos.h @@ -36,7 +36,7 @@ extern int aio_close _PARAMS((int, aio_result_t *)); extern int aio_stat _PARAMS((const char *, struct stat *, aio_result_t *)); extern int aio_unlink _PARAMS((const char *, aio_result_t *)); extern int aio_opendir _PARAMS((void)); -extern aio_result_t *aio_poll_done(); +extern aio_result_t *aio_poll_done _PARAMS((void)); extern void aioCancel _PARAMS((int)); @@ -64,11 +64,10 @@ extern void cbdataUnlock _PARAMS((void *p)); extern int cbdataValid _PARAMS((void *p)); extern void cbdataDump _PARAMS((StoreEntry *)); -void clientdbInit _PARAMS((void)); -void clientdbUpdate _PARAMS((struct in_addr, log_type, protocol_t)); -int clientdbDeniedPercent _PARAMS((struct in_addr)); -void clientdbDump _PARAMS((StoreEntry *)); -extern int client_info_sz; +extern void clientdbInit _PARAMS((void)); +extern void clientdbUpdate _PARAMS((struct in_addr, log_type, protocol_t)); +extern int clientdbDeniedPercent _PARAMS((struct in_addr)); +extern void clientdbDump _PARAMS((StoreEntry *)); extern void clientAccessCheck _PARAMS((void *)); extern void clientAccessCheckDone _PARAMS((int, void *)); @@ -78,7 +77,7 @@ extern char *clientConstructTraceEcho _PARAMS((clientHttpRequest *)); extern void clientPurgeRequest _PARAMS((clientHttpRequest *)); #if USE_PROXY_AUTH -const char *proxyAuthenticate(const char *headers); +extern const char *proxyAuthenticate(const char *headers); #endif /* USE_PROXY_AUTH */ @@ -441,7 +440,7 @@ extern void memFreeData _PARAMS((mem_hdr *)); /* ----------------------------------------------------------------- */ extern StoreEntry *storeGet _PARAMS((const char *)); -extern StoreEntry *storeCreateEntry _PARAMS((const char *, int, method_t)); +extern StoreEntry *storeCreateEntry _PARAMS((const char *, const char *, int, method_t)); extern void storeSetPublicKey _PARAMS((StoreEntry *)); extern StoreEntry *storeGetFirst _PARAMS((void)); extern StoreEntry *storeGetNext _PARAMS((void)); @@ -493,6 +492,7 @@ extern unsigned int storeReqnum _PARAMS((StoreEntry * entry, method_t)); extern time_t storeExpiredReferenceAge _PARAMS((void)); extern void storeRegisterAbort _PARAMS((StoreEntry * e, STABH * cb, void *)); extern void storeUnregisterAbort _PARAMS((StoreEntry * e)); +extern void storeMemObjectDump _PARAMS((MemObject * mem)); #ifdef __STDC__ extern void storeAppendPrintf _PARAMS((StoreEntry *, const char *,...)); @@ -500,10 +500,6 @@ extern void storeAppendPrintf _PARAMS((StoreEntry *, const char *,...)); extern void storeAppendPrintf _PARAMS(()); #endif -extern int store_rebuilding; -extern int store_swap_size; -extern unsigned long store_mem_size; - extern char *storeSwapFullPath _PARAMS((int, char *)); extern char *storeSwapSubSubDir _PARAMS((int, char *)); extern int storeAddSwapDisk _PARAMS((const char *, @@ -560,7 +556,7 @@ extern int intAverage _PARAMS((int, int, int, int)); extern double doubleAverage _PARAMS((double, double, int, int)); extern void debug_trap _PARAMS((const char *)); extern void logsFlush _PARAMS((void)); - +extern char *checkNullString _PARAMS((char *p)); extern void unlinkdInit _PARAMS((void)); extern void unlinkdClose _PARAMS((void)); @@ -578,6 +574,8 @@ extern void requestUnlink _PARAMS((request_t *)); extern int matchDomainName _PARAMS((const char *d, const char *h)); extern int urlCheckRequest _PARAMS((const request_t *)); extern int urlDefaultPort _PARAMS((protocol_t p)); +extern char *urlClean _PARAMS((char *)); + extern void useragentOpenLog _PARAMS((void)); extern void useragentRotateLog _PARAMS((void)); diff --git a/src/squid.h b/src/squid.h index 129cea7455..8b68752524 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.128 1997/07/14 23:45:03 wessels Exp $ + * $Id: squid.h,v 1.129 1997/07/16 20:32:16 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -88,7 +88,9 @@ #if HAVE_GRP_H #include #endif -#if HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) +#if HAVE_GNUMALLOC_H +#include +#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_) #include #endif #if HAVE_MEMORY_H diff --git a/src/ssl.cc b/src/ssl.cc index 733794cd40..44b55bcf12 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.57 1997/07/16 04:48:31 wessels Exp $ + * $Id: ssl.cc,v 1.58 1997/07/16 20:32:17 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -42,8 +42,7 @@ typedef struct { int offset; char *buf; } client, server; - time_t timeout; - int *size_ptr; /* pointer to size in an ConnStateData for logging */ + size_t *size_ptr; /* pointer to size in an ConnStateData for logging */ int proxying; } SslStateData; @@ -102,12 +101,6 @@ sslStateFree(int fd, void *data) return; if (fd != sslState->server.fd) fatal_dump("sslStateFree: FD mismatch!\n"); - if (sslState->client.fd > -1) { - commSetSelect(sslState->client.fd, - COMM_SELECT_READ, - NULL, - NULL, 0); - } safe_free(sslState->server.buf); safe_free(sslState->client.buf); xfree(sslState->url); @@ -135,6 +128,10 @@ sslReadServer(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { sslClose(sslState); } @@ -219,6 +216,10 @@ sslWriteServer(int fd, void *data) COMM_SELECT_READ, sslReadClient, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { /* still have more to write */ commSetSelect(sslState->server.fd, @@ -264,6 +265,10 @@ sslWriteClient(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { /* still have more to write */ commSetSelect(sslState->client.fd, @@ -390,7 +395,6 @@ sslStart(int fd, const char *url, request_t * request, int *size_ptr) cbdataAdd(sslState); sslState->url = xstrdup(url); sslState->request = requestLink(request); - sslState->timeout = Config.Timeout.read; sslState->size_ptr = size_ptr; sslState->client.fd = fd; sslState->server.fd = sock; @@ -431,6 +435,10 @@ sslProxyConnected(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } static void diff --git a/src/stat.cc b/src/stat.cc index 3247872aee..d667c96472 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.148 1997/07/15 03:29:05 wessels Exp $ + * $Id: stat.cc,v 1.149 1997/07/16 20:32:17 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -110,6 +110,10 @@ #define MAX_LINELEN (4096) #define max(a,b) ((a)>(b)? (a): (b)) +#ifdef HIER_EXPERIMENT +static FILE *hierexplog = NULL; +#endif + typedef struct _log_read_data_t { StoreEntry *sentry; } log_read_data_t; @@ -281,10 +285,6 @@ describeFlags(const StoreEntry * entry) int flags = (int) entry->flag; char *t; buf[0] = '\0'; -#ifdef OLD_CODE - if (BIT_TEST(flags, IP_LOOKUP_PENDING)) - strcat(buf, "IP,"); -#endif if (BIT_TEST(flags, DELETE_BEHIND)) strcat(buf, "DB,"); #ifdef OLD_CODE @@ -533,16 +533,14 @@ info_get(StoreEntry * sentry) { const char *tod = NULL; float f; -#if HAVE_MALLINFO - int t; -#endif - #if defined(HAVE_GETRUSAGE) && defined(RUSAGE_SELF) struct rusage rusage; #endif - -#if HAVE_MALLINFO +#if HAVE_MSTATS && HAVE_GNUMALLOC_H + struct mstats ms; +#elif HAVE_MALLINFO struct mallinfo mp; + int t; #endif storeAppendPrintf(sentry, open_bracket); @@ -607,7 +605,15 @@ info_get(StoreEntry * sentry) rusage.ru_majflt); #endif -#if HAVE_MALLINFO +#if HAVE_MSTATS && HAVE_GNUMALLOC_H + ms = mstats(); + storeAppendPrintf(sentry, "{Memory usage for %s via mstats():}\n", + appname); + storeAppendPrintf(sentry, "{\tTotal space in arena: %6d KB}\n", + ms.bytes_total >> 10); + storeAppendPrintf(sentry, "{\tTotal free: %6d KB %d%%}\n", + ms.bytes_free >> 10, percent(ms.bytes_free, ms.bytes_total)); +#elif HAVE_MALLINFO mp = mallinfo(); storeAppendPrintf(sentry, "{Memory usage for %s via mallinfo():}\n", appname); @@ -644,12 +650,14 @@ info_get(StoreEntry * sentry) #endif /* HAVE_MALLINFO */ storeAppendPrintf(sentry, "{File descriptor usage for %s:}\n", appname); - storeAppendPrintf(sentry, "{\tMax number of file desc available: %4d}\n", + storeAppendPrintf(sentry, "{\tMaximum number of file descriptors: %4d}\n", Squid_MaxFD); storeAppendPrintf(sentry, "{\tLargest file desc currently in use: %4d}\n", Biggest_FD); + storeAppendPrintf(sentry, "{\tNumber of file desc currently in use: %4d}\n", + Number_FD); storeAppendPrintf(sentry, "{\tAvailable number of file descriptors: %4d}\n", - fdstat_are_n_free_fd(0)); + Squid_MaxFD - Number_FD); storeAppendPrintf(sentry, "{\tReserved number of file descriptors: %4d}\n", RESERVED_FD); diff --git a/src/store.cc b/src/store.cc index be0fec01b8..ea59cc6e1f 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.273 1997/07/15 23:23:34 wessels Exp $ + * $Id: store.cc,v 1.274 1997/07/16 20:32:19 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -243,9 +243,6 @@ typedef struct swapout_ctrl_t { StoreEntry *e; } swapout_ctrl_t; -/* initializtion flag */ -int store_rebuilding = 1; - /* Static Functions */ static void storeCreateHashTable _PARAMS((int (*)_PARAMS((const char *, const char *)))); static int compareLastRef _PARAMS((StoreEntry **, StoreEntry **)); @@ -265,8 +262,8 @@ static VCB storeSwapInValidateComplete; static void storeSwapInStartComplete _PARAMS((void *, int)); static int swapInError _PARAMS((int, StoreEntry *)); static mem_hdr *new_MemObjectData _PARAMS((void)); -static MemObject *new_MemObject _PARAMS((void)); -static StoreEntry *new_StoreEntry _PARAMS((int)); +static MemObject *new_MemObject _PARAMS((const char *)); +static StoreEntry *new_StoreEntry _PARAMS((int, const char *)); static StoreEntry *storeAddDiskRestore _PARAMS((const char *, int, int, @@ -308,15 +305,11 @@ static hash_table *store_table = NULL; /* hash table for in-memory-only objects */ static hash_table *in_mem_table = NULL; -/* current memory storage size */ -unsigned long store_mem_size = 0; - static int store_pages_max = 0; static int store_pages_high = 0; static int store_pages_low = 0; /* current file name, swap file, use number as a filename */ -int store_swap_size = 0; /* kilobytes !! */ static int store_swap_high = 0; static int store_swap_low = 0; static int storelog_fd = -1; @@ -332,29 +325,30 @@ static int scan_revolutions; static struct _bucketOrder *MaintBucketsOrder = NULL; static MemObject * -new_MemObject(void) +new_MemObject(const char *log_url) { MemObject *mem = get_free_mem_obj(); mem->reply = xcalloc(1, sizeof(struct _http_reply)); mem->reply->date = -2; mem->reply->expires = -2; mem->reply->last_modified = -2; - mem->request = NULL; + mem->log_url = xstrdup(log_url); meta_data.mem_obj_count++; meta_data.misc += sizeof(struct _http_reply); + meta_data.url_strings += strlen(log_url); debug(20, 3) ("new_MemObject: returning %p\n", mem); return mem; } static StoreEntry * -new_StoreEntry(int mem_obj_flag) +new_StoreEntry(int mem_obj_flag, const char *log_url) { StoreEntry *e = NULL; e = xcalloc(1, sizeof(StoreEntry)); meta_data.store_entries++; if (mem_obj_flag) - e->mem_obj = new_MemObject(); + e->mem_obj = new_MemObject(log_url); debug(20, 3) ("new_StoreEntry: returning %p\n", e); return e; } @@ -364,9 +358,11 @@ destroy_MemObject(MemObject * mem) { debug(20, 3) ("destroy_MemObject: destroying %p\n", mem); destroy_MemObjectData(mem); + meta_data.url_strings -= strlen(mem->log_url); safe_free(mem->clients); safe_free(mem->reply); safe_free(mem->e_abort_msg); + safe_free(mem->log_url); requestUnlink(mem->request); mem->request = NULL; put_free_mem_obj(mem); @@ -492,6 +488,11 @@ storeLog(int tag, const StoreEntry * e) return; if (mem == NULL) return; + if (mem->log_url == NULL) { + debug(20, 1) ("storeLog: NULL log_url for %s\n", e->url); + storeMemObjectDump(mem); + mem->log_url = xstrdup(e->url); + } reply = mem->reply; sprintf(logmsg, "%9d.%03d %-7s %08X %4d %9d %9d %9d %s %d/%d %s %s\n", (int) current_time.tv_sec, @@ -506,7 +507,7 @@ storeLog(int tag, const StoreEntry * e) reply->content_length, mem->e_current_len - mem->reply->hdr_sz, RequestMethodStr[e->method], - e->key); + mem->log_url); file_write(storelog_fd, xstrdup(logmsg), strlen(logmsg), @@ -595,7 +596,7 @@ storeGet(const char *url) return (StoreEntry *) hash_lookup(store_table, url); } -unsigned int +static unsigned int getKeyCounter(void) { static unsigned int key_counter = 0; @@ -715,13 +716,13 @@ storeSetPublicKey(StoreEntry * e) } StoreEntry * -storeCreateEntry(const char *url, int flags, method_t method) +storeCreateEntry(const char *url, const char *log_url, int flags, method_t method) { StoreEntry *e = NULL; MemObject *mem = NULL; debug(20, 3) ("storeCreateEntry: '%s' icp flags=%x\n", url, flags); - e = new_StoreEntry(WITH_MEMOBJ); + e = new_StoreEntry(WITH_MEMOBJ, log_url); e->lock_count = 1; /* Note lock here w/o calling storeLock() */ mem = e->mem_obj; e->url = xstrdup(url); @@ -770,7 +771,7 @@ storeAddDiskRestore(const char *url, int file_number, int size, time_t expires, /* if you call this you'd better be sure file_number is not * already in use! */ meta_data.url_strings += strlen(url); - e = new_StoreEntry(WITHOUT_MEMOBJ); + e = new_StoreEntry(WITHOUT_MEMOBJ, NULL); e->url = xstrdup(url); e->method = METHOD_GET; storeSetPublicKey(e); @@ -1035,7 +1036,7 @@ storeSwapInStart(StoreEntry * e, SIH * callback, void *callback_data) assert(e->swap_status == SWAP_OK); assert(e->swap_file_number >= 0); assert(e->mem_obj == NULL); - e->mem_obj = new_MemObject(); + e->mem_obj = new_MemObject(urlClean(e->url)); ctrlp = xmalloc(sizeof(swapin_ctrl_t)); ctrlp->e = e; ctrlp->callback = callback; @@ -2529,7 +2530,9 @@ storeRotateLog(void) int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); +#ifdef S_ISREG struct stat sb; +#endif if (storelog_fd > -1) { file_close(storelog_fd); @@ -2754,3 +2757,50 @@ storeUnregisterAbort(StoreEntry * e) assert(mem); mem->abort.callback = NULL; } + +void +storeMemObjectDump(MemObject * mem) +{ + debug(20, 1) ("MemObject->data: %p\n", + mem->data); + debug(20, 1) ("MemObject->e_swap_buf: %p %s\n", + mem->e_swap_buf, + checkNullString(mem->e_swap_buf)); + debug(20, 1) ("MemObject->w_rtt: %d\n", + mem->w_rtt); + debug(20, 1) ("MemObject->e_pings_closest_parent: %p\n", + mem->e_pings_closest_parent); + debug(20, 1) ("MemObject->p_rtt: %d\n", + mem->p_rtt); + debug(20, 1) ("MemObject->start_ping: %d.%06d\n", + mem->start_ping.tv_sec, + mem->start_ping.tv_usec); + debug(20, 1) ("MemObject->e_swap_buf_len: %d\n", + mem->e_swap_buf_len); + debug(20, 1) ("MemObject->pending_list_size: %d\n", + mem->pending_list_size); + debug(20, 1) ("MemObject->e_abort_msg: %p %s\n", + mem->e_abort_msg, + checkNullString(mem->e_abort_msg)); + debug(20, 1) ("MemObject->abort_code: %d %s\n", + mem->abort_code, log_tags[mem->abort_code]); + debug(20, 1) ("MemObject->e_current_len: %d\n", + mem->e_current_len); + debug(20, 1) ("MemObject->e_lowest_offset: %d\n", + mem->e_lowest_offset); + debug(20, 1) ("MemObject->clients: %p\n", + mem->clients); + debug(20, 1) ("MemObject->nclients: %d\n", + mem->nclients); + debug(20, 1) ("MemObject->swapin_fd: %d\n", + mem->swapin_fd); + debug(20, 1) ("MemObject->swapout_fd: %d\n", + mem->swapout_fd); + debug(20, 1) ("MemObject->reply: %p\n", + mem->reply); + debug(20, 1) ("MemObject->request: %p\n", + mem->request); + debug(20, 1) ("MemObject->log_url: %p %s\n", + mem->log_url, + checkNullString(mem->log_url)); +} diff --git a/src/structs.h b/src/structs.h index 1d8561f372..7470c0c273 100644 --- a/src/structs.h +++ b/src/structs.h @@ -207,6 +207,7 @@ struct _SquidConfig { int anonymizer; int client_db; int query_icmp; + int icp_hit_stale; } Options; struct _acl *aclList; struct { @@ -230,6 +231,7 @@ struct _SquidConfig { int n_allocated; int n_configured; } cacheSwap; + char *fake_ua; }; struct _SquidConfig2 { @@ -435,6 +437,7 @@ struct _clientHttpRequest { ConnStateData *conn; request_t *request; /* Parsed URL ... */ char *url; + char *log_url; struct { char *buf; int offset; @@ -550,6 +553,7 @@ struct _peer { int rr_count; struct _peer *next; int ip_lookup_pending; + int ck_conn_event_pend; int test_fd; }; @@ -741,6 +745,7 @@ struct _MemObject { STABH *callback; void *data; } abort; + char *log_url; }; /* A cut down structure for store manager */ diff --git a/src/tools.cc b/src/tools.cc index 0a4ccbf2f1..f0a8bc5f9e 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.116 1997/07/15 23:23:37 wessels Exp $ + * $Id: tools.cc,v 1.117 1997/07/16 20:32:21 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -137,12 +137,12 @@ releaseServerSockets(void) /* Release the main ports as early as possible */ for (i = 0; i < NHttpSockets; i++) { if (HttpSockets[i] >= 0) - (void) close(HttpSockets[i]); + close(HttpSockets[i]); } if (theInIcpConnection >= 0) - (void) close(theInIcpConnection); + close(theInIcpConnection); if (theOutIcpConnection >= 0 && theOutIcpConnection != theInIcpConnection) - (void) close(theOutIcpConnection); + close(theOutIcpConnection); } static char * @@ -175,7 +175,14 @@ mail_warranty(void) static void dumpMallocStats() { -#if HAVE_MALLINFO +#if HAVE_MSTATS && HAVE_GNUMALLOC_H + struct mstats ms = mstats(); + fprintf(debug_log, "\ttotal space in arena: %6d KB\n", + ms.bytes_total >> 10); + fprintf(debug_log, "\tTotal free: %6d KB %d%%\n", + ms.bytes_free >> 10, + percent(ms.bytes_free, ms.bytes_total)); +#elif HAVE_MALLINFO struct mallinfo mp; int t; if (!do_mallinfo) @@ -675,7 +682,7 @@ setMaxFD(void) #if HAVE_SETRLIMIT && defined(RLIMIT_DATA) if (getrlimit(RLIMIT_DATA, &rl) < 0) { debug(50, 0) ("getrlimit: RLIMIT_DATA: %s\n", xstrerror()); - } else { + } else if (rl.rlim_max > rl.rlim_cur) { rl.rlim_cur = rl.rlim_max; /* set it to the max */ if (setrlimit(RLIMIT_DATA, &rl) < 0) { sprintf(tmp_error_buf, "setrlimit: RLIMIT_DATA: %s", xstrerror()); @@ -686,7 +693,7 @@ setMaxFD(void) #if HAVE_SETRLIMIT && defined(RLIMIT_VMEM) if (getrlimit(RLIMIT_VMEM, &rl) < 0) { debug(50, 0) ("getrlimit: RLIMIT_VMEM: %s\n", xstrerror()); - } else { + } else if (rl.rlim_max > rl.rlim_cur) { rl.rlim_cur = rl.rlim_max; /* set it to the max */ if (setrlimit(RLIMIT_VMEM, &rl) < 0) { sprintf(tmp_error_buf, "setrlimit: RLIMIT_VMEM: %s", xstrerror()); @@ -724,7 +731,7 @@ squid_signal(int sig, void (*func) _PARAMS((int)), int flags) if (sigaction(sig, &sa, NULL) < 0) debug(50, 0) ("sigaction: sig=%d func=%p: %s\n", sig, func, xstrerror()); #else - (void) signal(sig, func); + signal(sig, func); #endif } @@ -735,6 +742,7 @@ inaddrFromHostent(const struct hostent *hp) xmemcpy(&s.s_addr, hp->h_addr, sizeof(s.s_addr)); return s; } + double doubleAverage(double cur, double new, int n, int max) { @@ -759,3 +767,9 @@ logsFlush(void) if (cache_useragent_log) fflush(cache_useragent_log); } + +char * +checkNullString(char *p) +{ + return p ? p : "(NULL)"; +} diff --git a/src/tunnel.cc b/src/tunnel.cc index 911eef8ab7..10bf072700 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.57 1997/07/16 04:48:31 wessels Exp $ + * $Id: tunnel.cc,v 1.58 1997/07/16 20:32:17 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -42,8 +42,7 @@ typedef struct { int offset; char *buf; } client, server; - time_t timeout; - int *size_ptr; /* pointer to size in an ConnStateData for logging */ + size_t *size_ptr; /* pointer to size in an ConnStateData for logging */ int proxying; } SslStateData; @@ -102,12 +101,6 @@ sslStateFree(int fd, void *data) return; if (fd != sslState->server.fd) fatal_dump("sslStateFree: FD mismatch!\n"); - if (sslState->client.fd > -1) { - commSetSelect(sslState->client.fd, - COMM_SELECT_READ, - NULL, - NULL, 0); - } safe_free(sslState->server.buf); safe_free(sslState->client.buf); xfree(sslState->url); @@ -135,6 +128,10 @@ sslReadServer(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { sslClose(sslState); } @@ -219,6 +216,10 @@ sslWriteServer(int fd, void *data) COMM_SELECT_READ, sslReadClient, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { /* still have more to write */ commSetSelect(sslState->server.fd, @@ -264,6 +265,10 @@ sslWriteClient(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } else { /* still have more to write */ commSetSelect(sslState->client.fd, @@ -390,7 +395,6 @@ sslStart(int fd, const char *url, request_t * request, int *size_ptr) cbdataAdd(sslState); sslState->url = xstrdup(url); sslState->request = requestLink(request); - sslState->timeout = Config.Timeout.read; sslState->size_ptr = size_ptr; sslState->client.fd = fd; sslState->server.fd = sock; @@ -431,6 +435,10 @@ sslProxyConnected(int fd, void *data) COMM_SELECT_READ, sslReadServer, sslState, 0); + commSetTimeout(sslState->server.fd, + Config.Timeout.read, + NULL, + NULL); } static void diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 9cf268c8a4..8ad4802519 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -1,5 +1,5 @@ /* - * $Id: unlinkd.cc,v 1.8 1997/07/15 05:34:14 wessels Exp $ + * $Id: unlinkd.cc,v 1.9 1997/07/16 20:32:21 wessels Exp $ * * DEBUG: section 43 Unlink Daemon * AUTHOR: Duane Wessels @@ -35,6 +35,10 @@ static char hello_string[] = "hi there\n"; /* This is the external unlinkd process */ #include "config.h" + +#if HAVE_LIBC_H +#include +#endif #if HAVE_UNISTD_H #include #endif diff --git a/src/url.cc b/src/url.cc index beb7f972c8..1f12b09e1c 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.59 1997/06/21 02:38:19 wessels Exp $ + * $Id: url.cc,v 1.60 1997/07/16 20:32:22 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -298,6 +298,45 @@ urlCanonical(const request_t * request, char *buf) return buf; } +char * +urlCanonicalClean(const request_t * request) +{ + LOCAL_ARRAY(char, buf, MAX_URL); + LOCAL_ARRAY(char, portbuf, 32); + char *t; + switch (request->method) { + case METHOD_CONNECT: + sprintf(buf, "%s:%d", request->host, request->port); + break; + default: + portbuf[0] = '\0'; + if (request->port != urlDefaultPort(request->protocol)) + sprintf(portbuf, ":%d", request->port); + sprintf(buf, "%s://%s%s%s", + ProtocolStr[request->protocol], + request->host, + portbuf, + request->urlpath); + if ((t = strchr(buf, '?'))) + *t = '\0'; + break; + } + return buf; +} + +char * +urlClean(char *dirty) +{ + char *clean; + request_t *r = urlParse(METHOD_GET, dirty); + if (r == NULL) + return dirty; + clean = urlCanonicalClean(r); + put_free_request_t(r); + return clean; +} + + request_t * requestLink(request_t * request) { @@ -342,6 +381,8 @@ urlCheckRequest(const request_t * r) return 1; if (r->method == METHOD_TRACE) return 1; + if (r->method == METHOD_PURGE) + return 1; switch (r->protocol) { case PROTO_HTTP: case PROTO_CACHEOBJ: