/*
* Copyright (C) 1996-2017 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
/* DEBUG: section 04 Error Generation */
#include "squid.h"
#include "cache_cf.h"
#include "clients/forward.h"
#include "comm/Connection.h"
#include "comm/Write.h"
#include "disk.h"
#include "err_detail_type.h"
#include "errorpage.h"
#include "fde.h"
#include "html_quote.h"
#include "HttpHeaderTools.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "rfc1738.h"
#include "SquidConfig.h"
#include "Store.h"
#include "tools.h"
#include "URL.h"
#include "wordlist.h"
#if USE_AUTH
#include "auth/UserRequest.h"
#endif
#include "SquidTime.h"
#if USE_OPENSSL
#include "ssl/ErrorDetailManager.h"
#endif
/**
\defgroup ErrorPageInternal Error Page Internals
\ingroup ErrorPageAPI
*
\section Abstract Abstract:
* These routines are used to generate error messages to be
* sent to clients. The error type is used to select between
* the various message formats. (formats are stored in the
* Config.errorDirectory)
*/
#if !defined(DEFAULT_SQUID_ERROR_DIR)
/** Where to look for errors if config path fails.
\note Please use ./configure --datadir=/path instead of patching
*/
#define DEFAULT_SQUID_ERROR_DIR DEFAULT_SQUID_DATA_DIR"/errors"
#endif
/// \ingroup ErrorPageInternal
CBDATA_CLASS_INIT(ErrorState);
/* local types */
/// \ingroup ErrorPageInternal
typedef struct {
int id;
char *page_name;
Http::StatusCode page_redirect;
} ErrorDynamicPageInfo;
/* local constant and vars */
/**
\ingroup ErrorPageInternal
*
\note hard coded error messages are not appended with %S
* automagically to give you more control on the format
*/
static const struct {
int type; /* and page_id */
const char *text;
}
error_hard_text[] = {
{
ERR_SQUID_SIGNATURE,
"\n
\n"
"