]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/errorpage.h
2 * $Id: errorpage.h,v 1.6 2008/02/26 21:49:34 amosjeffries Exp $
4 * DEBUG: section 4 Error Generation
5 * AUTHOR: Duane Wessels
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
36 #ifndef SQUID_ERRORPAGE_H
37 #define SQUID_ERRORPAGE_H
41 #include "IPAddress.h"
44 \defgroup ErrorPageAPI Error Pages API
46 \section ErrorPageStringCodes Error Page % codes for text insertion.
50 B - URL with FTP %2f hack x
51 c - Squid error code x
52 d - seconds elapsed since request received x
55 f - FTP request line x
57 g - FTP server message x
59 H - server host name x
60 i - client IP address x
61 I - server IP address x
62 L - HREF link for more info/contact x
64 m - Error message returned by auth helper x
65 o - Message returned external acl helper x
68 R - Full HTTP Request x
69 S - squid signature from ERR_SIGNATURE x
70 s - caching proxy software with version x
73 U - URL without password x
74 u - URL with password x
75 w - cachemgr email address x
76 W - error data (to be included in the mailto links)
77 z - dns server error message x
78 Z - Preformatted error message x
82 class AuthUserRequest
;
86 /// \ingroup ErrorPageAPI
91 * Allocates and initializes an error response
93 HttpReply
*BuildHttpReply(void);
97 * Locates error page template to be used for this error
98 * and constructs the HTML page content from it.
100 MemBuf
*BuildContent(void);
103 * Convert an error template into an error page.
105 const char *Convert(char token
);
108 * CacheManager / Debug dump of the ErrorState object.
109 * Writes output into the given MemBuf.
110 \retval 0 successful completion.
112 int Dump(MemBuf
* mb
);
118 http_status httpStatus
;
119 AuthUserRequest
*auth_user_request
;
120 HttpRequest
*request
;
134 unsigned int flag_cbdata
:1;
139 wordlist
*server_msg
;
145 char *err_msg
; /* Preformatted error message from the cache */
148 CBDATA_CLASS2(ErrorState
);
152 \ingroup ErrorPageAPI
154 * This function finds the error messages formats, and stores
155 * them in error_text[]
158 * error_text[] - is modified
160 SQUIDCEXTERN
void errorInitialize(void);
162 /// \ingroup ErrorPageAPI
163 SQUIDCEXTERN
void errorClean(void);
166 \ingroup ErrorPageAPI
168 * This function generates a error page from the info contained
169 * by err and then sends it to the client.
170 * The callback function errorSendComplete() is called after
171 * the page has been written to the client socket (fd).
172 * errorSendComplete() deallocates err. We need to add
173 * err to the cbdata because comm_write() requires it
174 * for all callback data pointers.
176 \note normally errorSend() should only be called from
177 * routines in ssl.c and pass.c, where we don't have any
178 * StoreEntry's. In client_side.c we must allocate a StoreEntry
179 * for errors and use errorAppendEntry() to account for
180 * persistent/pipeline connections.
182 \param fd socket where page object is to be written
183 \param err This object is destroyed after use in this function.
185 SQUIDCEXTERN
void errorSend(int fd
, ErrorState
*err
);
188 \ingroup ErrorPageAPI
190 * This function generates a error page from the info contained
191 * by err and then stores the text in the specified store
193 * This function should only be called by "server
194 * side routines" which need to communicate errors to the
195 * client side. It should also be called from client_side.c
196 * because we now support persistent connections, and
197 * cannot assume that we can immediately write to the socket
201 \param err This object is destroyed after use in this function.
203 SQUIDCEXTERN
void errorAppendEntry(StoreEntry
*entry
, ErrorState
*err
);
205 /// \ingroup ErrorPageAPI
206 SQUIDCEXTERN
void errorStateFree(ErrorState
* err
);
208 /// \ingroup ErrorPageAPI
209 SQUIDCEXTERN err_type
errorReservePageId(const char *page_name
);
212 \ingroup ErrorPageAPI
214 * This function creates a ErrorState object.
216 SQUIDCEXTERN ErrorState
*errorCon(err_type type
, http_status
, HttpRequest
* request
);
218 #endif /* SQUID_ERRORPAGE_H */