From a8f7d3ee8f37334ed638d2ee22a55bdb49f44291 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 31 Aug 1996 05:23:27 +0000 Subject: [PATCH] merge 1.0.11 changes --- ChangeLog | 16 ++++++++++ configure | 23 ++++++++------ configure.in | 9 ++++-- lib/tempnam.c | 8 +++-- src/cachemgr.cc | 80 ++++++++++++++++++++++++------------------------ src/errorpage.cc | 23 ++++++++++---- src/fqdncache.cc | 7 ++--- src/gopher.cc | 26 +++++++++++----- src/store.cc | 10 +++--- src/tools.cc | 10 +++--- src/url.cc | 23 +++++++++++++- 11 files changed, 153 insertions(+), 82 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a7edc83e5..0bb9fdf467 100644 --- a/ChangeLog +++ b/ChangeLog @@ -164,6 +164,22 @@ Changes to squid-1.1.alpha2: ============================================================================== +Changes to squid-1.0.11 (August 30, 1996): + + - Fixed ENTRY_DISPATCHED bug. Now set ENTRY_DISPATCHED + only in getFromCache(). + - Added missing newlines to a number of debug messages. + - NULL-terminate long URL's in urlParse(). + - Changed configure to remove libmalloc for FreeBSD + - Changed ftpget to assume a single space between date and + filename in Unix sytle listings. + - Added urlCheck() to check for supported method/protocol + combinations and return "501 Not Implemented" when + appropriate. + - Added ftpget check for negative port numbers in PASV + reply. + - Added shadow password support for cachemgr shutdown. + Changes to squid-1.0.10 (August 26, 1996): - Fixed INADDR_NONE not being set for ftpget.c. diff --git a/configure b/configure index b442acd924..ac441a437e 100755 --- a/configure +++ b/configure @@ -517,7 +517,7 @@ fi -# From configure.in Revision: 1.28 +# From configure.in Revision: 1.29 ac_aux_dir= for ac_dir in aux $srcdir/aux; do if test -f $ac_dir/install-sh; then @@ -2130,6 +2130,11 @@ case "$host" in CFLAGS="`echo $CFLAGS | sed -e s/-O//`" fi ;; + i386-*-freebsd*) + echo "Removing -lmalloc for FreeBSD..." + LIBS=`echo $LIBS | sed -e s/-lmalloc//` + HAVE_LIBMALLOC="no" + ;; *-sgi-irix*) echo "Removing -lsocket for IRIX..." LIBS=`echo $LIBS | sed -e s/-lsocket//` @@ -2185,7 +2190,7 @@ 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 < conftest.$ac_ext < @@ -2305,7 +2310,7 @@ if test "$cross_compiling" = yes; then SQUID_UDP_SO_SNDBUF=8192 else cat > conftest.$ac_ext < @@ -2341,7 +2346,7 @@ if test "$cross_compiling" = yes; then SQUID_UDP_SO_RCVBUF=8192 else cat > conftest.$ac_ext < @@ -2377,7 +2382,7 @@ if test "$cross_compiling" = yes; then SQUID_TCP_SO_SNDBUF=8192 else cat > conftest.$ac_ext < @@ -2413,7 +2418,7 @@ if test "$cross_compiling" = yes; then SQUID_TCP_SO_RCVBUF=8192 else cat > conftest.$ac_ext < @@ -2446,7 +2451,7 @@ EOF echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6 cat > conftest.$ac_ext < int main() { return 0; } @@ -2470,7 +2475,7 @@ rm -f conftest* echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6 cat > conftest.$ac_ext < #endif -#endif /* __NeXT__ */ - #if HAVE_ERRNO_H #include #endif @@ -58,6 +58,10 @@ #include #endif +#ifndef FILENAME_MAX +#define FILENAME_MAX 1024 +#endif + #define P_tmpdir "/tmp" /* These are the characters used in temporary filenames. */ diff --git a/src/cachemgr.cc b/src/cachemgr.cc index c2e908dbc4..368255dea1 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.cc,v 1.16 1996/08/26 19:57:02 wessels Exp $ + * $Id: cachemgr.cc,v 1.17 1996/08/30 23:23:27 wessels Exp $ * * DEBUG: Section 0 CGI Cache Manager * AUTHOR: Harvest Derived @@ -283,30 +283,28 @@ void print_trailer() printf("
\n"); printf("Generated %s, by %s/%s@%s\n", tbuf, progname, SQUID_VERSION, getfullhostname()); - printf("
\n"); + printf("\n"); } void noargs_html() { printf("\r\n\r\n"); - printf("Cache Manager Interface\n"); - printf("

Cache Manager Interface

\n"); - printf("

\n"); - printf("This is a WWW interface to the instrumentation interface "); - printf("for the Squid object cache.\n"); + printf("Cache Manager Interface\n"); + printf("

Cache Manager Interface

\n"); + printf("

This is a WWW interface to the instrumentation interface\n"); + printf("for the Squid object cache.

\n"); printf("
\n"); - printf("

\n"); - printf("

\n", script_name); printf("
\n");
-    printf("
Cache Host:\n", CACHEMGR_HOSTNAME); - printf("
Cache Port:\n", CACHE_HTTP_PORT); - printf("
Password :\n"); - printf("
URL :\n"); - printf("
Operation :"); + printf("\n", script_name); + printf("Cache Host:\n\n", CACHEMGR_HOSTNAME); + printf("Cache Port:\n\n", CACHE_HTTP_PORT); + printf("Password :\n\n"); + printf("URL :\n\n"); + printf("Operation :"); printf("\n"); - printf("
\n"); + printf("\n\n"); printf("
\n"); - printf("
\n"); - printf("
\n"); + printf(" \n"); + printf("\n"); print_trailer(); } @@ -568,7 +565,7 @@ int main(int argc, char *argv[]) else if (!strncmp(entries[x].name, "port", 4)) portnum = atoi(entries[x].val); else { - printf("

Unknown CGI parameter: %s

\n", + printf("

Unknown CGI parameter: %s

\n", entries[x].name); noargs_html(); exit(0); @@ -580,7 +577,7 @@ int main(int argc, char *argv[]) } if (hostname[0] == '\0') { printf("

ERROR

\n"); - printf("

You must provide a hostname!\n


"); + printf("

You must provide a hostname!\n


"); noargs_html(); exit(0); } @@ -688,8 +685,9 @@ int main(int argc, char *argv[]) time_val = time(NULL); time_string = ctime(&time_val); - printf("Cache Manager: %s:%s:%d\n", operation, hostname, portnum); - printf("
\n", script_name); + printf("Cache Manager: %s:%s:%d\n", + operation, hostname, portnum); + printf("\n", script_name); printf("\n"); printf("\n", portnum); printf("\n"); printf("
"); - printf("

Empty form

\n", script_name); + printf("

Empty form

\n", script_name); printf("
\n"); - printf("

%s: %s:%d - dated %s

", operation, - hostname, portnum, time_string); + printf("

%s: %s:%d

\n", operation, + hostname, portnum); + printf("

dated %s

\n", time_string); printf("
\n");
 
     /* Connect to the server */
@@ -729,7 +728,7 @@ int main(int argc, char *argv[])
     }
     if ((conn = client_comm_connect(conn, hostname, portnum)) < 0) {
 	printf("Error: connecting to cache mgr: %s:%d\n", hostname, portnum);
-	printf("%s
\n", xstrerror()); + printf("%s\n", xstrerror()); exit(1); } bytesWritten = write(conn, msg, strlen(msg)); @@ -761,20 +760,21 @@ int main(int argc, char *argv[]) break; case PARAM: if (hasTables) { - printf("\n"); + printf("
ParameterValueDescription
ParameterValueDescription\n"); in_table = 1; } else { - printf("\n %20s %10s %s
\n", "Parameter", "Value", "Description"); + printf("\n Parameter Value Description\n"); + printf("-------------- ------- -------------------------------------\n"); } break; case STATS_U: if (hasTables) { - printf("\n"); + printf("
ProtocolCountMax KBCurrent KBMin KBHit RatioTransfer RateReferencesTransfered KB
ProtocolCountMax KBCurrent KBMin KBHit RatioTransfer RateReferencesTransfered KB\n"); in_table = 1; } else { - printf("Protocol | Count | Maximum | Current | Minimum | Hit | Transfer | Reference | Transfered |\n"); - printf(" | | KB | KB | KB | Ratio | Rate | Count | KB |\n"); - printf("---------|-------|----------|----------|---------|-------|----------|-----------|------------|\n"); + printf("Protocol Count Maximum Current Minimum Hit Trans Transfer Transfered\n"); + printf(" KB KB KB Rate KB/sec Count KB\n"); + printf("-------- ------- --------- --------- --------- ---- ------ --------- ----------\n"); } break; default: @@ -838,19 +838,19 @@ int main(int argc, char *argv[]) d1 = 0; sscanf(reserve, "%s %d \"%[^\"]", s1, &d1, s2); if (hasTables) - printf("
%s%d%s\n", s1, d1, s2 + 2); + printf("
%s%d%s\n", s1, d1, s2 + 2); else - printf(" %20s %10d %s\n", s1, d1, s2 + 2); + printf("%14s %7d %s\n", s1, d1, s2 + 2); break; case STATS_U: p_state = 1; sscanf(reserve, "%s %d %d %d %d %f %d %d %d", s1, &d1, &d2, &d3, &d4, &f1, &d5, &d6, &d7); if (hasTables) - printf("
%s%d%d%d%d%4.2f%d%d%d", + printf("
%s%d%d%d%d%4.2f%d%d%d", s1, d1, d2, d3, d4, f1, d5, d6, d7); else - printf("%8s %7d %10d %10d %9d %4.2f %10d %10d %10d
\n", + printf("%8s %7d %9d %9d %9d %4.2f %6d %9d %10d\n", s1, d1, d2, d3, d4, f1, d5, d6, d7); break; case STATS_O: diff --git a/src/errorpage.cc b/src/errorpage.cc index d23489f083..8b719c4737 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.34 1996/08/29 16:54:22 wessels Exp $ + * $Id: errorpage.cc,v 1.35 1996/08/30 23:23:28 wessels Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -32,7 +32,10 @@ #include "squid.h" #define SQUID_ERROR_MSG_P1 "\ +\n\ ERROR: The requested URL could not be retrieved\n\ +\n\ +

ERROR

\n\

The requested URL could not be retrieved

\n\
\n\

\n\ @@ -60,7 +63,7 @@ The following error was encountered:\n\


\n\
\n\ Generated by %s/%s@%s\n\ -
\n\ +\n\ \n" typedef struct { @@ -92,6 +95,9 @@ error_data ErrorData[] = {"ERR_INVALID_REQUEST", "Invalid HTTP request", "Please double check it, or ask for assistance."}, + {"ERR_UNSUP_REQUEST", + "Unsupported request", + "This request method is not supported for this protocol."}, {"ERR_INVALID_URL", "Invalid URL syntax", "Please double check it, or ask for assistance."}, @@ -115,7 +121,10 @@ error_data ErrorData[] = "The system disk is out of space or failing."}, {"ERR_ZERO_SIZE_OBJECT", "No Object Data", - "The remote server closed the connection before sending any data."} + "The remote server closed the connection before sending any data."}, + {"ERR_PROXY_DENIED", + "Access Denied", + "You must authenticate yourself before accessing this cache."} }; /* GLOBAL */ @@ -210,7 +219,8 @@ char *squid_error_url(url, method, type, address, code, msg) #define SQUID_REQUEST_ERROR_MSG "\ -ERROR: Invalid HTTP Request\n\ +ERROR: Invalid HTTP Request\n\ +

ERROR

\n\

Invalid HTTP Request

\n\
\n\
\n\
@@ -221,7 +231,7 @@ char *squid_error_url(url, method, type, address, code, msg)
 
\n\
\n\ Generated by %s/%s@%s\n\ -
\n\ +\n\ \n" char *squid_error_request(request, type, address, code) @@ -257,7 +267,8 @@ char *access_denied_msg(code, method, url, client) HTTP/1.0 %d Cache Access Denied\r\n\ Content-type: text/html\r\n\ \r\n\ -Cache Access Denied\n\ +Cache Access Denied\n\ +

Error

\n\

Access Denied

\n\

\n\ Sorry, you are not currently allowed to request\n\ diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 716f16a7a2..16dc8462a2 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.cc,v 1.12 1996/08/30 22:38:15 wessels Exp $ + * $Id: fqdncache.cc,v 1.13 1996/08/30 23:23:29 wessels Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -1042,9 +1042,8 @@ int fqdncacheQueueDrain() fqdncache_entry *i; dnsserver_t *dnsData; if (!fqdncacheQueueHead) - return 0; + return 0; while ((dnsData = dnsGetFirstAvailable()) && (i = fqdncacheDequeue())) - fqdncache_dnsDispatch(dnsData, i); + fqdncache_dnsDispatch(dnsData, i); return 1; } - diff --git a/src/gopher.cc b/src/gopher.cc index 1ceb783395..fef1b7acb1 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,5 +1,5 @@ /* - * $Id: gopher.cc,v 1.39 1996/08/26 19:16:05 wessels Exp $ + * $Id: gopher.cc,v 1.40 1996/08/30 23:23:31 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -351,7 +351,8 @@ void gopherEndHTML(data) LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE); if (!data->data_in) { - sprintf(tmpbuf, "


Server Return Nothing.

\n"); + sprintf(tmpbuf, "Server Return Nothing.\n\ +

Server Return Nothing.

\n"); storeAppend(data->entry, tmpbuf, strlen(tmpbuf)); return; } @@ -387,8 +388,11 @@ void gopherToHTML(data, inbuf, len) entry = data->entry; if (data->conversion == HTML_INDEX_PAGE) { - sprintf(outbuf, "Gopher Index %s

%s
Gopher Search

This is a searchable Gopher index.Use the search function of your browser to enter search terms. \n", entry->url, entry->url); - + sprintf(outbuf, "Gopher Index %s\n\ +

%s
Gopher Search

\n\ +

This is a searchable Gopher index. Use the search\n\ + function of your browser to enter search terms.\n\ + \n", entry->url, entry->url); storeAppend(entry, outbuf, strlen(outbuf)); /* now let start sending stuff to client */ BIT_RESET(entry->flag, DELAY_SENDING); @@ -397,7 +401,11 @@ void gopherToHTML(data, inbuf, len) return; } if (data->conversion == HTML_CSO_PAGE) { - sprintf(outbuf, "CSO Search of %s

%s
CSO Search

A CSO database usually contains a phonebook or directory. Use the search function of your browser to enter search terms.\n", + sprintf(outbuf, "CSO Search of %s\n\ +

%s
CSO Search

\n\ +

A CSO database usually contains a phonebook or\n\ + directory. Use the search function of your browser to enter\n\ + search terms.

\n", entry->url, entry->url); storeAppend(entry, outbuf, strlen(outbuf)); @@ -411,9 +419,11 @@ void gopherToHTML(data, inbuf, len) if (!data->HTML_header_added) { if (data->conversion == HTML_CSO_RESULT) - strcat(outbuf, "

CSO Searchs Result

\n
\n");
+	    strcat(outbuf, "CSO Searchs Result\n\
+		

CSO Searchs Result

\n
\n");
 	else
-	    strcat(outbuf, "

Gopher Menu

\n
\n");
+	    strcat(outbuf, "Gopher Menu\n\
+		

Gopher Menu

\n
\n");
 	data->HTML_header_added = 1;
     }
     while ((pos != NULL) && (pos < inbuf + len)) {
@@ -627,7 +637,7 @@ void gopherToHTML(data, inbuf, len)
 		    case 502:	/* Too Many Matches */
 			{
 			    /* Print the message the server returns */
-			    sprintf(tmpbuf, "

%s

\n
", result);
+			    sprintf(tmpbuf, "

%s

\n
", result);
 			    strcat(outbuf, tmpbuf);
 			    data->data_in = 1;
 			    break;
diff --git a/src/store.cc b/src/store.cc
index 76ae3cbeef..77d80e62cf 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -1,5 +1,5 @@
 /*
- * $Id: store.cc,v 1.92 1996/08/30 22:44:13 wessels Exp $
+ * $Id: store.cc,v 1.93 1996/08/30 23:23:35 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -1746,7 +1746,7 @@ int storeAbort(e, msg)
 	if ((int) (strlen(msg) + strlen(mime_hdr) + 50) < 2000) {
 	    sprintf(abort_msg, "HTTP/1.0 400 Cache Detected Error\r\n%s\r\n\r\n%s", mime_hdr, msg);
 	} else {
-	    debug(20, 0, "storeAbort: WARNING: Must increase msg length!");
+	    debug(20, 0, "storeAbort: WARNING: Must increase msg length!\n");
 	}
 	storeAppend(e, abort_msg, strlen(abort_msg));
 	safe_free(mem->e_abort_msg);
@@ -2755,7 +2755,7 @@ int storeWriteCleanLog()
     start = getCurrentTime();
     sprintf(tmp_filename, "%s/log_clean", swappath(0));
     if ((fp = fopen(tmp_filename, "a+")) == NULL) {
-	debug(20, 0, "storeWriteCleanLog: %s: %s", tmp_filename, xstrerror());
+	debug(20, 0, "storeWriteCleanLog: %s: %s\n", tmp_filename, xstrerror());
 	return 0;
     }
     for (e = storeGetFirst(); e; e = storeGetNext()) {
@@ -2775,7 +2775,7 @@ int storeWriteCleanLog()
 	    e->object_len,
 	    e->url);
 	if (x < 0) {
-	    debug(20, 0, "storeWriteCleanLog: %s: %s", tmp_filename, xstrerror());
+	    debug(20, 0, "storeWriteCleanLog: %s: %s\n", tmp_filename, xstrerror());
 	    debug(20, 0, "storeWriteCleanLog: Current swap logfile not replaced.\n");
 	    fclose(fp);
 	    safeunlink(tmp_filename, 0);
@@ -2787,7 +2787,7 @@ int storeWriteCleanLog()
 	}
     }
     if (fclose(fp) < 0) {
-	debug(20, 0, "storeWriteCleanLog: %s: %s", tmp_filename, xstrerror());
+	debug(20, 0, "storeWriteCleanLog: %s: %s\n", tmp_filename, xstrerror());
 	debug(20, 0, "storeWriteCleanLog: Current swap logfile not replaced.\n");
 	safeunlink(tmp_filename, 0);
 	return 0;
diff --git a/src/tools.cc b/src/tools.cc
index accb2edde4..e1165a9d16 100644
--- a/src/tools.cc
+++ b/src/tools.cc
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.50 1996/08/30 22:44:15 wessels Exp $
+ * $Id: tools.cc,v 1.51 1996/08/30 23:23:36 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -485,7 +485,7 @@ void setMaxFD()
     struct rlimit rl;
 #if defined(RLIMIT_NOFILE)
     if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
-	debug(21, 0, "setrlimit: RLIMIT_NOFILE: %s", xstrerror());
+	debug(21, 0, "setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
     } else {
 	rl.rlim_cur = FD_SETSIZE;
 	if (rl.rlim_cur > rl.rlim_max)
@@ -497,7 +497,7 @@ void setMaxFD()
     }
 #elif defined(RLIMIT_OFILE)
     if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
-	debug(21, 0, "setrlimit: RLIMIT_NOFILE: %s", xstrerror());
+	debug(21, 0, "setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
     } else {
 	rl.rlim_cur = FD_SETSIZE;
 	if (rl.rlim_cur > rl.rlim_max)
@@ -509,12 +509,12 @@ void setMaxFD()
     }
 #endif
 #else /* HAVE_SETRLIMIT */
-    debug(21, 1, "setMaxFD: Cannot increase: setrlimit() not supported on this system");
+    debug(21, 1, "setMaxFD: Cannot increase: setrlimit() not supported on this system\n");
 #endif /* HAVE_SETRLIMIT */
 
 #if HAVE_SETRLIMIT && defined(RLIMIT_DATA)
     if (getrlimit(RLIMIT_DATA, &rl) < 0) {
-	debug(21, 0, "getrlimit: RLIMIT_DATA: %s", xstrerror());
+	debug(21, 0, "getrlimit: RLIMIT_DATA: %s\n", xstrerror());
     } else {
 	rl.rlim_cur = rl.rlim_max;	/* set it to the max */
 	if (setrlimit(RLIMIT_DATA, &rl) < 0) {
diff --git a/src/url.cc b/src/url.cc
index bb01d93af6..1e532edd5e 100644
--- a/src/url.cc
+++ b/src/url.cc
@@ -1,6 +1,6 @@
 
 /*
- * $Id: url.cc,v 1.30 1996/08/27 17:55:34 wessels Exp $
+ * $Id: url.cc,v 1.31 1996/08/30 23:23:36 wessels Exp $
  *
  * DEBUG: section 23    URL Parsing
  * AUTHOR: Duane Wessels
@@ -308,3 +308,24 @@ int matchDomainName(domain, host)
 	return 1;
     return 0;
 }
+
+int urlCheckRequest(r)
+     request_t *r;
+{
+    int rc = 0;
+    switch (r->protocol) {
+    case PROTO_HTTP:
+    case PROTO_CACHEOBJ:
+	rc = 1;
+	break;
+    case PROTO_FTP:
+    case PROTO_GOPHER:
+    case PROTO_WAIS:
+	if (r->method == METHOD_GET)
+	    rc = 1;
+	break;
+    default:
+	break;
+    }
+    return rc;
+}
-- 
2.47.3