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