]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/errorpage.cc
3 * $Id: errorpage.cc,v 1.230 2008/02/26 21:49:34 amosjeffries Exp $
5 * DEBUG: section 4 Error Generation
6 * AUTHOR: Duane Wessels
8 * SQUID Web Proxy Cache http://www.squid-cache.org/
9 * ----------------------------------------------------------
11 * Squid is the result of efforts by numerous individuals from
12 * the Internet community; see the CONTRIBUTORS file for full
13 * details. Many organizations have provided support for Squid's
14 * development; see the SPONSORS file for full details. Squid is
15 * Copyrighted (C) 2001 by the Regents of the University of
16 * California; see the COPYRIGHT file for full details. Squid
17 * incorporates software developed and/or copyrighted by other
18 * sources; see the CREDITS file for full details.
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
37 #include "errorpage.h"
38 #include "AuthUserRequest.h"
39 #include "SquidTime.h"
41 #include "HttpReply.h"
42 #include "HttpRequest.h"
43 #include "MemObject.h"
46 #include "URLScheme.h"
50 \defgroup ErrorPageInternal Error Page Internals
53 \section Abstract Abstract:
54 * These routines are used to generate error messages to be
55 * sent to clients. The error type is used to select between
56 * the various message formats. (formats are stored in the
57 * Config.errorDirectory)
61 #ifndef DEFAULT_SQUID_ERROR_DIR
62 /** Where to look for errors if config path fails.
63 \note Please use ./configure --datadir=/path instead of patching
65 #define DEFAULT_SQUID_ERROR_DIR DEFAULT_SQUID_DATA_DIR"/errors"
68 /// \ingroup ErrorPageInternal
69 CBDATA_CLASS_INIT(ErrorState
);
73 /// \ingroup ErrorPageInternal
78 } ErrorDynamicPageInfo
;
80 /* local constant and vars */
83 \ingroup ErrorPageInternal
85 \note hard coded error messages are not appended with %S
86 * automagically to give you more control on the format
90 int type
; /* and page_id */
100 "<div id=\"footer\">\n"
101 "Generated %T by %h (%s)\n"
111 /// \ingroup ErrorPageInternal
112 static Vector
<ErrorDynamicPageInfo
*> ErrorDynamicPages
;
114 /* local prototypes */
116 /// \ingroup ErrorPageInternal
117 static const int error_hard_text_count
= sizeof(error_hard_text
) / sizeof(*error_hard_text
);
119 /// \ingroup ErrorPageInternal
120 static char **error_text
= NULL
;
122 /// \ingroup ErrorPageInternal
123 static int error_page_count
= 0;
125 /// \ingroup ErrorPageInternal
126 static MemBuf error_stylesheet
;
128 static char *errorTryLoadText(const char *page_name
, const char *dir
, bool silent
= false);
129 static char *errorLoadText(const char *page_name
);
130 static const char *errorFindHardText(err_type type
);
131 static ErrorDynamicPageInfo
*errorDynamicPageInfoCreate(int id
, const char *page_name
);
132 static void errorDynamicPageInfoDestroy(ErrorDynamicPageInfo
* info
);
133 static IOCB errorSendComplete
;
136 /// \ingroup ErrorPageInternal
137 err_type
&operator++ (err_type
&anErr
)
139 int tmp
= (int)anErr
;
140 anErr
= (err_type
)(++tmp
);
144 /// \ingroup ErrorPageInternal
145 int operator - (err_type
const &anErr
, err_type
const &anErr2
)
147 return (int)anErr
- (int)anErr2
;
151 errorInitialize(void)
155 error_page_count
= ERR_MAX
+ ErrorDynamicPages
.size();
156 error_text
= static_cast<char **>(xcalloc(error_page_count
, sizeof(char *)));
158 for (i
= ERR_NONE
, ++i
; i
< error_page_count
; ++i
) {
159 safe_free(error_text
[i
]);
161 if ((text
= errorFindHardText(i
))) {
163 * Index any hard-coded error text into defaults.
165 error_text
[i
] = xstrdup(text
);
167 } else if (i
< ERR_MAX
) {
169 * Index precompiled fixed template files from one of two sources:
170 * (a) default language translation directory (error_default_language)
171 * (b) admin specified custom directory (error_directory)
173 error_text
[i
] = errorLoadText(err_type_str
[i
]);
177 * Index any unknown file names used by deny_info.
179 ErrorDynamicPageInfo
*info
= ErrorDynamicPages
.items
[i
- ERR_MAX
];
180 assert(info
&& info
->id
== i
&& info
->page_name
);
182 if (strchr(info
->page_name
, ':') == NULL
) {
183 /** But only if they are not redirection URL. */
184 error_text
[i
] = errorLoadText(info
->page_name
);
189 error_stylesheet
.reset();
191 // look for and load stylesheet into global MemBuf for it.
192 if(Config
.errorStylesheet
) {
193 char *temp
= errorTryLoadText(Config
.errorStylesheet
,NULL
);
195 error_stylesheet
.Printf("%s",temp
);
207 for (i
= ERR_NONE
+ 1; i
< error_page_count
; i
++)
208 safe_free(error_text
[i
]);
210 safe_free(error_text
);
213 while (ErrorDynamicPages
.size())
214 errorDynamicPageInfoDestroy(ErrorDynamicPages
.pop_back());
216 error_page_count
= 0;
219 /// \ingroup ErrorPageInternal
221 errorFindHardText(err_type type
)
225 for (i
= 0; i
< error_hard_text_count
; i
++)
226 if (error_hard_text
[i
].type
== type
)
227 return error_hard_text
[i
].text
;
233 * \ingroup ErrorPageInternal
235 * Load into the in-memory error text Index a file probably available at:
236 * (a) admin specified custom directory (error_directory)
237 * (b) default language translation directory (error_default_language)
238 * (c) English sub-directory where errors should ALWAYS exist
241 errorLoadText(const char *page_name
)
245 /** test error_directory configured location */
246 if(Config
.errorDirectory
)
247 text
= errorTryLoadText(page_name
, Config
.errorDirectory
);
250 /** test error_default_language location */
251 if(!text
&& Config
.errorDefaultLanguage
) {
253 snprintf(dir
,256,"%s/%s", DEFAULT_SQUID_ERROR_DIR
, Config
.errorDefaultLanguage
);
254 text
= errorTryLoadText(page_name
, dir
);
256 debugs(1, DBG_CRITICAL
, "Unable to load default error language files. Reset to backups.");
261 /* test default location if failed (templates == English translation base templates) */
263 text
= errorTryLoadText(page_name
, DEFAULT_SQUID_ERROR_DIR
"/templates");
266 /* giving up if failed */
268 fatal("failed to find or read error text file.");
273 /// \ingroup ErrorPageInternal
275 errorTryLoadText(const char *page_name
, const char *dir
, bool silent
)
278 char path
[MAXPATHLEN
];
284 // maybe received compound parts, maybe an absolute page_name and no dir
286 snprintf(path
, sizeof(path
), "%s/%s", dir
, page_name
);
288 snprintf(path
, sizeof(path
), "%s", page_name
);
290 fd
= file_open(path
, O_RDONLY
| O_TEXT
);
293 /* with dynamic locale negotiation we may see some failures before a success. */
295 debugs(4, DBG_CRITICAL
, HERE
<< "'" << path
<< "': " << xstrerror());
301 while((len
= FD_READ_METHOD(fd
, buf
, sizeof(buf
))) > 0) {
302 textbuf
.append(buf
, len
);
306 debugs(4, DBG_CRITICAL
, HERE
<< "failed to fully read: '" << path
<< "': " << xstrerror());
311 if (strstr(textbuf
.buf
, "%s") == NULL
)
312 textbuf
.append("%S", 2); /* add signature */
314 /* Shrink memory size down to exact size. MemBuf has a tencendy
315 * to be rather large..
317 text
= xstrdup(textbuf
.buf
);
324 /// \ingroup ErrorPageInternal
325 static ErrorDynamicPageInfo
*
326 errorDynamicPageInfoCreate(int id
, const char *page_name
)
328 ErrorDynamicPageInfo
*info
= new ErrorDynamicPageInfo
;
330 info
->page_name
= xstrdup(page_name
);
334 /// \ingroup ErrorPageInternal
336 errorDynamicPageInfoDestroy(ErrorDynamicPageInfo
* info
)
339 safe_free(info
->page_name
);
343 /// \ingroup ErrorPageInternal
345 errorPageId(const char *page_name
)
347 for (int i
= 0; i
< ERR_MAX
; i
++) {
348 if (strcmp(err_type_str
[i
], page_name
) == 0)
352 for (size_t j
= 0; j
< ErrorDynamicPages
.size(); j
++) {
353 if (strcmp(ErrorDynamicPages
.items
[j
]->page_name
, page_name
) == 0)
361 errorReservePageId(const char *page_name
)
363 ErrorDynamicPageInfo
*info
;
364 int id
= errorPageId(page_name
);
366 if (id
== ERR_NONE
) {
367 info
= errorDynamicPageInfoCreate(ERR_MAX
+ ErrorDynamicPages
.size(), page_name
);
368 ErrorDynamicPages
.push_back(info
);
375 /// \ingroup ErrorPageInternal
377 errorPageName(int pageId
)
379 if (pageId
>= ERR_NONE
&& pageId
< ERR_MAX
) /* common case */
380 return err_type_str
[pageId
];
382 if (pageId
>= ERR_MAX
&& pageId
- ERR_MAX
< (ssize_t
)ErrorDynamicPages
.size())
383 return ErrorDynamicPages
.items
[pageId
- ERR_MAX
]->page_name
;
385 return "ERR_UNKNOWN"; /* should not happen */
389 errorCon(err_type type
, http_status status
, HttpRequest
* request
)
391 ErrorState
*err
= new ErrorState
;
392 err
->page_id
= type
; /* has to be reset manually if needed */
393 err
->err_language
= NULL
;
395 err
->httpStatus
= status
;
397 if (request
!= NULL
) {
398 err
->request
= HTTPMSGLOCK(request
);
399 err
->src_addr
= request
->client_addr
;
406 errorAppendEntry(StoreEntry
* entry
, ErrorState
* err
)
408 assert(entry
->mem_obj
!= NULL
);
409 assert (entry
->isEmpty());
410 debugs(4, 4, "Creating an error page for entry " << entry
<<
411 " with errorstate " << err
<<
412 " page id " << err
->page_id
);
414 if (entry
->store_status
!= STORE_PENDING
) {
415 debugs(4, 2, "Skipping error page due to store_status: " << entry
->store_status
);
417 * If the entry is not STORE_PENDING, then no clients
418 * care about it, and we don't need to generate an
421 assert(EBIT_TEST(entry
->flags
, ENTRY_ABORTED
));
422 assert(entry
->mem_obj
->nclients
== 0);
427 if (err
->page_id
== TCP_RESET
) {
429 debugs(4, 2, "RSTing this reply");
430 err
->request
->flags
.setResetTCP();
436 entry
->replaceHttpReply( err
->BuildHttpReply() );
437 EBIT_CLR(entry
->flags
, ENTRY_FWD_HDR_WAIT
);
440 entry
->negativeCache();
441 entry
->releaseRequest();
447 errorSend(int fd
, ErrorState
* err
)
450 debugs(4, 3, "errorSend: FD " << fd
<< ", err=" << err
);
453 * ugh, this is how we make sure error codes get back to
454 * the client side for logging and error tracking.
458 err
->request
->errType
= err
->type
;
460 /* moved in front of errorBuildBuf @?@ */
461 err
->flags
.flag_cbdata
= 1;
463 rep
= err
->BuildHttpReply();
465 comm_write_mbuf(fd
, rep
->pack(), errorSendComplete
, err
);
471 \ingroup ErrorPageAPI
473 * Called by commHandleWrite() after data has been written
474 * to the client socket.
476 \note If there is a callback, the callback is responsible for
477 * closeing the FD, otherwise we do it ourseves.
480 errorSendComplete(int fd
, char *bufnotused
, size_t size
, comm_err_t errflag
, int xerrno
, void *data
)
482 ErrorState
*err
= static_cast<ErrorState
*>(data
);
483 debugs(4, 3, "errorSendComplete: FD " << fd
<< ", size=" << size
);
485 if (errflag
!= COMM_ERR_CLOSING
) {
487 debugs(4, 3, "errorSendComplete: callback");
488 err
->callback(fd
, err
->callback_data
, size
);
491 debugs(4, 3, "errorSendComplete: comm_close");
499 errorStateFree(ErrorState
* err
)
501 HTTPMSGUNLOCK(err
->request
);
502 safe_free(err
->redirect_url
);
504 safe_free(err
->dnsserver_msg
);
505 safe_free(err
->request_hdrs
);
506 wordlistDestroy(&err
->ftp
.server_msg
);
507 safe_free(err
->ftp
.request
);
508 safe_free(err
->ftp
.reply
);
509 AUTHUSERREQUESTUNLOCK(err
->auth_user_request
, "errstate");
510 safe_free(err
->err_msg
);
512 if(err
->err_language
!= Config
.errorDefaultLanguage
)
514 safe_free(err
->err_language
);
519 ErrorState::Dump(MemBuf
* mb
)
522 const char *p
= NULL
; /* takes priority over mb if set */
523 char ntoabuf
[MAX_IPSTRLEN
];
526 /* email subject line */
527 str
.Printf("CacheErrorInfo - %s", errorPageName(type
));
528 mb
->Printf("?subject=%s", rfc1738_escape_part(str
.buf
));
531 str
.Printf("CacheHost: %s\r\n", getMyHostname());
533 str
.Printf("ErrPage: %s\r\n", errorPageName(type
));
536 str
.Printf("Err: (%d) %s\r\n", xerrno
, strerror(xerrno
));
538 str
.Printf("Err: [none]\r\n");
541 if (auth_user_request
->denyMessage())
542 str
.Printf("Auth ErrMsg: %s\r\n", auth_user_request
->denyMessage());
545 str
.Printf("DNS Server ErrMsg: %s\r\n", dnsserver_msg
);
549 str
.Printf("TimeStamp: %s\r\n\r\n", mkrfc1123(squid_curtime
));
552 str
.Printf("ClientIP: %s\r\n", src_addr
.NtoA(ntoabuf
,MAX_IPSTRLEN
));
554 if (request
&& request
->hier
.host
) {
555 str
.Printf("ServerIP: %s\r\n", request
->hier
.host
);
560 str
.Printf("HTTP Request:\r\n");
562 if (NULL
!= request
) {
564 str
.Printf("%s %s HTTP/%d.%d\n",
565 RequestMethodStr(request
->method
),
566 request
->urlpath
.size() ? request
->urlpath
.buf() : "/",
567 request
->http_ver
.major
, request
->http_ver
.minor
);
568 packerToMemInit(&p
, &str
);
569 request
->header
.packInto(&p
);
571 } else if (request_hdrs
) {
581 str
.Printf("FTP Request: %s\r\n", ftp
.request
);
582 str
.Printf("FTP Reply: %s\r\n", ftp
.reply
);
583 str
.Printf("FTP Msg: ");
584 wordlistCat(ftp
.server_msg
, &str
);
589 mb
->Printf("&body=%s", rfc1738_escape_part(str
.buf
));
594 /// \ingroup ErrorPageInternal
595 #define CVT_BUF_SZ 512
598 ErrorState::Convert(char token
)
601 const char *p
= NULL
; /* takes priority over mb if set */
603 char ntoabuf
[MAX_IPSTRLEN
];
611 if (request
&& request
->auth_user_request
)
612 p
= request
->auth_user_request
->username();
620 p
= request
? ftpUrlWith2f(request
) : "[no URL]";
625 p
= errorPageName(type
);
630 mb
.Printf("%d", xerrno
);
637 mb
.Printf("(%d) %s", xerrno
, strerror(xerrno
));
639 mb
.Printf("[No Error]");
644 /* FTP REQUEST LINE */
662 /* FTP SERVER MESSAGE */
663 wordlistCat(ftp
.server_msg
, &mb
);
668 mb
.Printf("%s", getMyHostname());
674 if (request
->hier
.host
)
675 p
= request
->hier
.host
;
677 p
= request
->GetHost();
679 p
= "[unknown host]";
684 mb
.Printf("%s", src_addr
.NtoA(ntoabuf
,MAX_IPSTRLEN
));
689 if (request
&& request
->hier
.host
) {
690 mb
.Printf("%s", request
->hier
.host
);
697 mb
.append(error_stylesheet
.content(), error_stylesheet
.contentSize());
702 if (Config
.errHtmlText
) {
703 mb
.Printf("%s", Config
.errHtmlText
);
706 p
= "[not available]";
711 p
= auth_user_request
->denyMessage("[not available]");
716 p
= request
? RequestMethodStr(request
->method
) : "[unknown method]";
721 p
= external_acl_message
? external_acl_message
: "[not available]";
727 mb
.Printf("%d", (int) request
->port
);
729 p
= "[unknown port]";
735 p
= request
? ProtocolStr
[request
->protocol
] : "[unknown protocol]";
740 if (NULL
!= request
) {
742 mb
.Printf("%s %s HTTP/%d.%d\n",
743 RequestMethodStr(request
->method
),
744 request
->urlpath
.size() ? request
->urlpath
.buf() : "/",
745 request
->http_ver
.major
, request
->http_ver
.minor
);
746 packerToMemInit(&p
, &mb
);
747 request
->header
.packInto(&p
);
749 } else if (request_hdrs
) {
758 p
= visible_appname_string
;
762 /* signature may contain %-escapes, recursion */
764 if (page_id
!= ERR_SQUID_SIGNATURE
) {
765 const int saved_id
= page_id
;
766 page_id
= ERR_SQUID_SIGNATURE
;
767 MemBuf
*sign_mb
= BuildContent();
768 mb
.Printf("%s", sign_mb
->content());
774 /* wow, somebody put %S into ERR_SIGNATURE, stop recursion */
781 mb
.Printf("%s", mkhttpdlogtime(&squid_curtime
));
785 mb
.Printf("%s", mkrfc1123(squid_curtime
));
789 p
= request
? urlCanonicalClean(request
) : url
? url
: "[no URL]";
793 p
= request
? urlCanonical(request
) : url
? url
: "[no URL]";
798 if (Config
.adminEmail
)
799 mb
.Printf("%s", Config
.adminEmail
);
806 if (Config
.adminEmail
&& Config
.onoff
.emailErrData
)
833 mb
.Printf("%%%c", token
);
841 p
= mb
.buf
; /* do not use mb after this assignment! */
845 debugs(4, 3, "errorConvert: %%" << token
<< " --> '" << p
<< "'" );
854 ErrorState::BuildHttpReply()
856 HttpReply
*rep
= new HttpReply
;
857 const char *name
= errorPageName(page_id
);
858 /* no LMT for error pages; error pages expire immediately */
859 HttpVersion
version(1, 0);
861 if (strchr(name
, ':')) {
863 rep
->setHeaders(version
, HTTP_MOVED_TEMPORARILY
, NULL
, "text/html", 0, 0, squid_curtime
);
866 char *quoted_url
= rfc1738_escape_part(urlCanonical(request
));
867 httpHeaderPutStrf(&rep
->header
, HDR_LOCATION
, name
, quoted_url
);
870 httpHeaderPutStrf(&rep
->header
, HDR_X_SQUID_ERROR
, "%d %s", httpStatus
, "Access Denied");
872 MemBuf
*content
= BuildContent();
873 rep
->setHeaders(version
, httpStatus
, NULL
, "text/html", content
->contentSize(), 0, squid_curtime
);
875 * include some information for downstream caches. Implicit
876 * replaceable content. This isn't quite sufficient. xerrno is not
877 * necessarily meaningful to another system, so we really should
878 * expand it. Additionally, we should identify ourselves. Someone
879 * might want to know. Someone _will_ want to know OTOH, the first
880 * X-CACHE-MISS entry should tell us who.
882 httpHeaderPutStrf(&rep
->header
, HDR_X_SQUID_ERROR
, "%s %d", name
, xerrno
);
886 * If error page auto-negotiate is enabled in any way, send the Vary.
887 * RFC 2616 section 13.6 and 14.44 says MAY and SHOULD do this.
888 * We have even better reasons though:
889 * see http://wiki.squid-cache.org/KnowledgeBase/VaryNotCaching
891 if(!Config
.errorDirectory
) {
892 /* We 'negotiated' this ONLY from the Accept-Language. */
893 httpHeaderDelById(&rep
->header
, HDR_VARY
);
894 httpHeaderPutStrf(&rep
->header
, HDR_VARY
, "Accept-Language");
897 /* add the Content-Language header according to RFC section 14.12 */
899 httpHeaderPutStrf(&rep
->header
, HDR_CONTENT_LANGUAGE
, "%s", err_language
);
902 #endif /* USE_ERROR_LOCALES */
904 /* default templates are in English */
905 /* language is known unless error_directory override used */
906 if(!Config
.errorDirectory
)
907 httpHeaderPutStrf(&rep
->header
, HDR_CONTENT_LANGUAGE
, "en");
910 httpBodySet(&rep
->body
, content
);
911 /* do not memBufClean() or delete the content, it was absorbed by httpBody */
918 ErrorState::BuildContent()
920 MemBuf
*content
= new MemBuf
;
921 const char *m
= NULL
;
925 assert(page_id
> ERR_NONE
&& page_id
< error_page_count
);
932 /** error_directory option in squid.conf overrides translations.
933 * Otherwise locate the Accept-Language header
935 if(!Config
.errorDirectory
&& request
->header
.getList(HDR_ACCEPT_LANGUAGE
, &hdr
) ) {
937 const char *buf
= hdr
.buf(); // raw header string for parsing
938 int pos
= 0; // current parsing position in header string
939 char *reset
= NULL
; // where to reset the p pointer for each new tag file
942 /* prep the directory path string to prevent snprintf ... */
943 l
= strlen(DEFAULT_SQUID_ERROR_DIR
);
944 memcpy(dir
, DEFAULT_SQUID_ERROR_DIR
, l
);
946 reset
= dt
= dir
+ l
;
948 debugs(4, 6, HERE
<< "Testing Header: '" << hdr
<< "'");
950 while( pos
< hdr
.size() ) {
953 * Header value format:
954 * - sequence of whitespace delimited tags
955 * - each tag may suffix with ';'.* which we can ignore.
956 * - IFF a tag contains only two characters we can wildcard ANY translations matching: <it> '-'? .*
957 * with preference given to an exact match.
959 while(pos
< hdr
.size() && buf
[pos
] != ';' && buf
[pos
] != ',' && !xisspace(buf
[pos
]) && dt
< (dir
+256) ) {
960 *dt
++ = xtolower(buf
[pos
++]);
962 *dt
++ = '\0'; // nul-terminated the filename content string before system use.
964 debugs(4, 9, HERE
<< "STATE: dt='" << dt
<< "', reset='" << reset
<< "', reset[1]='" << reset
[1] << "', pos=" << pos
<< ", buf='" << &buf
[pos
] << "'");
966 /* if we found anything we might use, try it. */
969 debugs(4, 6, HERE
<< "Found language '" << reset
<< "', testing for available template in: '" << dir
<< "'");
970 m
= errorTryLoadText( err_type_str
[page_id
], dir
, false);
973 /* store the language we found for the Content-Language reply header */
974 err_language
= xstrdup(reset
);
977 else if(Config
.errorLogMissingLanguages
) {
978 debugs(4, DBG_IMPORTANT
, "WARNING: Error Pages Missing Language: " << reset
);
982 if( (dt
- reset
) == 2) {
983 /* TODO glob the error directory for sub-dirs matching: <tag> '-*' */
984 /* use first result. */
985 debugs(4,2, HERE
<< "wildcard fallback errors not coded yet.");
990 dt
= reset
; // reset for next tag testing. we replace the failed name instead of cloning.
992 // IFF we terminated the tag on ';' we need to skip the 'q=' bit to the next ',' or end.
993 while(pos
< hdr
.size() && buf
[pos
] != ',') pos
++;
994 if(buf
[pos
] == ',') pos
++;
997 #endif /* USE_ERR_LOCALES */
1000 * If client-specific error templates are not enabled or available.
1001 * fall back to the old style squid.conf settings.
1004 m
= error_text
[page_id
];
1006 if(!Config
.errorDirectory
)
1007 err_language
= Config
.errorDefaultLanguage
;
1009 debugs(4, 2, HERE
<< "No existing error page language negotiated for " << errorPageName(page_id
) << ". Using default error file.");
1015 while ((p
= strchr(m
, '%'))) {
1016 content
->append(m
, p
- m
); /* copy */
1017 t
= Convert(*++p
); /* convert */
1018 content
->Printf("%s", t
); /* copy */
1019 m
= p
+ 1; /* advance */
1023 content
->Printf("%s", m
); /* copy tail */
1025 assert((size_t)content
->contentSize() == strlen(content
->content()));