diff options
author | Mukund Sivaraman <muks@banu.com> | 2008-07-14 15:47:00 +0530 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2008-07-14 15:47:00 +0530 |
commit | 7bdd47d030d4cc27e319edf6030e161f25e1a299 (patch) | |
tree | df5e933b4dcfbbfbee028664715c4c30477035b1 | |
parent | 7b9e178a76cb21cb644276eb4e0a08f7514017aa (diff) | |
download | tinyproxy-7bdd47d030d4cc27e319edf6030e161f25e1a299.tar.gz tinyproxy-7bdd47d030d4cc27e319edf6030e161f25e1a299.zip |
Make the embedded error message display valid XHTML too
Also fix the information that is displayed.
Diffstat (limited to '')
-rw-r--r-- | src/html-error.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/html-error.c b/src/html-error.c index 860e424..c6b580e 100644 --- a/src/html-error.c +++ b/src/html-error.c @@ -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); |