Collaboration diagram for Error Pages API:


 Error Page Internals


class  ErrorState
class  TemplateFile


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)

Detailed Description

Error Page % codes for text insertion.

  a - User identity                            x
  A - Local listening IP address               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

Plus logformat codes embedded using @Squid{logformat_code} syntax.

Function Documentation

◆ errorAppendEntry()

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.

errThis object is destroyed after use in this function.

Definition at line 717 of file

References assert, ErrorState::BuildHttpReply(), debugs, EBIT_TEST, ENTRY_ABORTED, HttpRequest::flags, StoreEntry::flags, StoreEntry::isEmpty(), StoreEntry::mem_obj, MemObject::nclients, 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().

◆ errorClean()

void errorClean ( void  )

◆ errorInitialize()

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 254 of file

References ERR_MAX, ERR_NONE, error_page_count, error_text, ErrorDynamicPages, errorFindHardText(), ErrorPage::ImportStaticErrorText(), safe_free, text, and xcalloc().

Referenced by mainInitialize(), and mainReconfigureFinish().

◆ errorSend()

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.

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.
clientConnsocket where page object is to be written
errThis object is destroyed after use in this function.

Definition at line 748 of file

References assert, ErrorState::BuildHttpReply(), commCbCall(), conn, debugs, errorSendComplete, Comm::IsConnOpen(), HttpReply::pack(), and Comm::Write().

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

◆ errorSendComplete()

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

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

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

Definition at line 772 of file

References ErrorState::callback, ErrorState::callback_data, conn, debugs, Comm::ERR_CLOSING, and size.






Web Site Translations