Refactored html error document
This commit is contained in:
@ -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 : "");
|
||||
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",
|
||||
http_error_icon);
|
||||
http_error_icon, "#C00000");
|
||||
sprintf(buf, "%li", len);
|
||||
http_add_header_field(&res.hdr, "Content-Length", buf);
|
||||
http_add_header_field(&res.hdr, "Content-Type", "text/html; charset=UTF-8");
|
||||
|
20
src/http.h
20
src/http.h
@ -117,16 +117,18 @@ const char *http_default_document =
|
||||
"<head>\n"
|
||||
" <title>%1$i %2$s</title>\n"
|
||||
" <meta charset=\"UTF-8\"/>\n"
|
||||
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\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"
|
||||
"%5$s"
|
||||
" <style>\n"
|
||||
" html {font-family: \"Arial\", sans-serif; --error: #C00000; --info: #E0C000; --color: var(--%4$s);}\n"
|
||||
" body {background-color: #F0F0F0; margin: 0.5em;}\n"
|
||||
" main {max-width: 600px; margin: 2em auto; background-color: #FFFFFF; border: 1px solid var(--color); border-radius: 4px; padding: 1em 2em;}\n"
|
||||
" h1, h2, h3, h4, h5, h6, h7 {text-align: center;color: var(--color);}\n"
|
||||
" h1 {margin: 0.5em 0; font-size: 1.5em;}\n"
|
||||
" p {text-align: center;}\n"
|
||||
" div.footer {color: #808080; font-size: 0.75em; text-align: center; margin: 0.5em 0;}\n"
|
||||
" html{font-family:\"Arial\",sans-serif;--error:#C00000;--info:#E0C000;--color:var(--%4$s);}\n"
|
||||
" body{background-color:#F0F0F0;margin:0.5em;}\n"
|
||||
" main{max-width:600px;margin:2em auto;background-color:#FFFFFF;border: 1px solid var(--color);border-radius:4px;padding:1em 2em;}\n"
|
||||
" h1,h2,h3,h4,h5,h6,h7{text-align:center;color:var(--color);}\n"
|
||||
" h1{margin:0.5em 0;font-size:1.5em;}\n"
|
||||
" p{text-align:center;}\n"
|
||||
" div.footer{color:#808080;font-size:0.75em;text-align:center;margin:0.5em 0;}\n"
|
||||
" </style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
@ -138,7 +140,7 @@ const char *http_default_document =
|
||||
"</html>\n";
|
||||
|
||||
const char *http_error_document =
|
||||
" <h1>%1$i %2$s :(</h1>\n"
|
||||
" <h1>%1$i %2$s :(</h1>\n"
|
||||
" <p>%3$s</p>\n"
|
||||
" <p>%4$s</p>\n";
|
||||
|
||||
|
Reference in New Issue
Block a user