Collaboration diagram for Error Pages API:

Modules

 Error Page Internals
 

Classes

class  ErrorState
 
class  TemplateFile
 

Functions

static void errorSendComplete (const Comm::ConnectionPointer &conn, char *, size_t size, Comm::Flag errflag, int, void *data)
 
void errorInitialize (void)
 
void errorClean (void)
 
void errorSend (const Comm::ConnectionPointer &conn, ErrorState *err)
 
void errorAppendEntry (StoreEntry *entry, ErrorState *err)
 
err_type errorReservePageId (const char *page_name)
 

Detailed Description

Error Page % codes for text insertion.

  a - User identity                            x
  B - URL with FTP %2f hack                    x
  c - Squid error code                         x
  d - seconds elapsed since request received   x
  D - Error details                            x
  e - errno                                    x
  E - strerror()                               x
  f - FTP request line                         x
  F - FTP reply line                           x
  g - FTP server message                       x
  h - cache hostname                           x
  H - server host name                         x
  i - client IP address                        x
  I - server IP address                        x
  l - HREF link for CSS stylesheet inclusion   x
  L - HREF link for more info/contact          x
  M - Request Method                           x
  m - Error message returned by auth helper    x
  o - Message returned external acl helper     x
  p - URL port #                               x
  P - Protocol                                 x
  R - Full HTTP Request                        x
  S - squid signature from ERR_SIGNATURE       x
  s - caching proxy software with version      x
  t - local time                               x
  T - UTC                                      x
  U - URL without password                     x
  u - URL with password                        x
  w - cachemgr email address                   x
  W - error data (to be included in the mailto links)
  x - error name                               x
  z - dns server error message                 x
  Z - Preformatted error message               x

Function Documentation

void errorAppendEntry ( StoreEntry entry,
ErrorState err 
)

This function generates a error page from the info contained by err and then stores the text in the specified store entry. This function should only be called by "server side routines" which need to communicate errors to the client side. It should also be called from client_side.c because we now support persistent connections, and cannot assume that we can immediately write to the socket for an error.

Parameters
entry??
errThis object is destroyed after use in this function.

Definition at line 576 of file errorpage.cc.

References assert, ErrorState::BuildHttpReply(), debugs, EBIT_TEST, ENTRY_ABORTED, HttpRequest::flags, StoreEntry::flags, StoreEntry::isEmpty(), StoreEntry::mem_obj, MemObject::nclients, NULL, ErrorState::page_id, ErrorState::request, RequestFlags::resetTcp, STORE_PENDING, StoreEntry::store_status, StoreEntry::storeErrorResponse(), and TCP_RESET.

Referenced by FwdState::completed(), ClientHttpRequest::doCallouts(), internalStart(), clientReplyContext::processMiss(), FwdState::retryOrBail(), clientReplyContext::setReplyToError(), UrnState::setUriResFromRequest(), CacheManager::Start(), FwdState::Start(), clientReplyContext::startError(), and urnHandleReply().

void errorClean ( void  )
void errorInitialize ( void  )

This function finds the error messages formats, and stores them in error_text[]

Global effects:
error_text[] - is modified
Index any hard-coded error text into defaults.
Index precompiled fixed template files from one of two sources: (a) default language translation directory (error_default_language) (b) admin specified custom directory (error_directory)
Index any unknown file names used by deny_info.

But only if they are not redirection URL.

Definition at line 158 of file errorpage.cc.

References Packable::appendf(), assert, Config, ERR_MAX, ERR_NONE, err_type_str, error_page_count, Ssl::errorDetailInitialize(), errorFindHardText(), SquidConfig::errorStylesheet, i, ErrorDynamicPageInfo::id, TemplateFile::loadDefault(), TemplateFile::loadFromFile(), NULL, ErrorDynamicPageInfo::page_name, ErrorDynamicPageInfo::page_redirect, MemBuf::reset(), safe_free, Http::scNone, text, ErrorPageFile::text(), xcalloc, and xstrdup.

Referenced by mainInitialize(), and mainReconfigureFinish().

err_type errorReservePageId ( const char *  page_name)
void errorSend ( const Comm::ConnectionPointer conn,
ErrorState err 
)

This function generates a error page from the info contained by err and then sends it to the client. The callback function errorSendComplete() is called after the page has been written to the client (clientConn). errorSendComplete() deallocates err. We need to add err to the cbdata because comm_write() requires it for all callback data pointers.

Note
normally errorSend() should only be called from routines in ssl.c and pass.c, where we don't have any StoreEntry's. In client_side.c we must allocate a StoreEntry for errors and use errorAppendEntry() to account for persistent/pipeline connections.
Parameters
clientConnsocket where page object is to be written
errThis object is destroyed after use in this function.

Definition at line 609 of file errorpage.cc.

References assert, ErrorState::BuildHttpReply(), commCbCall(), debugs, Comm::IsConnOpen(), and Comm::Write().

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

static void errorSendComplete ( const Comm::ConnectionPointer conn,
char *  ,
size_t  size,
Comm::Flag  errflag,
int  ,
void *  data 
)
static

Called by commHandleWrite() after data has been written to the client socket.

Note
If there is a callback, the callback is responsible for closing the FD, otherwise we do it ourselves.

Definition at line 633 of file errorpage.cc.

References ErrorState::callback, ErrorState::callback_data, Comm::Connection::close(), data, debugs, Comm::ERR_CLOSING, Comm::Connection::fd, and HERE().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors