]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
adding
authorwessels <>
Tue, 26 Mar 1996 12:20:27 +0000 (12:20 +0000)
committerwessels <>
Tue, 26 Mar 1996 12:20:27 +0000 (12:20 +0000)
ChangeLog [new file with mode: 0644]
src/errorpage.cc [new file with mode: 0644]

diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..2b67e63
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,4 @@
+
+       - ftpget daemon mode
+       - use cached_error() instead of CACHED_RETRIEVE_ERROR_MSG
+       - fix some fd discprencies in the cachemgr/info page
diff --git a/src/errorpage.cc b/src/errorpage.cc
new file mode 100644 (file)
index 0000000..e81bbd3
--- /dev/null
@@ -0,0 +1,170 @@
+/* $Id: errorpage.cc,v 1.1 1996/03/26 05:20:47 wessels Exp $ */
+
+#include "config.h"
+#include <strings.h>
+
+
+#include "ansihelp.h"
+#include "comm.h"
+#include "store.h"
+#include "stat.h"
+#include "cached_error.h"
+
+
+#define CACHED_ERROR_MSG_P1 "\
+<TITLE>ERROR: The requested URL could not be retrieved</TITLE>\n\
+<H2>The requested URL could not be retrieved</H2>\n\
+<HR>\n\
+<P>\n\
+While trying to retrieve the URL:\n\
+<A HREF=\"%s\">%s</A>\n\
+<P>\n\
+The following error was encountered:\n\
+<UL>\n\
+<LI><STRONG>%s</STRONG>\n\
+</UL>\n\
+"
+
+#define CACHED_ERROR_MSG_P2 "\
+<P>The system returned:\n\
+<PRE><I>    %s</I></PRE>\n\
+"
+
+#define CACHED_ERROR_MSG_P3 "\
+<P>This means that:\n\
+<PRE>\n\
+    %s\n\
+</PRE>\n\
+<P> <HR>\n\
+<ADDRESS>\n\
+Generated by cached/%s@%s\n\
+</ADDRESS>\n\
+\n"
+
+typedef struct {
+    char *tag;
+    char *shrt;
+    char *lng;
+} error_data;
+
+error_data ErrorData[] =
+{
+    {"ERR_NONE",
+       "Non Error",
+       "You should never see this."},
+    {"ERR_READ_TIMEOUT",
+       "Read Timeout",
+       "The remote site or network may be down.  Please try again."},
+    {"ERR_LIFETIME_EXP",
+       "Transaction Timeout",
+       "The network or remote site may be down or too slow.  Try again later."},
+    {"ERR_NO_CLIENTS_BIG_OBJ",
+       "No Client",
+       "All Clients went away before tranmission completed and the object is too big to cache."},
+    {"ERR_READ_ERROR",
+       "Read Error",
+       "The remote site or network may be down.  Please try again."},
+    {"ERR_CLIENT_ABORT",
+       "Client Aborted",
+       "Client(s) dropped connection before transmission completed.\nObject fetching is aborted.",},
+    {"ERR_CONNECT_FAIL",
+       "Connection Failed",
+       "The remote site or server may be down.  Please try again soon."},
+    {"ERR_INVALID_URL",
+       "Invalid URL syntax",
+       "Please double check it, or ask for assistance."},
+    {"ERR_NO_FDS",
+       "Out of file descriptors",
+       "The cache is currently very busy.  Please try again."},
+    {"ERR_DNS_FAIL",
+       "DNS name lookup failure",
+       "The named host probably does not exist."},
+    {"ERR_NOT_IMPLEMENTED",
+       "",
+       ""},
+    {"ERR_CANNOT_FETCH",
+       "",
+       ""},
+    {"ERR_NO_RELAY",
+       "",
+       ""},
+    {"ERR_DISK_IO",
+       "Cache Disk I/O Failure",
+       "The system disk is out of space or failing."},
+    {"ERR_MAX"
+       "",
+       ""}
+};
+
+static char tmp_error_buf[BUFSIZ];
+static char tbuf[BUFSIZ];
+
+int log_errors = 1;
+
+
+void cached_error_entry(entry, type, msg)
+     StoreEntry *entry;
+     error_t type;
+     char *msg;
+{
+    if (type == ERR_NONE || type > ERR_MAX)
+       return;
+    sprintf(tmp_error_buf, CACHED_ERROR_MSG_P1,
+       entry->url,
+       entry->url,
+       ErrorData[type].shrt);
+
+    if (msg) {
+       sprintf(tbuf, CACHED_ERROR_MSG_P2, msg);
+       strcat(tmp_error_buf, tbuf);
+    }
+    sprintf(tbuf, CACHED_ERROR_MSG_P3,
+       ErrorData[type].lng,
+       SQUID_VERSION,
+       comm_hostname());
+    strcat(tmp_error_buf, tbuf);
+    storeAbort(entry, tmp_error_buf);
+    if (!log_errors)
+       return;
+    CacheInfo->log_append(CacheInfo,
+       entry->url,
+       "0.0.0.0",
+       entry->mem_obj->e_current_len,
+       ErrorData[type].tag,
+       "GET");
+}
+
+
+
+char *cached_error_url(url, type, msg)
+     char *url;
+     error_t type;
+     char *msg;
+{
+    tmp_error_buf[0] = '\0';
+
+    if (type == ERR_NONE || type > ERR_MAX)
+       return tmp_error_buf;
+    sprintf(tmp_error_buf, CACHED_ERROR_MSG_P1,
+       url,
+       url,
+       ErrorData[type].shrt);
+
+    if (msg) {
+       sprintf(tbuf, CACHED_ERROR_MSG_P2, msg);
+       strcat(tmp_error_buf, tbuf);
+    }
+    sprintf(tbuf, CACHED_ERROR_MSG_P3,
+       ErrorData[type].lng,
+       SQUID_VERSION,
+       comm_hostname());
+    if (!log_errors)
+       return tmp_error_buf;
+    CacheInfo->log_append(CacheInfo,
+       url,
+       "0.0.0.0",
+       0,
+       ErrorData[type].tag,
+       "GET");
+    return tmp_error_buf;
+}