Refactored html error document

This commit is contained in:
2020-12-15 22:13:57 +01:00
parent a6789a7f3e
commit 14b4f71af7
2 changed files with 12 additions and 10 deletions

View File

@ -113,7 +113,7 @@ int client_request_handler(sock *client, int req_num) {
http_msg != NULL ? http_msg->err_msg : "", err_msg[0] != 0 ? err_msg : ""); http_msg != NULL ? http_msg->err_msg : "", err_msg[0] != 0 ? err_msg : "");
len = sprintf(msg_buf, http_default_document, res.status->code, res.status->msg, len = sprintf(msg_buf, http_default_document, res.status->code, res.status->msg,
msg_pre_buf, res.status->code >= 300 && res.status->code < 400 ? "info" : "error", msg_pre_buf, res.status->code >= 300 && res.status->code < 400 ? "info" : "error",
http_error_icon); http_error_icon, "#C00000");
sprintf(buf, "%li", len); sprintf(buf, "%li", len);
http_add_header_field(&res.hdr, "Content-Length", buf); http_add_header_field(&res.hdr, "Content-Length", buf);
http_add_header_field(&res.hdr, "Content-Type", "text/html; charset=UTF-8"); http_add_header_field(&res.hdr, "Content-Type", "text/html; charset=UTF-8");

View File

@ -117,6 +117,8 @@ const char *http_default_document =
"<head>\n" "<head>\n"
" <title>%1$i %2$s</title>\n" " <title>%1$i %2$s</title>\n"
" <meta charset=\"UTF-8\"/>\n" " <meta charset=\"UTF-8\"/>\n"
" <meta name=\"theme-color\" content=\"%6$s\"/>\n"
" <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"/>\n"
" <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\"/>\n" " <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\"/>\n"
"%5$s" "%5$s"
" <style>\n" " <style>\n"
@ -138,7 +140,7 @@ const char *http_default_document =
"</html>\n"; "</html>\n";
const char *http_error_document = const char *http_error_document =
" <h1>%1$i %2$s :(</h1>\n" " <h1>%1$i %2$s :&#xFEFF;(</h1>\n"
" <p>%3$s</p>\n" " <p>%3$s</p>\n"
" <p>%4$s</p>\n"; " <p>%4$s</p>\n";