mirror of
https://github.com/kakwa/uts-server
synced 2024-12-04 23:15:54 +01:00
Added lang to html.
Lazy calculation of static page size.
This commit is contained in:
parent
4c5e5b8251
commit
9b49e5578f
@ -1,6 +1,6 @@
|
||||
const char *content_static_page = \
|
||||
"<!DOCTYPE html>" \
|
||||
"<html>" \
|
||||
"<html lang=\"en\">" \
|
||||
"<head>" \
|
||||
" <meta charset=\"utf-8\">" \
|
||||
" <title>uts-server</title>" \
|
||||
@ -45,7 +45,6 @@ const char *content_static_page =
|
||||
" border-radius: 2px;" \
|
||||
" padding: 10px 24px;" \
|
||||
" margin: 0 auto;" \
|
||||
" display: inline;" \
|
||||
" box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, " \
|
||||
"0, 0.19);" \
|
||||
" margin: 0 auto;" \
|
||||
@ -115,3 +114,5 @@ const char *content_static_page =
|
||||
"</div>" \
|
||||
"</body>" \
|
||||
"</html>";
|
||||
|
||||
int static_page_size = 0;
|
||||
|
@ -195,14 +195,16 @@ int rfc3161_handler(struct mg_connection *conn, void *context) {
|
||||
free(content);
|
||||
} else {
|
||||
// default reply if we don't have a time-stamp request
|
||||
content_length = strlen(content_static_page);
|
||||
if (static_page_size == 0) {
|
||||
static_page_size = strlen(content_static_page);
|
||||
}
|
||||
mg_printf(conn,
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Content-Type: text/html\r\n"
|
||||
"Content-Length: %d\r\n"
|
||||
"\r\n",
|
||||
(int)content_length);
|
||||
mg_write(conn, content_static_page, content_length);
|
||||
(int)static_page_size);
|
||||
mg_write(conn, content_static_page, static_page_size);
|
||||
}
|
||||
// initialize a serial_id if not created by create_response
|
||||
if (serial_id == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user