#include <errorpage.h>

Collaboration diagram for ErrorState:

Public Member Functions

void * operator new (size_t size)
void operator delete (void *address)
void * toCbdata () noexcept
 ErrorState (err_type type, Http::StatusCode, HttpRequest *request)
 ErrorState ()=delete
 ~ErrorState ()
HttpReplyBuildHttpReply (void)
void detailError (int dCode)
 set error type-specific detail code More...

Static Public Member Functions

static ErrorStateNewForwarding (err_type, HttpRequestPointer &)
 Creates a general request forwarding error with the right http_status. More...

Public Attributes

err_type type = ERR_NONE
int page_id = ERR_NONE
char * err_language = nullptr
Http::StatusCode httpStatus
Auth::UserRequest::Pointer auth_user_request
HttpRequestPointer request
char * url = nullptr
int xerrno = 0
unsigned short port = 0
String dnsError
 DNS lookup error message. More...
time_t ttl = 0
Ip::Address src_addr
char * redirect_url = nullptr
void * callback_data = nullptr
struct {
   wordlist *   server_msg = nullptr
   char *   request = nullptr
   char *   reply = nullptr
   char *   cwd_msg = nullptr
   MemBuf *   listing = nullptr
char * request_hdrs = nullptr
char * err_msg = nullptr
Ssl::ErrorDetaildetail = nullptr
int detailCode = ERR_DETAIL_NONE

Private Member Functions

MemBufBuildContent (void)
MemBufConvertText (const char *text, bool allowRecursion)
void DenyInfoLocation (const char *name, HttpRequest *request, MemBuf &result)
const char * Convert (char token, bool building_deny_info_url, bool allowRecursion)
int Dump (MemBuf *mb)

Static Private Attributes

static cbdata_type CBDATA_ErrorState = CBDATA_UNKNOWN

Detailed Description

Definition at line 79 of file errorpage.h.

Constructor & Destructor Documentation

ErrorState::ErrorState ( err_type  type,
Http::StatusCode  status,
HttpRequest request 

Definition at line 559 of file errorpage.cc.

References HttpRequest::client_addr, ERR_MAX, httpStatus, page_id, request, Http::scNone, and src_addr.

ErrorState::ErrorState ( )

Referenced by NewForwarding().

ErrorState::~ErrorState ( )

Member Function Documentation

MemBuf * ErrorState::BuildContent ( void  )

Locates error page template to be used for this error and constructs the HTML page content from it.

error_directory option in squid.conf overrides translations. Custom errors are always found either in error_directory or the templates directory. Otherwise locate the Accept-Language header

If client-specific error templates are not enabled or available. fall back to the old style squid.conf settings.

Definition at line 1201 of file errorpage.cc.

References assert, Config, ConvertText(), debugs, err_language, ERR_MAX, ERR_NONE, err_type_str, SquidConfig::errorDefaultLanguage, SquidConfig::errorDirectory, errorPageName(), RefCount< C >::getRaw(), HERE(), TemplateFile::language(), TemplateFile::loadFor(), NULL, page_id, request, safe_free, ErrorPageFile::text(), and xstrdup.

Referenced by BuildHttpReply(), and Convert().

const char * ErrorState::Convert ( char  token,
bool  building_deny_info_url,
bool  allowRecursion 

Map the Error page and deny_info template % codes into textual output.

Several of the codes produce blocks of non-URL compatible results. When processing the deny_info location URL they will be skipped.

tokenThe token following % which need to be converted
building_deny_info_urlPerform special deny_info actions, such as URL-encoding and token skipping. \ allowRecursion True if the codes which do recursions should converted

Definition at line 739 of file errorpage.cc.

References addr, SquidConfig::adminEmail, MemBuf::append(), Packable::appendf(), assert, HttpRequest::auth_user_request, auth_user_request, MemBuf::buf, BuildContent(), MemBuf::clean(), Config, MemBuf::content(), MemBuf::contentSize(), ConvertText(), DBG_CRITICAL, debugs, Auth::UserRequest::denyMessage(), detail, dnsError, Dump(), HttpRequest::effectiveRequestUri(), SquidConfig::emailErrData, err_msg, ERR_SQUID_SIGNATURE, SquidConfig::errHtmlText, Ssl::ErrorDetail::errorName(), errorPageName(), HttpRequest::extacl_message, external_acl_message, FindListeningPortAddress(), Time::FormatHttpd(), ftp, getMyHostname(), getMyPort(), RefCount< C >::getRaw(), AnyP::Uri::getScheme(), Http::Message::header, HttpRequest::hier, HierarchyLogEntry::host, AnyP::Uri::host(), html_quote(), Http::Message::http_ver, AnyP::UriScheme::image(), HttpRequestMethod::image(), SBuf::length(), AnyP::ProtocolVersion::major, MAX_IPSTRLEN, HttpRequest::method, AnyP::ProtocolVersion::minor, mkrfc1123(), NULL, SquidConfig::onoff, p, HttpHeader::packInto(), page_id, AnyP::Uri::path(), AnyP::Uri::port(), AnyP::ProtocolVersion::protocol, AnyP::ProtocolType_str, SBuf::rawContent(), Comm::Connection::remote, request, request_hdrs, MemBuf::reset(), rfc1738_escape_part, String::size(), squid_curtime, SQUIDSBUFPH, SQUIDSBUFPRINT, src_addr, strerror(), HierarchyLogEntry::tcpServer, String::termedBuf(), Ip::Address::toStr(), Ssl::ErrorDetail::toString(), type, HttpRequest::url, url, urlCanonicalFakeHttps(), Ftp::UrlWith2f(), Ssl::ErrorDetail::useRequest(), Auth::UserRequest::username(), visible_appname_string, wordlistCat(), and xerrno.

Referenced by ConvertText(), and DenyInfoLocation().

MemBuf * ErrorState::ConvertText ( const char *  text,
bool  allowRecursion 

Convert the given template string into textual output

textThe string to be converted
allowRecursionWhether to convert codes which output may contain codes

Definition at line 1248 of file errorpage.cc.

References MemBuf::append(), Packable::appendf(), assert, MemBuf::content(), MemBuf::contentSize(), Convert(), MemBuf::init(), p, MemBuf::terminate(), and text.

Referenced by BuildContent(), and Convert().

void ErrorState::DenyInfoLocation ( const char *  name,
HttpRequest request,
MemBuf result 

Generates the Location: header value for a deny_info error page to be used for this error.

Definition at line 1088 of file errorpage.cc.

References MemBuf::append(), Packable::appendf(), assert, MemBuf::content(), MemBuf::contentSize(), Convert(), and p.

Referenced by BuildHttpReply().

void ErrorState::operator delete ( void *  address)

Definition at line 81 of file errorpage.h.

void* ErrorState::operator new ( size_t  size)

Definition at line 81 of file errorpage.h.

void* ErrorState::toCbdata ( )

Definition at line 81 of file errorpage.h.

Member Data Documentation

ERCB* ErrorState::callback

Definition at line 156 of file errorpage.h.

Referenced by errorSendComplete(), and TunnelStateData::sendError().

void* ErrorState::callback_data = nullptr
char* ErrorState::cwd_msg = nullptr

Definition at line 163 of file errorpage.h.

int ErrorState::detailCode = ERR_DETAIL_NONE

type-specific detail about the transaction error; overwrites xerrno; overwritten by detail, if any.

Definition at line 175 of file errorpage.h.

Referenced by BuildHttpReply(), and detailError().

String ErrorState::dnsError

Definition at line 151 of file errorpage.h.

Referenced by Convert(), Dump(), and PeerSelector::noteIps().

char* ErrorState::err_language = nullptr

Definition at line 142 of file errorpage.h.

Referenced by BuildContent(), BuildHttpReply(), and ~ErrorState().

char* ErrorState::err_msg = nullptr

Definition at line 168 of file errorpage.h.

Referenced by Convert(), ESIContext::fail(), and ~ErrorState().

MemBuf* ErrorState::listing = nullptr

Definition at line 164 of file errorpage.h.

Referenced by Ftp::Gateway::completedListing().

int ErrorState::page_id = ERR_NONE

Definition at line 141 of file errorpage.h.

Referenced by BuildContent(), BuildHttpReply(), Convert(), errorAppendEntry(), and ErrorState().

unsigned short ErrorState::port = 0

Definition at line 150 of file errorpage.h.

Referenced by gopherSendComplete(), and tunnelConnectDone().

char* ErrorState::redirect_url = nullptr

Definition at line 155 of file errorpage.h.

Referenced by ~ErrorState().

char* ErrorState::reply = nullptr

Definition at line 162 of file errorpage.h.

Referenced by Ftp::Client::failed().

char* ErrorState::request = nullptr

Definition at line 161 of file errorpage.h.

char* ErrorState::request_hdrs = nullptr

Definition at line 167 of file errorpage.h.

Referenced by Convert(), clientReplyContext::setReplyToError(), and ~ErrorState().

wordlist* ErrorState::server_msg = nullptr

Definition at line 160 of file errorpage.h.

Referenced by Ftp::Client::failed().

Ip::Address ErrorState::src_addr
time_t ErrorState::ttl = 0

Definition at line 152 of file errorpage.h.

The documentation for this class was generated from the following files:






Web Site Translations