Inheritance diagram for ErrorPageFile:
Collaboration diagram for ErrorPageFile:

Public Member Functions

 ErrorPageFile (const char *name, const err_type code)
 
const char * text ()
 The template text data read from disk. More...
 
bool loaded () const
 return true if the data loaded from disk without any problem More...
 
bool loadDefault ()
 
bool loadFor (const HttpRequest *request)
 
bool loadFromFile (const char *path)
 
const char * language ()
 The language used for the template. More...
 

Public Attributes

bool silent
 Whether to print error messages on cache.log file or not. It is user defined. More...
 

Protected Member Functions

bool tryLoadTemplate (const char *lang)
 

Protected Attributes

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

virtual bool parse (const char *buf, int len, bool)
 stores the data read from disk to a local buffer More...
 

Private Attributes

MemBuf textBuf
 A buffer to store the error page. More...
 

Detailed Description

manages an error page template

Definition at line 124 of file errorpage.cc.

Constructor & Destructor Documentation

ErrorPageFile::ErrorPageFile ( const char *  name,
const err_type  code 
)
inline

Definition at line 127 of file errorpage.cc.

References MemBuf::init(), and textBuf.

Member Function Documentation

const char* TemplateFile::language ( )
inlineinherited
bool TemplateFile::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

test error_directory configured location

test error_default_language location

Definition at line 258 of file errorpage.cc.

References Config, DBG_CRITICAL, debugs, SquidConfig::errorDefaultLanguage, SquidConfig::errorDirectory, TemplateFile::loaded(), TemplateFile::loadFromFile(), MAXPATHLEN, TemplateFile::parse(), String::size(), TCP_RESET, TemplateFile::templateCode, TemplateFile::templateName, String::termedBuf(), and TemplateFile::tryLoadTemplate().

Referenced by Ssl::ErrorDetailsManager::ErrorDetailsManager(), and errorInitialize().

bool TemplateFile::loaded ( ) const
inlineinherited
bool TemplateFile::loadFor ( const HttpRequest request)
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 415 of file errorpage.cc.

References Http::ACCEPT_LANGUAGE, Config, DBG_IMPORTANT, debugs, TemplateFile::errLanguage, SquidConfig::errorLogMissingLanguages, HttpHeader::getList(), Http::Message::header, HERE(), TemplateFile::loaded(), strHdrAcptLangGetItem(), and TemplateFile::tryLoadTemplate().

Referenced by ErrorState::BuildContent(), and Ssl::ErrorDetailsManager::getErrorDetail().

bool TemplateFile::loadFromFile ( const char *  path)
inherited

Load the file given by "path". It uses the "parse()" method. On success return true and sets the "defined" member

Definition at line 320 of file errorpage.cc.

References buf, DBG_CRITICAL, debugs, FD_READ_METHOD, file_close(), file_open(), len, TemplateFile::loaded(), MYNAME, O_TEXT, TemplateFile::parse(), TemplateFile::silent, TCP_RESET, TemplateFile::templateCode, TemplateFile::wasLoaded, and xstrerr().

Referenced by errorInitialize(), TemplateFile::loadDefault(), and TemplateFile::tryLoadTemplate().

virtual bool ErrorPageFile::parse ( const char *  buf,
int  len,
bool   
)
inlineprivatevirtual

Implements TemplateFile.

Definition at line 134 of file errorpage.cc.

References MemBuf::append(), and textBuf.

const char* ErrorPageFile::text ( )
inline

Definition at line 130 of file errorpage.cc.

References MemBuf::content(), and textBuf.

Referenced by ErrorState::BuildContent(), and errorInitialize().

bool TemplateFile::tryLoadTemplate ( const char *  lang)
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 295 of file errorpage.cc.

References assert, debugs, DEFAULT_SQUID_ERROR_DIR, HERE(), TemplateFile::loadFromFile(), MAXPATHLEN, TemplateFile::templateName, and String::termedBuf().

Referenced by TemplateFile::loadDefault(), and TemplateFile::loadFor().

Member Data Documentation

String TemplateFile::errLanguage
protectedinherited

Definition at line 290 of file errorpage.h.

Referenced by TemplateFile::language(), and TemplateFile::loadFor().

bool TemplateFile::silent
inherited

Definition at line 276 of file errorpage.h.

Referenced by TemplateFile::loadFromFile().

err_type TemplateFile::templateCode
protectedinherited

Definition at line 292 of file errorpage.h.

Referenced by TemplateFile::loadDefault(), and TemplateFile::loadFromFile().

String TemplateFile::templateName
protectedinherited

Definition at line 291 of file errorpage.h.

Referenced by TemplateFile::loadDefault(), and TemplateFile::tryLoadTemplate().

MemBuf ErrorPageFile::textBuf
private

Definition at line 140 of file errorpage.cc.

Referenced by ErrorPageFile(), parse(), and text().

bool TemplateFile::wasLoaded
protectedinherited

Definition at line 289 of file errorpage.h.

Referenced by TemplateFile::loaded(), and TemplateFile::loadFromFile().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors