manages error detail templates More...
Public Member Functions | |
ErrorDetailFile (ErrorDetailsList::Pointer const details) | |
bool | loaded () const |
return true if the data loaded from disk without any problem More... | |
void | loadDefault () |
bool | loadFor (const HttpRequest *request) |
bool | loadFromFile (const char *path) |
const char * | language () |
The language used for the template. More... | |
Public Attributes | |
SBuf | filename |
where the template was loaded from More... | |
bool | silent |
Whether to print error messages on cache.log file or not. It is user defined. More... | |
Protected Member Functions | |
virtual void | setDefault () |
recover from loadDefault() failure to load or parse() a template More... | |
bool | tryLoadTemplate (const char *lang) |
Protected Attributes | |
SBuf | template_ |
raw template contents More... | |
bool | wasLoaded |
True if the template data read from disk without any problem. More... | |
String | errLanguage |
The error language of the template. More... | |
String | templateName |
The name of the template. More... | |
err_type | templateCode |
The internal code for this template. More... | |
Private Member Functions | |
bool | parse () override |
post-process the loaded template More... | |
Private Attributes | |
ErrorDetailsList::Pointer | theDetails |
Detailed Description
Definition at line 52 of file ErrorDetailManager.cc.
Constructor & Destructor Documentation
◆ ErrorDetailFile()
|
inlineexplicit |
Definition at line 55 of file ErrorDetailManager.cc.
References theDetails.
Member Function Documentation
◆ language()
|
inlineinherited |
Definition at line 313 of file errorpage.h.
References TemplateFile::errLanguage, and String::termedBuf().
Referenced by ErrorState::buildBody(), and Ssl::ErrorDetailsManager::findDetail().
◆ loadDefault()
|
inherited |
Load the page_name template from a file which probably exist at: (a) admin specified custom directory (error_directory) (b) default language translation directory (error_default_language) (c) English sub-directory where errors should ALWAYS exist If all of the above fail, setDefault() is called.
test error_directory configured location
test error_default_language location
Definition at line 356 of file errorpage.cc.
References Config, DBG_CRITICAL, debugs, SquidConfig::errorDefaultLanguage, SquidConfig::errorDirectory, TemplateFile::loaded(), TemplateFile::loadFromFile(), MAXPATHLEN, TemplateFile::setDefault(), TCP_RESET, TemplateFile::templateCode, TemplateFile::templateName, String::termedBuf(), TemplateFile::tryLoadTemplate(), and TemplateFile::wasLoaded.
Referenced by Ssl::ErrorDetailsManager::ErrorDetailsManager().
◆ loaded()
|
inlineinherited |
Definition at line 287 of file errorpage.h.
References TemplateFile::wasLoaded.
Referenced by TemplateFile::loadDefault(), TemplateFile::loadFor(), and TemplateFile::loadFromFile().
◆ loadFor()
|
inherited |
Load an error template for a given HTTP request. This function examines the Accept-Language header and select the first available template. If the default template selected (eg because of a "Accept-Language: *"), or not available template found this function return false.
Definition at line 519 of file errorpage.cc.
References Http::ACCEPT_LANGUAGE, Config, DBG_IMPORTANT, debugs, TemplateFile::errLanguage, SquidConfig::errorLogMissingLanguages, HttpHeader::getList(), Http::Message::header, TemplateFile::loaded(), strHdrAcptLangGetItem(), and TemplateFile::tryLoadTemplate().
Referenced by ErrorState::buildBody(), and Ssl::ErrorDetailsManager::findDetail().
◆ loadFromFile()
|
inherited |
Load the file given by "path". It uses the "parse()" method. On success return true and sets the "defined" member
Definition at line 417 of file errorpage.cc.
References DBG_CRITICAL, debugs, FD_READ_METHOD(), file_close(), file_open(), TemplateFile::filename, TemplateFile::loaded(), MYNAME, O_TEXT, TemplateFile::parse(), TemplateFile::silent, TCP_RESET, TemplateFile::templateCode, TemplateFile::wasLoaded, and xstrerr().
Referenced by TemplateFile::loadDefault(), and TemplateFile::tryLoadTemplate().
◆ parse()
|
overrideprivatevirtual |
Reimplemented from TemplateFile.
Definition at line 175 of file ErrorDetailManager.cc.
References CurrentException(), DBG_IMPORTANT, debugs, detailEntryEnd(), Ssl::ErrorIsOptional(), HttpHeader::getByName(), Ssl::GetErrorCode(), HttpHeader::parse(), size, String::size(), StringToSBuf(), and String::termedBuf().
◆ setDefault()
|
inlineprotectedvirtualinherited |
Reimplemented in ErrorPageFile.
Definition at line 324 of file errorpage.h.
Referenced by TemplateFile::loadDefault().
◆ tryLoadTemplate()
|
protectedinherited |
Try to load the "page_name" template for a given language "lang" from squid errors directory
- Returns
- true on success false otherwise
Definition at line 392 of file errorpage.cc.
References assert, debugs, DEFAULT_SQUID_ERROR_DIR, TemplateFile::loadFromFile(), MAXPATHLEN, TemplateFile::templateName, and String::termedBuf().
Referenced by TemplateFile::loadDefault(), and TemplateFile::loadFor().
Member Data Documentation
◆ errLanguage
|
protectedinherited |
Definition at line 335 of file errorpage.h.
Referenced by TemplateFile::language(), and TemplateFile::loadFor().
◆ filename
|
inherited |
Definition at line 315 of file errorpage.h.
Referenced by ErrorState::buildBody(), and TemplateFile::loadFromFile().
◆ silent
|
inherited |
Definition at line 317 of file errorpage.h.
Referenced by TemplateFile::loadFromFile().
◆ template_
|
protectedinherited |
Definition at line 333 of file errorpage.h.
Referenced by ErrorPageFile::setDefault().
◆ templateCode
|
protectedinherited |
Definition at line 337 of file errorpage.h.
Referenced by TemplateFile::loadDefault(), and TemplateFile::loadFromFile().
◆ templateName
|
protectedinherited |
Definition at line 336 of file errorpage.h.
Referenced by TemplateFile::loadDefault(), ErrorPageFile::setDefault(), and TemplateFile::tryLoadTemplate().
◆ theDetails
|
private |
Definition at line 60 of file ErrorDetailManager.cc.
Referenced by ErrorDetailFile().
◆ wasLoaded
|
protectedinherited |
Definition at line 334 of file errorpage.h.
Referenced by TemplateFile::loadDefault(), TemplateFile::loaded(), and TemplateFile::loadFromFile().
The documentation for this class was generated from the following file:
- src/ssl/ErrorDetailManager.cc