Make the embedded error message display valid XHTML too

Also fix the information that is displayed.
This commit is contained in:
Mukund Sivaraman 2008-07-14 15:47:00 +05:30
parent 7b9e178a76
commit 7bdd47d030

View File

@ -193,24 +193,31 @@ send_http_error_message(struct conn_s *connptr)
FILE *infile;
int ret;
char *fallback_error =
"<html><head><title>%s</title></head>"
"<body><blockquote><i>%s %s</i><br>"
"The page you requested was unavailable. The error code is listed "
"below. In addition, the HTML file which has been configured as the "
"page to be displayed when an error of this type was unavailable, "
"with the error code %d (%s). Please contact your administrator."
"<center>%s</center>" "</body></html>" "\r\n";
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
"<html>\n"
"<head><title>%d %s</title></head>\n"
"<body>\n"
"<h1>%s</h1>\n"
"<p>%s</p>\n"
"<hr />\n"
"<p><em>Generated by %s version %s.</em></p>\n"
"</body>\n"
"</html>\n";
send_http_headers(connptr, connptr->error_number,
connptr->error_string);
error_file = get_html_file(connptr->error_number);
if (!(infile = fopen(error_file, "r")))
if (!(infile = fopen(error_file, "r"))) {
char *detail = lookup_variable(connptr, "detail");
return (write_message(connptr->client_fd, fallback_error,
connptr->error_number,
connptr->error_string,
PACKAGE, VERSION,
errno, strerror(errno),
connptr->error_string));
connptr->error_string,
detail,
PACKAGE, VERSION));
}
ret = send_html_file(infile, connptr);
fclose(infile);