diff -cr squid-1.0.beta4/ChangeLog squid-1.0.beta5/ChangeLog *** squid-1.0.beta4/ChangeLog Thu Apr 25 16:31:16 1996 --- squid-1.0.beta5/ChangeLog Thu Apr 25 22:38:50 1996 *************** *** 116,118 **** --- 116,122 ---- end of all requests. Symptoms were "connection reset" messages. + Changes to squid-1.0.beta5: + + - Fixed cachemgr to send 'HTTP/1.0' on request so it works + with beta4 fixes to icp.c. diff -cr squid-1.0.beta4/include/version.h squid-1.0.beta5/include/version.h *** squid-1.0.beta4/include/version.h Thu Apr 25 16:31:29 1996 --- squid-1.0.beta5/include/version.h Thu Apr 25 22:40:27 1996 *************** *** 1,7 **** ! /* $Id: version.h,v 1.19.4.3 1996/04/25 23:31:29 wessels Exp $ * * SQUID_VERSION - String for version id of this distribution */ #ifndef SQUID_VERSION ! #define SQUID_VERSION "1.0.beta4" #endif --- 1,7 ---- ! /* $Id: version.h,v 1.19.4.4 1996/04/26 05:40:27 wessels Exp $ * * SQUID_VERSION - String for version id of this distribution */ #ifndef SQUID_VERSION ! #define SQUID_VERSION "1.0.beta5" #endif diff -cr squid-1.0.beta4/src/cachemgr.c squid-1.0.beta5/src/cachemgr.c *** squid-1.0.beta4/src/cachemgr.c Tue Apr 16 09:35:26 1996 --- squid-1.0.beta5/src/cachemgr.c Thu Apr 25 22:39:59 1996 *************** *** 1,27 **** ! /* $Id: cachemgr.c,v 1.7 1996/04/16 16:35:26 wessels Exp $ */ ! #include "squid.h" ! static int client_comm_connect(); #define MAX_ENTRIES 10000 ! #define INFO 0 ! #define CACHED 1 ! #define SERVER 2 ! #define LOG 3 ! #define STATS_G 4 ! #define STATS_O 5 ! #define STATS_U 6 ! #define PARAM 7 ! #define RESPT 8 ! #define SHUTDOWN 9 ! #define REFRESH 10 #ifdef REMOVE_OBJECT ! #define REMOVE 11 #endif ! #define FALSE 0 ! #define TRUE 1 typedef struct { char *name; char *val; --- 1,97 ---- ! /* $Id: cachemgr.c,v 1.7.2.1 1996/04/26 05:39:59 wessels Exp $ */ ! #include "config.h" ! #include "autoconf.h" ! #include <unistd.h> ! #include <stdlib.h> ! #include <stdio.h> ! #include <sys/types.h> ! #include <ctype.h> ! #include <errno.h> ! #include <fcntl.h> ! #include <grp.h> ! #include <malloc.h> ! #include <memory.h> ! #include <netdb.h> ! #include <pwd.h> ! #include <signal.h> ! #include <time.h> ! #include <sys/param.h> ! #include <sys/time.h> ! #include <sys/resource.h> /* needs sys/time.h above it */ ! #include <sys/socket.h> ! #include <netinet/in.h> ! #include <arpa/inet.h> ! #include <sys/stat.h> ! #include <sys/un.h> ! #include <sys/wait.h> + #ifdef HAVE_STRING_H + #include <string.h> + #endif + + #ifdef HAVE_STRINGS_H + #include <strings.h> + #endif + + #if HAVE_BSTRING_H + #include <bstring.h> + #endif + + #ifdef HAVE_CRYPT_H + #include <crypt.h> + #endif + + #if HAVE_SYS_SELECT_H + #include <sys/select.h> + #endif + + #include "util.h" + #define MAX_ENTRIES 10000 ! ! #define FALSE 0 ! #define TRUE !FALSE ! #define LF 10 ! #define CR 13 ! ! typedef enum { ! INFO, ! CACHED, ! SERVER, ! LOG, ! PARAM, ! STATS_G, ! STATS_O, ! STATS_VM, ! STATS_U, ! SHUTDOWN, ! REFRESH, #ifdef REMOVE_OBJECT ! REMOVE, #endif ! MAXOP ! } op_t; + static char *op_cmds[] = { + "info", + "squid.conf", + "server_list", + "log", + "parameter", + "stats/general", + "stats/objects", + "stats/vm_objects", + "stats/utilization", + "shutdown", + "<refresh>", + #ifdef REMOVE_OBJECT + "<remove>", + #endif + "<maxop>" + }; + typedef struct { char *name; char *val; *************** *** 32,39 **** char *script_name = "/cgi-bin/cachemgr.cgi"; char *progname = NULL; ! #define LF 10 ! #define CR 13 void print_trailer() { --- 102,108 ---- char *script_name = "/cgi-bin/cachemgr.cgi"; char *progname = NULL; ! static int client_comm_connect _PARAMS((int, char *, int)); void print_trailer() { *************** *** 76,84 **** printf("<OPTION SELECTED VALUE=\"info\">Cache Information\n"); printf("<OPTION VALUE=\"squid.conf\">Cache Configuration File\n"); printf("<OPTION VALUE=\"parameter\">Cache Parameters\n"); - #ifdef MENU_RESPONSETIME - printf("<OPTION VALUE=\"responsetime\">Cache Response Time Histogram\n"); - #endif #ifdef MENU_SHOW_LOG printf("<OPTION VALUE=\"log\">Cache Log\n"); #endif --- 145,150 ---- *************** *** 350,416 **** } close(0); ! if (!strncmp(operation, "info", 4) || ! !strncmp(operation, "Cache Information", 17)) { op = INFO; ! sprintf(msg, "GET cache_object://%s/info\r\n", hostname); ! } else if (!strncmp(operation, "squid.conf", 10) || ! !strncmp(operation, "Cache Configuration File", 24)) { op = CACHED; ! sprintf(msg, "GET cache_object://%s/squid.conf\r\n", hostname); ! } else if (!strncmp(operation, "server_list", 11) || ! !strncmp(operation, "Cache Server List", 17)) { op = SERVER; - sprintf(msg, "GET cache_object://%s/server_list\r\n", hostname); #ifdef MENU_SHOW_LOG ! } else if (!strncmp(operation, "log", 3) || ! !strncmp(operation, "Cache Log", 9)) { op = LOG; - sprintf(msg, "GET cache_object://%s/log\r\n", hostname); #endif ! } else if (!strncmp(operation, "parameter", 9) || ! !strncmp(operation, "Cache Parameters", 16)) { op = PARAM; ! sprintf(msg, "GET cache_object://%s/parameter\r\n", hostname); ! #ifdef MENU_RESPONSETIME ! } else if (!strncmp(operation, "responsetime", 11) || ! !strncmp(operation, "Cache Response Time Histogram", 28)) { ! op = RESPT; ! sprintf(msg, "GET cache_object://%s/responsetime\r\n", hostname); ! #endif ! } else if (!strncmp(operation, "stats/general", 13) || ! !strncmp(operation, "General Statistics", 18)) { op = STATS_G; ! sprintf(msg, "GET cache_object://%s/stats/general\r\n", hostname); ! } else if (!strncmp(operation, "stats/vm_objects", 16)) { op = STATS_O; ! sprintf(msg, "GET cache_object://%s/stats/vm_objects\r\n", hostname); ! } else if (!strncmp(operation, "stats/objects", 13) || ! !strncmp(operation, "Objects", 7)) { ! op = STATS_O; ! sprintf(msg, "GET cache_object://%s/stats/objects\r\n", hostname); ! } else if (!strncmp(operation, "stats/utilization", 17) || ! !strncmp(operation, "Utilization", 11)) { op = STATS_U; ! sprintf(msg, "GET cache_object://%s/stats/utilization\r\n", hostname); ! } else if (!strncmp(operation, "shutdown", 8)) { op = SHUTDOWN; ! sprintf(msg, "GET cache_object://%s/shutdown@%s\r\n", hostname, password); ! } else if (!strncmp(operation, "refresh", 7)) { op = REFRESH; - sprintf(msg, "GET %s HTTP/1.0\r\nPragma: no-cache\r\nAccept: */*\r\n\r\n", url); #ifdef REMOVE_OBJECT ! } else if (!strncmp(operation, "remove", 6)) { op = REMOVE; - /* Peter: not sure what to do here - depends what you do at your end! */ - sprintf(msg, "REMOVE %s HTTP/1.0\r\nPragma: no-cache\r\nAccept: */*\r\n\r\n", url); #endif - } else { printf("Unknown operation: %s\n", operation); exit(0); } time_val = time(NULL); time_string = ctime(&time_val); --- 416,495 ---- } close(0); ! if (!strcmp(operation, "info") || ! !strcmp(operation, "Cache Information")) { op = INFO; ! } else if (!strcmp(operation, "squid.conf") || ! !strcmp(operation, "Cache Configuration File")) { op = CACHED; ! } else if (!strcmp(operation, "server_list") || ! !strcmp(operation, "Cache Server List")) { op = SERVER; #ifdef MENU_SHOW_LOG ! } else if (!strcmp(operation, "log") || ! !strcmp(operation, "Cache Log")) { op = LOG; #endif ! } else if (!strcmp(operation, "parameter") || ! !strcmp(operation, "Cache Parameters")) { op = PARAM; ! } else if (!strcmp(operation, "stats/general") || ! !strcmp(operation, "General Statistics")) { op = STATS_G; ! } else if (!strcmp(operation, "stats/vm_objects") || ! !strcmp(operation, "VM_Objects")) { ! op = STATS_VM; ! } else if (!strcmp(operation, "stats/objects") || ! !strcmp(operation, "Objects")) { op = STATS_O; ! } else if (!strcmp(operation, "stats/utilization") || ! !strcmp(operation, "Utilization")) { op = STATS_U; ! } else if (!strcmp(operation, "shutdown")) { op = SHUTDOWN; ! } else if (!strcmp(operation, "refresh")) { op = REFRESH; #ifdef REMOVE_OBJECT ! } else if (!strcmp(operation, "remove")) { op = REMOVE; #endif } else { printf("Unknown operation: %s\n", operation); exit(0); } + switch (op) { + case INFO: + case CACHED: + case SERVER: + case LOG: + case PARAM: + case STATS_G: + case STATS_O: + case STATS_VM: + case STATS_U: + sprintf(msg, "GET cache_object://%s/%s HTTP/1.0\r\n\r\n", + hostname, op_cmds[op]); + break; + case SHUTDOWN: + sprintf(msg, "GET cache_object://%s/%s@%s HTTP/1.0\r\n\r\n", + hostname, op_cmds[op], password); + break; + case REFRESH: + sprintf(msg, "GET %s HTTP/1.0\r\nPragma: no-cache\r\nAccept: */*\r\n\r\n", url); + break; + #ifdef REMOVE_OBJECT + case REMOVE: + printf("Remove not yet supported\n"); + exit(0); + /* NOTREACHED */ + #endif + default: + case MAXOP: + printf("Unknown operation: %s\n", operation); + exit(0); + /* NOTREACHED */ + } time_val = time(NULL); time_string = ctime(&time_val); *************** *** 423,431 **** printf("<OPTION VALUE=\"info\">Cache Information\n"); printf("<OPTION VALUE=\"squid.conf\">Cache Configuration File\n"); printf("<OPTION VALUE=\"parameter\">Cache Parameters\n"); - #ifdef MENU_RESPONSETIME - printf("<OPTION VALUE=\"responsetime\">Cache Response Time Histogram\n"); - #endif #ifdef MENU_SHOW_LOG printf("<OPTION VALUE=\"log\">Cache Log\n"); #endif --- 502,507 ---- *************** *** 473,478 **** --- 549,555 ---- case LOG: case STATS_G: case STATS_O: + case STATS_VM: case SHUTDOWN: case REFRESH: break; *************** *** 484,497 **** printf("<B>\n %20s %10s %s</B><HR>\n", "Parameter", "Value", "Description"); } break; - case RESPT: - if (hasTables) { - printf("<table border=1><td><B>Time (msec)</B><td><B>Frequency</B><tr>\n"); - in_table = 1; - } else { - printf("<B>\n %20s %10s </B><HR>\n", "Time (msec)", "Frequency"); - } - break; case STATS_U: if (hasTables) { printf("<table border=1><td><B>Protocol</B><td><B>Count</B><td><B>Max KB</B><td><B>Current KB</B><td><B>Min KB</B><td><B>Hit Ratio</B><td><B>Transfer Rate</B><td><B>References</B><td><B>Transfered KB</B><tr>\n"); --- 561,566 ---- *************** *** 561,576 **** else printf(" %20s %10d %s\n", s1, d1, s2 + 2); break; - case RESPT: - p_state = 1; - memset(s1, '\0', 255); - d1 = 0; - sscanf(reserve, "%s %d", s1, &d1); - if (hasTables) - printf("<tr><td><B>%s</B><td>%d\n", s1, d1); - else - printf(" %20s %10d\n", s1, d1); - break; case STATS_U: p_state = 1; sscanf(reserve, "%s %d %d %d %d %f %d %d %d", --- 630,635 ---- *************** *** 583,588 **** --- 642,648 ---- s1, d1, d2, d3, d4, f1, d5, d6, d7); break; case STATS_O: + case STATS_VM: if (!in_list) { in_list = 1; printf("<OL>\n"); diff -cr squid-1.0.beta4/src/stat.c squid-1.0.beta5/src/stat.c *** squid-1.0.beta4/src/stat.c Tue Apr 23 22:52:53 1996 --- squid-1.0.beta5/src/stat.c Thu Apr 25 22:36:19 1996 *************** *** 1,4 **** ! /* $Id: stat.c,v 1.28.4.9 1996/04/24 05:52:53 wessels Exp $ */ /* * DEBUG: Section 18 stat --- 1,4 ---- ! /* $Id: stat.c,v 1.28.4.10 1996/04/26 05:36:19 wessels Exp $ */ /* * DEBUG: Section 18 stat *************** *** 168,174 **** obj_size = entry->mem_obj->e_current_len; tempbuf[0] = '\0'; sprintf(tempbuf, "{ %s %d %s %s %s %s %d %d %s %s }\n", ! entry->key, obj_size, elapsed_time(entry, (int) entry->timestamp, space), flags_describe(entry), --- 168,174 ---- obj_size = entry->mem_obj->e_current_len; tempbuf[0] = '\0'; sprintf(tempbuf, "{ %s %d %s %s %s %s %d %d %s %s }\n", ! entry->url, obj_size, elapsed_time(entry, (int) entry->timestamp, space), flags_describe(entry),