From 5b52cb6c9ffb5dc1c3584fba4de91d15c1255956 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 16 Sep 2008 02:29:36 +1200 Subject: [PATCH] Error page stylesheets * Adds %l option for adding CSS code to HTML output * Adds error_stylesheet option to squid.conf for a filename to use * Installs default CSS file errorpage.css in config directory * Adds CSS tags and %l to all error templates (in a way that keeps the %l from causing trouble to older Squid) Code portion loads the CSS file on startup, and merges the CSS as inline with HTML wherever the %l option is present in HTML error files. --- errors/Makefile.am | 18 +++++++++++++++--- errors/templates/ERR_ACCESS_DENIED | 4 ++-- errors/templates/ERR_CACHE_ACCESS_DENIED | 6 +++--- errors/templates/ERR_CACHE_MGR_ACCESS_DENIED | 8 ++++---- errors/templates/ERR_CANNOT_FORWARD | 8 ++++---- errors/templates/ERR_CONNECT_FAIL | 12 +++++++----- errors/templates/ERR_DNS_FAIL | 11 ++++++----- errors/templates/ERR_ESI | 10 +++++----- errors/templates/ERR_FORWARDING_DENIED | 9 +++++---- errors/templates/ERR_FTP_DISABLED | 9 +++++---- errors/templates/ERR_FTP_FAILURE | 10 +++++----- errors/templates/ERR_FTP_FORBIDDEN | 10 +++++----- errors/templates/ERR_FTP_NOT_FOUND | 10 +++++----- errors/templates/ERR_FTP_PUT_CREATED | 8 ++++---- errors/templates/ERR_FTP_PUT_ERROR | 10 +++++----- errors/templates/ERR_FTP_PUT_MODIFIED | 8 ++++---- errors/templates/ERR_FTP_UNAVAILABLE | 10 +++++----- errors/templates/ERR_ICAP_FAILURE | 10 +++++----- errors/templates/ERR_INVALID_REQ | 8 ++++---- errors/templates/ERR_INVALID_RESP | 8 ++++---- errors/templates/ERR_INVALID_URL | 8 ++++---- errors/templates/ERR_LIFETIME_EXP | 8 ++++---- errors/templates/ERR_NO_RELAY | 8 ++++---- errors/templates/ERR_ONLY_IF_CACHED_MISS | 8 ++++---- errors/templates/ERR_READ_ERROR | 10 +++++----- errors/templates/ERR_READ_TIMEOUT | 10 +++++----- errors/templates/ERR_SECURE_CONNECT_FAIL | 10 +++++----- errors/templates/ERR_SHUTTING_DOWN | 6 +++--- errors/templates/ERR_SOCKET_FAILURE | 10 +++++----- errors/templates/ERR_TOO_BIG | 8 ++++---- errors/templates/ERR_UNSUP_REQ | 8 ++++---- errors/templates/ERR_URN_RESOLVE | 8 ++++---- errors/templates/ERR_WRITE_ERROR | 10 +++++----- errors/templates/ERR_ZERO_SIZE_OBJECT | 8 ++++---- errors/templates/generic | 8 ++++---- src/Makefile.am | 2 ++ src/cf.data.pre | 10 ++++++++++ src/errorpage.cc | 13 +++++++++++++ src/structs.h | 1 + 39 files changed, 192 insertions(+), 149 deletions(-) diff --git a/errors/Makefile.am b/errors/Makefile.am index 77bdb6bf48..0644cc288d 100644 --- a/errors/Makefile.am +++ b/errors/Makefile.am @@ -9,6 +9,8 @@ errordir = $(datadir)/errors ##dist-hook eveything DEFAULT_ERROR_DIR = $(errordir) +DEFAULT_STYLESHEET = $(sysconfigdir)/errorpage.css + # List of automated translations possible: TRANSLATIONS = \ @@ -69,7 +71,15 @@ install-data-local: $(INSTALL_DATA) $$f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l; \ done; \ fi \ - done + done; \ + $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET).default; \ + @if test -f $(DESTDIR)$(DEFAULT_STYLESHEET) ; then \ + echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_STYLESHEET)" ; \ + else \ + echo "$(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET)"; \ + $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET); \ + fi + uninstall-local: @ for l in $(LANGUAGES); do \ @@ -83,7 +93,8 @@ uninstall-local: rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \ done; \ fi \ - done + done; \ + rm -f $(DEFAULT_STYLESHEET).default # undocumented hack. You can use this target to create multi-lingual # error pages. For example: @@ -129,7 +140,8 @@ dist-hook: cp -p $(srcdir)/$$lang/ERR_* $(distdir)/$$lang \ || exit 1; \ fi; \ - done + done; \ + cp $(srcdir)/errorpage.css $(distdir)/errorpage.css translate: @ if test "$(PO2HTML)" != "" ; then \ diff --git a/errors/templates/ERR_ACCESS_DENIED b/errors/templates/ERR_ACCESS_DENIED index 901f37c557..97c9c94adf 100644 --- a/errors/templates/ERR_ACCESS_DENIED +++ b/errors/templates/ERR_ACCESS_DENIED @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

Access Denied.

diff --git a/errors/templates/ERR_CACHE_ACCESS_DENIED b/errors/templates/ERR_CACHE_ACCESS_DENIED index 54415cf7a5..04f8dd5dec 100644 --- a/errors/templates/ERR_CACHE_ACCESS_DENIED +++ b/errors/templates/ERR_CACHE_ACCESS_DENIED @@ -2,7 +2,7 @@ ERROR: Cache Access Denied - +

ERROR

@@ -10,7 +10,7 @@

The following error was encountered while trying to retrieve the URL: %U

-
+

Cache Access Denied.

@@ -18,7 +18,7 @@

Please contact the cache administrator if you have difficulties authenticating yourself or change your default password.

-
+

diff --git a/errors/templates/ERR_CACHE_MGR_ACCESS_DENIED b/errors/templates/ERR_CACHE_MGR_ACCESS_DENIED index 3458b67fbb..b5d8588c44 100644 --- a/errors/templates/ERR_CACHE_MGR_ACCESS_DENIED +++ b/errors/templates/ERR_CACHE_MGR_ACCESS_DENIED @@ -2,14 +2,14 @@ ERROR: Cache Manager Access Denied - +

ERROR

Cache Manager Access Denied.


The following error was encountered while trying to retrieve the URL: %U

-
+

Cache Manager Access Denied.

@@ -17,7 +17,7 @@

Please contact the cache administrator if you have difficulties authenticating yourself or, if you are the administrator, read Squid documentation on cache manager interface and check cache log for more detailed error messages.

-
-
+
+
diff --git a/errors/templates/ERR_CANNOT_FORWARD b/errors/templates/ERR_CANNOT_FORWARD index 06dfea2d20..2e11aecfd9 100644 --- a/errors/templates/ERR_CANNOT_FORWARD +++ b/errors/templates/ERR_CANNOT_FORWARD @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

ERROR

@@ -10,7 +10,7 @@

The following error was encountered while trying to retrieve the URL: %U

-
+

Unable to forward this request at this time.

@@ -18,7 +18,7 @@

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_CONNECT_FAIL b/errors/templates/ERR_CONNECT_FAIL index f10d19693b..c25f747e94 100644 --- a/errors/templates/ERR_CONNECT_FAIL +++ b/errors/templates/ERR_CONNECT_FAIL @@ -2,22 +2,24 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+ +

Connection to %I failed.

-

The system returned: %E

+

The system returned: %E

The remote host or network may be down. Please try the request again.

+

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_DNS_FAIL b/errors/templates/ERR_DNS_FAIL index fc7e09368c..eff729bba6 100644 --- a/errors/templates/ERR_DNS_FAIL +++ b/errors/templates/ERR_DNS_FAIL @@ -2,26 +2,27 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

Unable to determine IP address from host name %H

The DNS server returned:

-
+
%z

This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.

+

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_ESI b/errors/templates/ERR_ESI index 401bd40c78..53928bcc96 100644 --- a/errors/templates/ERR_ESI +++ b/errors/templates/ERR_ESI @@ -2,19 +2,19 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

ESI Processing failed.

The ESI processor returned:

-
+
%Z
@@ -22,7 +22,7 @@

Your webmaster is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FORWARDING_DENIED b/errors/templates/ERR_FORWARDING_DENIED index 2ed04b320c..e025f62d74 100644 --- a/errors/templates/ERR_FORWARDING_DENIED +++ b/errors/templates/ERR_FORWARDING_DENIED @@ -2,21 +2,22 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

Forwarding Denied.

This cache will not forward your request because it is trying to enforce a sibling relationship. Perhaps the client at %i is a cache which has been misconfigured.

+

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_DISABLED b/errors/templates/ERR_FTP_DISABLED index 8dacb6c9d1..4f3d7005d4 100644 --- a/errors/templates/ERR_FTP_DISABLED +++ b/errors/templates/ERR_FTP_DISABLED @@ -2,21 +2,22 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

FTP is Disabled

This cache does not support FTP.

+

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_FAILURE b/errors/templates/ERR_FTP_FAILURE index 562002caba..277db45391 100644 --- a/errors/templates/ERR_FTP_FAILURE +++ b/errors/templates/ERR_FTP_FAILURE @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved

@@ -10,19 +10,19 @@

An FTP protocol error occurred while trying to retrieve the URL: %U

Squid sent the following FTP command:

-
+
%f

The server responded with:

-
+
%F
%g

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_FORBIDDEN b/errors/templates/ERR_FTP_FORBIDDEN index 33154d4518..9a38c1364e 100644 --- a/errors/templates/ERR_FTP_FORBIDDEN +++ b/errors/templates/ERR_FTP_FORBIDDEN @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved

@@ -10,19 +10,19 @@

An FTP authentication failure occurred while trying to retrieve the URL: %U

Squid sent the following FTP command:

-
+
%f

The server responded with:

-
+
%F
%g

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_NOT_FOUND b/errors/templates/ERR_FTP_NOT_FOUND index 9048dfe95a..fd1542fb6f 100644 --- a/errors/templates/ERR_FTP_NOT_FOUND +++ b/errors/templates/ERR_FTP_NOT_FOUND @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved

@@ -10,12 +10,12 @@

The following URL could not be retrieved: %U

Squid sent the following FTP command:

-
+
%f

The server responded with:

-
+
%F
%g
@@ -24,7 +24,7 @@

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_PUT_CREATED b/errors/templates/ERR_FTP_PUT_CREATED index 0fc4c11232..f53722be2c 100644 --- a/errors/templates/ERR_FTP_PUT_CREATED +++ b/errors/templates/ERR_FTP_PUT_CREATED @@ -2,13 +2,13 @@ FTP PUT Successful: File Created - + -

Operation successful

+

Operation successful

File created


-
-
+
+
diff --git a/errors/templates/ERR_FTP_PUT_ERROR b/errors/templates/ERR_FTP_PUT_ERROR index ae016f2e8e..d0accc56d0 100644 --- a/errors/templates/ERR_FTP_PUT_ERROR +++ b/errors/templates/ERR_FTP_PUT_ERROR @@ -2,7 +2,7 @@ ERROR: FTP upload failed - +

ERROR

FTP PUT/upload failed

@@ -10,12 +10,12 @@

While trying to PUT the following URL: %U

Squid sent the following FTP command:

-
+
%f

The server responded with:

-
+
%F
@@ -23,7 +23,7 @@

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_FTP_PUT_MODIFIED b/errors/templates/ERR_FTP_PUT_MODIFIED index 3a4e410ffd..c4a369d98b 100644 --- a/errors/templates/ERR_FTP_PUT_MODIFIED +++ b/errors/templates/ERR_FTP_PUT_MODIFIED @@ -2,13 +2,13 @@ FTP PUT Successful: File updated - + -

Operation successful

+

Operation successful

File updated


-
-
+
+
diff --git a/errors/templates/ERR_FTP_UNAVAILABLE b/errors/templates/ERR_FTP_UNAVAILABLE index fc1a54c424..b367faff46 100644 --- a/errors/templates/ERR_FTP_UNAVAILABLE +++ b/errors/templates/ERR_FTP_UNAVAILABLE @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved

@@ -11,19 +11,19 @@

Squid sent the following FTP command:

-
+
%f

The server responded with:

-
+
%F
%g

Your cache administrator is %w.

-
-
+
+
diff --git a/errors/templates/ERR_ICAP_FAILURE b/errors/templates/ERR_ICAP_FAILURE index 259f1c7e19..3e95873dc1 100644 --- a/errors/templates/ERR_ICAP_FAILURE +++ b/errors/templates/ERR_ICAP_FAILURE @@ -2,18 +2,18 @@ ERROR: The requested URL could not be retrieved - +

ERROR

The requested URL could not be retrieved


The following error was encountered while trying to retrieve the URL: %U

-
+

ICAP protocol error.

-

The system returned: %E

+

The system returned: %E

This means that some aspect of the ICAP communication failed.

@@ -23,7 +23,7 @@
  • An Illegal response was received from the ICAP server.

  • -
    -
    +
    +
    diff --git a/errors/templates/ERR_INVALID_REQ b/errors/templates/ERR_INVALID_REQ index 70f700d217..07813f7863 100644 --- a/errors/templates/ERR_INVALID_REQ +++ b/errors/templates/ERR_INVALID_REQ @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    Invalid Request error was encountered while trying to process the request:

    -
    +
    %R
    @@ -25,7 +25,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_INVALID_RESP b/errors/templates/ERR_INVALID_RESP index ffa8f66be6..8b754577e1 100644 --- a/errors/templates/ERR_INVALID_RESP +++ b/errors/templates/ERR_INVALID_RESP @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    Invalid Response error was encountered while trying to process the request:

    -
    +
    %R
    @@ -19,7 +19,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_INVALID_URL b/errors/templates/ERR_INVALID_URL index 27a986b02b..eac579c4eb 100644 --- a/errors/templates/ERR_INVALID_URL +++ b/errors/templates/ERR_INVALID_URL @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Invalid URL

    @@ -25,7 +25,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_LIFETIME_EXP b/errors/templates/ERR_LIFETIME_EXP index 7f49de57f9..d2c6b46b8f 100644 --- a/errors/templates/ERR_LIFETIME_EXP +++ b/errors/templates/ERR_LIFETIME_EXP @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Connection Lifetime Expired

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_NO_RELAY b/errors/templates/ERR_NO_RELAY index 399ee7490c..992497a561 100644 --- a/errors/templates/ERR_NO_RELAY +++ b/errors/templates/ERR_NO_RELAY @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    No Wais Relay

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_ONLY_IF_CACHED_MISS b/errors/templates/ERR_ONLY_IF_CACHED_MISS index 7aac50cf73..99200a0961 100644 --- a/errors/templates/ERR_ONLY_IF_CACHED_MISS +++ b/errors/templates/ERR_ONLY_IF_CACHED_MISS @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Valid document was not found in the cache and only-if-cached directive was specified.

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_READ_ERROR b/errors/templates/ERR_READ_ERROR index a5fd0ca905..56633bd436 100644 --- a/errors/templates/ERR_READ_ERROR +++ b/errors/templates/ERR_READ_ERROR @@ -2,24 +2,24 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Read Error

    -

    The system returned: %E

    +

    The system returned: %E

    An error condition occurred while reading data from the network. Please retry your request.

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_READ_TIMEOUT b/errors/templates/ERR_READ_TIMEOUT index 3f36f83e13..6b9642490c 100644 --- a/errors/templates/ERR_READ_TIMEOUT +++ b/errors/templates/ERR_READ_TIMEOUT @@ -2,24 +2,24 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Read Timeout

    -

    The system returned: %E

    +

    The system returned: %E

    A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_SECURE_CONNECT_FAIL b/errors/templates/ERR_SECURE_CONNECT_FAIL index eb33c93019..f6bc778719 100644 --- a/errors/templates/ERR_SECURE_CONNECT_FAIL +++ b/errors/templates/ERR_SECURE_CONNECT_FAIL @@ -2,24 +2,24 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Failed to establish a secure connection to %I

    -

    The system returned: %E

    +

    The system returned: %E

    This proxy and the remote host failed to negotiate a mutually acceptable security settings for handling your request. It is possible that the remote host does not support secure connections, or the proxy is not satisfied with the host security credentials.

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_SHUTTING_DOWN b/errors/templates/ERR_SHUTTING_DOWN index a14cdec2b0..6b0e5c012e 100644 --- a/errors/templates/ERR_SHUTTING_DOWN +++ b/errors/templates/ERR_SHUTTING_DOWN @@ -2,7 +2,7 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved

    @@ -13,7 +13,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_SOCKET_FAILURE b/errors/templates/ERR_SOCKET_FAILURE index e4349df6b5..c4d2adeb09 100644 --- a/errors/templates/ERR_SOCKET_FAILURE +++ b/errors/templates/ERR_SOCKET_FAILURE @@ -2,24 +2,24 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Socket Failure

    -

    The system returned: %E

    +

    The system returned: %E

    Squid is unable to create a TCP socket, presumably due to excessive load. Please retry your request.

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_TOO_BIG b/errors/templates/ERR_TOO_BIG index ed529d1180..bfb95b6257 100644 --- a/errors/templates/ERR_TOO_BIG +++ b/errors/templates/ERR_TOO_BIG @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    The request or reply is too large.

    @@ -19,7 +19,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_UNSUP_REQ b/errors/templates/ERR_UNSUP_REQ index 584a63d69f..b4768a3a9a 100644 --- a/errors/templates/ERR_UNSUP_REQ +++ b/errors/templates/ERR_UNSUP_REQ @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Unsupported Request Method and Protocol

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_URN_RESOLVE b/errors/templates/ERR_URN_RESOLVE index 4af5fe46ff..e71ecd7136 100644 --- a/errors/templates/ERR_URN_RESOLVE +++ b/errors/templates/ERR_URN_RESOLVE @@ -2,14 +2,14 @@ ERROR: The requested URN not be retrieved - +

    ERROR

    A URL for the requested URN could not be retrieved


    The following error was encountered while trying to retrieve the URN: %U

    -
    +

    Cannot Resolve URN

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_WRITE_ERROR b/errors/templates/ERR_WRITE_ERROR index bb258953e2..78b9b13d25 100644 --- a/errors/templates/ERR_WRITE_ERROR +++ b/errors/templates/ERR_WRITE_ERROR @@ -2,24 +2,24 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Write Error

    -

    The system returned: %E

    +

    The system returned: %E

    An error condition occurred while writing to the network. Please retry your request.

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/ERR_ZERO_SIZE_OBJECT b/errors/templates/ERR_ZERO_SIZE_OBJECT index e86067b65b..85cc32420e 100644 --- a/errors/templates/ERR_ZERO_SIZE_OBJECT +++ b/errors/templates/ERR_ZERO_SIZE_OBJECT @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    Zero Sized Reply

    @@ -17,7 +17,7 @@

    Your cache administrator is %w.

    -
    -
    +
    +
    diff --git a/errors/templates/generic b/errors/templates/generic index 26f369180a..8990c47255 100644 --- a/errors/templates/generic +++ b/errors/templates/generic @@ -2,14 +2,14 @@ ERROR: The requested URL could not be retrieved - +

    ERROR

    The requested URL could not be retrieved


    The following error was encountered while trying to retrieve the URL: %U

    -
    +

    @SHORT_DESCRIPTION@

    @@ -20,7 +20,7 @@

    @LONG_DESCRIPTION@

    -
    -
    +
    +
    diff --git a/src/Makefile.am b/src/Makefile.am index ea6a27a9fc..434102bf7e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1041,6 +1041,7 @@ DEFAULT_HTTP_PORT = @CACHE_HTTP_PORT@ DEFAULT_ICP_PORT = @CACHE_ICP_PORT@ DEFAULT_PREFIX = $(prefix) DEFAULT_CONFIG_FILE = $(sysconfdir)/squid.conf +DEFAULT_CONFIG_DIR = $(sysconfdir) DEFAULT_MIME_TABLE = $(sysconfdir)/mime.conf DEFAULT_DNSSERVER = $(libexecdir)/`echo dnsserver | sed '$(transform);s/$$/$(EXEEXT)/'` DEFAULT_LOG_PREFIX = $(localstatedir)/logs @@ -1114,6 +1115,7 @@ cf.data: cf.data.pre Makefile s%@DEFAULT_ICON_DIR@%$(DEFAULT_ICON_DIR)%g;\ s%@DEFAULT_MIB_PATH@%$(DEFAULT_MIB_PATH)%g;\ s%@DEFAULT_ERROR_DIR@%$(DEFAULT_ERROR_DIR)%g;\ + s%@DEFAULT_CONFIG_DIR@%$(DEFAULT_CONFIG_DIR)%g;\ s%@DEFAULT_PREFIX@%$(DEFAULT_PREFIX)%g;\ s%@DEFAULT_HOSTS@%$(DEFAULT_HOSTS)%g;\ s%@[V]ERSION@%$(VERSION)%g;"\ diff --git a/src/cf.data.pre b/src/cf.data.pre index ffe0606602..67f84d10d8 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -4750,6 +4750,16 @@ DOC_START http://wiki.squid-cache.org/Translations DOC_END +NAME: err_page_stylesheet +TYPE: string +LOC: Config.errorStylesheet +DEFAULT: @DEFAULT_CONFIG_DIR@/errorpage.css +DOC_START + CSS Stylesheet to pattern the display of Squid default error pages. + + For information on CSS see http://www.w3.org/Style/CSS/ +DOC_END + NAME: err_html_text TYPE: eol LOC: Config.errHtmlText diff --git a/src/errorpage.cc b/src/errorpage.cc index d4a3964007..9e7e1181c9 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -122,6 +122,9 @@ static char **error_text = NULL; /// \ingroup ErrorPageInternal static int error_page_count = 0; +/// \ingroup ErrorPageInternal +static MemBuf error_page_stylesheet_content; + static char *errorTryLoadText(const char *page_name, const char *dir, bool silent = false); static char *errorLoadText(const char *page_name); static const char *errorFindHardText(err_type type); @@ -182,6 +185,11 @@ errorInitialize(void) } } } + + // look for and load stylesheet into global MemBuf for it. + if(Config.errorStylesheet) { + error_page_stylesheet_content = errorLoadText(Config.errorStylesheet); + } } void @@ -674,6 +682,11 @@ ErrorState::Convert(char token) break; + case 'l': + mb.append(error_page_stylesheet_content.content(), error_page_stylesheet_content.contentSize()); + do_quote = 0; + break; + case 'L': if (Config.errHtmlText) { mb.Printf("%s", Config.errHtmlText); diff --git a/src/structs.h b/src/structs.h index ba763e7ed1..eb34bf744e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -551,6 +551,7 @@ struct SquidConfig #if USE_ERR_LOCALES char *errorDefaultLanguage; #endif + char *errorStylesheet; struct { -- 2.47.3