Update of Default error doc
This commit is contained in:
@ -102,6 +102,8 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
|
||||
client_keep_alive = hdr_connection != NULL && strcmp(hdr_connection, "keep-alive") == 0;
|
||||
host = http_get_header_field(&req.hdr, "Host");
|
||||
if (host == NULL || strchr(host, '/') != NULL) {
|
||||
// TODO fix IPv6 address in URL
|
||||
host = client_addr_str;
|
||||
res.status = http_get_status(400);
|
||||
sprintf(err_msg, "The client provided no or an invalid Host header field.");
|
||||
goto respond;
|
||||
@ -333,7 +335,7 @@ int client_request_handler(sock *client, unsigned long client_num, unsigned int
|
||||
http_msg != NULL ? http_msg->err_msg : "", err_msg[0] != 0 ? err_msg : "");
|
||||
content_length = 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, "#C00000");
|
||||
http_error_icon, "#C00000", host);
|
||||
http_add_header_field(&res.hdr, "Content-Type", "text/html; charset=UTF-8");
|
||||
}
|
||||
if (content_length >= 0) {
|
||||
|
@ -123,7 +123,7 @@ const char *http_default_document =
|
||||
"<!DOCTYPE html>\n"
|
||||
"<html lang=\"en\">\n"
|
||||
"<head>\n"
|
||||
" <title>%1$i %2$s</title>\n"
|
||||
" <title>%1$i %2$s - %7$s</title>\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"
|
||||
@ -137,12 +137,13 @@ const char *http_default_document =
|
||||
" 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"
|
||||
" div.footer a{color:#808080;}\n"
|
||||
" </style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
" <main>\n"
|
||||
"%3$s"
|
||||
" <div class=\"footer\">Necronda web server " NECRONDA_VERSION "</div>\n"
|
||||
" <div class=\"footer\"><a href=\"https://%7$s/\">%7$s</a> - Necronda web server " NECRONDA_VERSION "</div>\n"
|
||||
" </main>\n"
|
||||
"</body>\n"
|
||||
"</html>\n";
|
||||
|
Reference in New Issue
Block a user