diff --git a/.gitignore b/.gitignore
index 9a94bf6..de23681 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
*
!src
!src/**
+!res
+!res/**
!doc
!doc/**
!test
diff --git a/Makefile b/Makefile
index b9439a0..8e0d9e3 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ DEBIAN_OPTS=-D CACHE_MAGIC_FILE="\"/usr/share/file/magic.mgc\"" -D PHP_FPM_SOCKE
.PHONY: all prod debug default debian permit clean test
all: prod
-default: bin bin/lib bin/worker bin/sesimos
+default: bin bin/lib bin/worker bin/res bin/sesimos
prod: CFLAGS += -O3
prod: default
@@ -32,6 +32,9 @@ bin/lib:
bin/worker:
mkdir -p bin/worker
+bin/res:
+ mkdir -p bin/res
+
bin/test: test/mock_*.c test/test_*.c src/lib/utils.c src/lib/sock.c
$(CC) -o $@ $(CFLAGS) $^ -lcriterion
@@ -45,11 +48,19 @@ bin/lib/%.o: src/lib/%.c
bin/worker/%.o: src/worker/%.c
$(CC) -c -o $@ $(CFLAGS) $<
+bin/res/%.o: bin/res/%.txt
+ objcopy -I binary --rename-section .data=.rodata -O elf64-x86-64 $^ $@
+
+bin/res/%.txt: res/%.*
+ cp $^ $@
+ echo -ne "\x00" >> $@
+
bin/sesimos: bin/server.o bin/logger.o bin/cache_handler.o bin/async.o bin/workers.o \
bin/worker/request_handler.o bin/worker/tcp_acceptor.o \
bin/worker/fastcgi_handler.o bin/worker/local_handler.o bin/worker/proxy_handler.o \
+ bin/lib/http_static.o bin/res/default.o bin/res/proxy.o bin/res/style.o \
bin/lib/compress.o bin/lib/config.o bin/lib/fastcgi.o bin/lib/geoip.o \
- bin/lib/http.o bin/lib/http_static.o bin/lib/proxy.o bin/lib/sock.o bin/lib/uri.o \
+ bin/lib/http.o bin/lib/proxy.o bin/lib/sock.o bin/lib/uri.o \
bin/lib/utils.o bin/lib/websocket.o bin/lib/mpmc.o
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
diff --git a/res/default.html b/res/default.html
new file mode 100644
index 0000000..4f4f21f
--- /dev/null
+++ b/res/default.html
@@ -0,0 +1,21 @@
+
+
+
+ %1$i %2$s - %7$s
+
+
+
+
+
+
+
+%5$s
+
+
+
+
+%8$s
+
+
diff --git a/res/proxy.html b/res/proxy.html
new file mode 100644
index 0000000..1ed6a86
--- /dev/null
+++ b/res/proxy.html
@@ -0,0 +1,31 @@
+
+
+
+
Client
+

+
Your Browser
+
+
+
+
+
+
+ Reverse Proxy
+
%10$03i
+ %11$s
+ %15$s
+
+
+
+
+
+
+
+ Server
+
%12$s
+ %13$s
+ %14$s
+
+
+
+
diff --git a/res/style.css b/res/style.css
new file mode 100644
index 0000000..4ded22a
--- /dev/null
+++ b/res/style.css
@@ -0,0 +1,66 @@
+html{
+ font-family:"Arial",sans-serif;
+ --error:#C00000;
+ --warning:#E0C000;
+ --success:#008000;
+ --info:#606060;
+ --soft:#808080;
+}
+
+body{background-color:#F0F0F0;margin:0;}
+main{max-width:650px;margin:2em auto;}
+section{margin:2em 1em;background-color:#FFFFFF;border: 1px solid var(--color);border-radius:4px;padding:1em;}
+h1,h2,h3,h4,h5,h6{text-align:center;color:var(--color);font-weight:normal;}
+h1{font-size:3em;margin:0.125em 0;}
+h2{font-size:1.5em;margin:0.25em 0 1em 0;}
+p{text-align:center;font-size:0.875em;}
+div.footer{color:var(--soft);font-size:0.75em;text-align:center;margin:2em 0 0.5em 0;}
+div.footer a{color:var(--soft);}
+ul,ol{width:fit-content;margin:auto;}
+pre{width:fit-content;margin:2em auto 0 auto;}
+
+section.error-ctx{display:flex;padding:0;border:none;}
+div.box{flex:100% 1 1;border:1px solid var(--info);color:var(--info);position:relative;padding:1em;box-sizing:border-box;text-align:center;}
+div.box.error{border-color:var(--error);color:var(--error);}
+div.box.success{border-color:var(--success);color:var(--success);}
+div.arrow{position:absolute;height:20px;width:30px;z-index:10;background-repeat:no-repeat;background-size:contain;}
+div.arrow.response{left:-17.5px;bottom:calc(33.3333% - 10px);}
+div.arrow.request{right:-17.5px;top:calc(33.3333% - 10px);}
+div.border{flex:1px 0 0;background-color:var(--info);}
+div.border.error{background-color:var(--error);}
+div.border.success{background-color:var(--success);}
+div.content>span{display:block;color:var(--soft);font-size:0.75em;}
+div.content>img{height:3.75rem;margin:0.75rem auto;display:block;}
+h3{font-size:2.25em;margin:0.75rem 0 0 0;color:unset;height:2.5rem;}
+h4{font-size:1em;margin:0 0 0.75rem 0;color:unset;height:1.25rem;}
+
+div.arrow.request.success{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEsMSBMMjUsMSBMMjksMTAgTDI1LDE5IEwxLDE5IiBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiMwMDgwMDAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPgo=');}
+div.arrow.request.error{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEsMSBMMjUsMSBMMjksMTAgTDI1LDE5IEwxLDE5IiBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNDMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPgo=');}
+div.arrow.response.success{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTI5LDE5IEw1LDE5IEwxLDEwIEw1LDEgTDI5LDEiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZT0iIzAwODAwMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+Cg==');}
+div.arrow.response.error{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTI5LDE5IEw1LDE5IEwxLDEwIEw1LDEgTDI5LDEiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZT0iI0MwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+Cg==');}
+
+@media(prefers-color-scheme:dark){
+ html{color:#FFFFFF;--soft:#404040;}
+ body{background-color:#101010;}
+ section{background-color:#181818;}
+
+ div.arrow.request.success{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEsMSBMMjUsMSBMMjksMTAgTDI1LDE5IEwxLDE5IiBmaWxsPSIjMTgxODE4IiBzdHJva2U9IiMwMDgwMDAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPgo=');}
+ div.arrow.request.error{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEsMSBMMjUsMSBMMjksMTAgTDI1LDE5IEwxLDE5IiBmaWxsPSIjMTgxODE4IiBzdHJva2U9IiNDMDAwMDAiIHN0cm9rZS13aWR0aD0iMiIvPjwvc3ZnPgo=');}
+ div.arrow.response.success{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTI5LDE5IEw1LDE5IEwxLDEwIEw1LDEgTDI5LDEiIGZpbGw9IiMxODE4MTgiIHN0cm9rZT0iIzAwODAwMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+Cg==');}
+ div.arrow.response.error{background-image:url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTI5LDE5IEw1LDE5IEwxLDEwIEw1LDEgTDI5LDEiIGZpbGw9IiMxODE4MTgiIHN0cm9rZT0iI0MwMDAwMCIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+Cg==');}
+}
+
+@media(min-width:650px){
+ div.box:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px;border-right:none;}
+ div.box:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;border-left:none;}
+ div.box:not(:last-child):not(:first-child){border-left:none;border-right:none;}
+}
+
+@media(max-width:650px){
+ section.error-ctx{flex-direction:column;height:unset;}
+ div.box:first-child{border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none;padding-top:1em;}
+ div.box:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none;padding-bottom:1em;}
+ div.box:not(:last-child):not(:first-child){border-top:none;border-bottom:none;}
+ div.arrow.response{transform:rotate(90deg);top:-10px;left:calc(33.3333% - 22.5px);right:unset;}
+ div.arrow.request{transform:rotate(90deg);bottom:-10px;right:calc(33.3333% - 22.5px);top:unset;}
+}
diff --git a/src/lib/http.c b/src/lib/http.c
index e30e19c..8d92600 100644
--- a/src/lib/http.c
+++ b/src/lib/http.c
@@ -370,7 +370,7 @@ int http_send_request(sock *server, http_req *req) {
}
const http_status *http_get_status(unsigned short status_code) {
- for (int i = 0; i < http_statuses_size / sizeof(http_status); i++) {
+ for (int i = 0; i < http_statuses_size; i++) {
if (http_statuses[i].code == status_code) {
return &http_statuses[i];
}
@@ -380,7 +380,7 @@ const http_status *http_get_status(unsigned short status_code) {
const http_status_msg *http_get_error_msg(const http_status *status) {
unsigned short code = status->code;
- for (int i = 0; i < http_status_messages_size / sizeof(http_status_msg); i++) {
+ for (int i = 0; i < http_status_messages_size; i++) {
if (http_status_messages[i].code == code) {
return &http_status_messages[i];
}
@@ -419,10 +419,10 @@ char *http_get_date(char *buf, size_t size) {
const http_doc_info *http_get_status_info(const http_status *status) {
unsigned short code = status->code;
static http_doc_info info[] = {
- {"info", HTTP_COLOR_INFO, http_info_icon, http_info_document},
- {"success", HTTP_COLOR_SUCCESS, http_success_icon, http_success_document},
- {"warning", HTTP_COLOR_WARNING, http_warning_icon, http_warning_document},
- {"error", HTTP_COLOR_ERROR, http_error_icon, http_error_document}
+ {"info", HTTP_COLOR_INFO, http_info_icon, http_info_doc},
+ {"success", HTTP_COLOR_SUCCESS, http_success_icon, http_success_doc},
+ {"warning", HTTP_COLOR_WARNING, http_warning_icon, http_warning_doc},
+ {"error", HTTP_COLOR_ERROR, http_error_icon, http_error_doc}
};
if (code >= 100 && code < 200) {
return &info[0];
diff --git a/src/lib/http.h b/src/lib/http.h
index 9099211..a5d9802 100644
--- a/src/lib/http.h
+++ b/src/lib/http.h
@@ -32,9 +32,9 @@
#define HTTP_5XX_STR "\x1B[1;31m"
#define HTTP_COLOR_SUCCESS "#008000"
-#define HTTP_COLOR_INFO "#606060"
+#define HTTP_COLOR_INFO "#606060"
#define HTTP_COLOR_WARNING "#E0C000"
-#define HTTP_COLOR_ERROR "#C00000"
+#define HTTP_COLOR_ERROR "#C00000"
#define CLIENT_MAX_HEADER_SIZE 8192
#define HTTP_MAX_HEADER_FIELD_NUM 64
@@ -117,16 +117,10 @@ extern const http_status_msg http_status_messages[];
extern const int http_statuses_size;
extern const int http_status_messages_size;
-extern const char http_default_document[];
-extern const char http_proxy_document[];
-extern const char http_error_document[];
-extern const char http_error_icon[];
-extern const char http_warning_document[];
-extern const char http_warning_icon[];
-extern const char http_success_document[];
-extern const char http_success_icon[];
-extern const char http_info_document[];
-extern const char http_info_icon[];
+extern const char http_error_doc[], http_error_icon[];
+extern const char http_warning_doc[], http_warning_icon[];
+extern const char http_success_doc[], http_success_icon[];
+extern const char http_info_doc[], http_info_icon[];
void http_to_camel_case(char *str, int mode);
diff --git a/src/lib/http_static.c b/src/lib/http_static.c
index a2928ea..84dd6fe 100644
--- a/src/lib/http_static.c
+++ b/src/lib/http_static.c
@@ -6,10 +6,8 @@
* @date 2021-05-03
*/
-#include "../defs.h"
#include "http.h"
-
const http_status http_statuses[] = {
{100, "Informational", "Continue"},
{101, "Informational", "Switching Protocols"},
@@ -105,201 +103,56 @@ const http_status_msg http_status_messages[] = {
{505, "The server does not support, or refuses to support, the HTTP protocol version that was used in the request message."}
};
-const char http_default_document[] =
- "\n"
- "\n"
- "\n"
- "\t%1$i %2$s - %7$s\n"
- "\t\n"
- "\t\n"
- "\t\n"
- "\t\n"
- "\t\n"
- "\t\n"
- "%5$s"
- "\t\n"
- "\n"
- "\n"
- "\t\n"
- "\t\t\n"
- "%3$s"
- "%9$s"
- "\t\t\t\n"
- "\t\t\n"
- "%8$s"
- "\t\n"
- "\n"
- "\n";
+const int http_statuses_size = sizeof(http_statuses) / sizeof(http_status);
+const int http_status_messages_size = sizeof(http_status_messages) / sizeof(http_status_msg);
-const char http_proxy_document[] =
- "\t\t\n"
- "\t\t\t\n"
- "\t\t\t\t
\n"
- "\t\t\t\t\t
Client\n"
- "\t\t\t\t\t

\n"
- "\t\t\t\t\t
Your Browser\n"
- "\t\t\t\t
\n"
- "\t\t\t\t
\n"
- "\t\t\t
\n"
- "\t\t\t\n"
- "\t\t\t\n"
- "\t\t\t\t
\n"
- "\t\t\t\t\tReverse Proxy\n"
- "\t\t\t\t\t
%10$03i
\n"
- "\t\t\t\t\t%11$s
\n"
- "\t\t\t\t\t" SERVER_NAME "\n"
- "\t\t\t\t\n"
- "\t\t\t\t
\n"
- "\t\t\t\t
\n"
- "\t\t\t
\n"
- "\t\t\t\n"
- "\t\t\t\n"
- "\t\t\t\t
\n"
- "\t\t\t\t\tServer\n"
- "\t\t\t\t\t
%12$s
\n"
- "\t\t\t\t\t%13$s
\n"
- "\t\t\t\t\t%14$s\n"
- "\t\t\t\t\n"
- "\t\t\t\t
\n"
- "\t\t\t
\n"
- "\t\t\n";
-
-const char http_error_document[] =
- "\t\t\t%1$i
\n"
- "\t\t\t%2$s :(
\n"
- "\t\t\t%3$s
\n"
- "\t\t\t%4$s
\n";
+const char http_error_doc[] =
+ " %1$i
\n"
+ " %2$s :(
\n"
+ " %3$s
\n"
+ " %4$s
\n";
const char http_error_icon[] =
- "\t\n";
-const char http_warning_document[] =
- "\t\t\t%1$i
\n"
- "\t\t\t%2$s :)
\n"
- "\t\t\t%3$s
\n"
- "\t\t\t%4$s
\n";
+const char http_warning_doc[] =
+ " %1$i
\n"
+ " %2$s :)
\n"
+ " %3$s
\n"
+ " %4$s
\n";
const char http_warning_icon[] =
- "\t\n";
-const char http_success_document[] =
- "\t\t\t%1$i
\n"
- "\t\t\t%2$s :)
\n"
- "\t\t\t%3$s
\n"
- "\t\t\t%4$s
\n";
+const char http_success_doc[] =
+ " %1$i
\n"
+ " %2$s :)
\n"
+ " %3$s
\n"
+ " %4$s
\n";
const char http_success_icon[] =
- "\t\n";
-const char http_info_document[] =
- "\t\t\t%1$i
\n"
- "\t\t\t%2$s :)
\n"
- "\t\t\t%3$s
\n"
- "\t\t\t%4$s
\n";
+const char http_info_doc[] =
+ " %1$i
\n"
+ " %2$s :)
\n"
+ " %3$s
\n"
+ " %4$s
\n";
const char http_info_icon[] =
- "\t\n";
-
-const int http_statuses_size = sizeof(http_statuses);
-const int http_status_messages_size = sizeof(http_status_messages);
diff --git a/src/lib/res.h b/src/lib/res.h
new file mode 100644
index 0000000..1bac5bf
--- /dev/null
+++ b/src/lib/res.h
@@ -0,0 +1,28 @@
+/**
+ * sesimos - secure, simple, modern web server
+ * @brief HTTP resources (header file)
+ * @file src/lib/res.h
+ * @author Lorenz Stechauner
+ * @date 2022-12-31
+ */
+
+#ifndef SESIMOS_RES_H
+#define SESIMOS_RES_H
+
+#define http_default_doc _binary_bin_res_default_txt_start
+#define http_default_doc_size ((unsigned int) (_binary_bin_res_default_txt_end - _binary_bin_res_default_txt_start) - 1)
+#define http_proxy_doc _binary_bin_res_proxy_txt_start
+#define http_proxy_doc_size ((unsigned int) (_binary_bin_res_proxy_txt_end - _binary_bin_res_proxy_txt_start) - 1)
+#define http_style_doc _binary_bin_res_style_txt_start
+#define http_style_doc_size ((unsigned int) (_binary_bin_res_style_txt_end - _binary_bin_res_style_txt_start) - 1)
+
+extern const char _binary_bin_res_default_txt_start[];
+extern const char _binary_bin_res_default_txt_end[];
+
+extern const char _binary_bin_res_proxy_txt_start[];
+extern const char _binary_bin_res_proxy_txt_end[];
+
+extern const char _binary_bin_res_style_txt_start[];
+extern const char _binary_bin_res_style_txt_end[];
+
+#endif //SESIMOS_RES_H
diff --git a/src/worker/request_handler.c b/src/worker/request_handler.c
index 33145d5..8465b64 100644
--- a/src/worker/request_handler.c
+++ b/src/worker/request_handler.c
@@ -14,6 +14,7 @@
#include "../lib/utils.h"
#include "../lib/websocket.h"
#include "../server.h"
+#include "../lib/res.h"
#include
#include
@@ -128,6 +129,15 @@ static int request_handler(client_ctx_t *ctx) {
logger_set_prefix("[%s%*s%s]%s", BLD_STR, INET6_ADDRSTRLEN, ctx->req_host, CLR_STR, ctx->log_prefix);
info(BLD_STR "%s %s", req->method, req->uri);
+ if (strcmp(req->uri, "/.sesimos/style.css") == 0 && (strcmp(req->method, "GET") == 0 || strcmp(req->method, "HEAD") == 0)) {
+ memcpy(ctx->msg_buf, http_style_doc, http_style_doc_size);
+ ctx->content_length = http_style_doc_size;
+ res->status= http_get_status(200);
+ http_add_header_field(&res->hdr, "Content-Type", "text/css; charset=UTF-8");
+ http_add_header_field(&res->hdr, "Cache-Control", "public, max-age=3600");
+ return 0;
+ }
+
ctx->conf = get_host_config(ctx->req_host);
if (ctx->conf == NULL) {
info("Unknown host, redirecting to default");
@@ -228,14 +238,14 @@ int respond(client_ctx_t *ctx) {
http_add_header_field(&res->hdr, "Content-Type", "text/html; charset=UTF-8");
// TODO list Locations on 3xx Redirects
- const http_doc_info *info = http_get_status_info(res->status);
+ const http_doc_info *http_info = http_get_status_info(res->status);
const http_status_msg *http_msg = http_get_error_msg(res->status);
if (ctx->msg_content[0] == 0) {
if (res->status->code >= 300 && res->status->code < 400) {
const char *location = http_get_header_field(&res->hdr, "Location");
if (location != NULL) {
- snprintf(ctx->msg_content, sizeof(ctx->msg_content), "\n", location, location);
+ snprintf(ctx->msg_content, sizeof(ctx->msg_content), " \n", location, location);
}
}
} else if (strncmp(ctx->msg_content, "", 15) == 0 || strncmp(ctx->msg_content, "status);
char stat_str[8];
sprintf(stat_str, "%03i", status->status);
- sprintf(msg_pre_buf_2, http_proxy_document,
+ snprintf(msg_pre_buf_2, sizeof(msg_pre_buf_2), http_proxy_doc,
" success",
(status->origin == CLIENT_REQ) ? " error" : " success",
- (status->origin == INTERNAL) ? " error" : " success",
+ (status->origin == INTERNAL) ? " error" : " success",
(status->origin == SERVER_REQ) ? " error" : (status->status == 0 ? "" : " success"),
(status->origin == CLIENT_RES) ? " error" : " success",
- (status->origin == SERVER) ? " error" : (status->status == 0 ? "" : " success"),
+ (status->origin == SERVER) ? " error" : (status->status == 0 ? "" : " success"),
(status->origin == SERVER_RES) ? " error" : (status->status == 0 ? "" : " success"),
- (status->origin == INTERNAL) ? " error" : " success",
+ (status->origin == INTERNAL) ? " error" : " success",
(status->origin == INTERNAL || status->origin == SERVER) ? " error" : " success",
res->status->code,
res->status->msg,
(status->status == 0) ? "???" : stat_str,
(status_hdr != NULL) ? status_hdr->msg : "",
- ctx->req_host);
+ ctx->req_host, SERVER_NAME);
proxy_doc = msg_pre_buf_2;
}
- sprintf(msg_pre_buf_1, info->doc, res->status->code, res->status->msg, http_msg != NULL ? http_msg->msg : "", err_msg[0] != 0 ? err_msg : "");
- ctx->content_length = snprintf(ctx->msg_buf, sizeof(ctx->msg_buf), http_default_document, res->status->code,
- res->status->msg, msg_pre_buf_1, info->mode, info->icon, info->color, ctx->req_host,
- proxy_doc, ctx->msg_content[0] != 0 ? ctx->msg_content : "");
+ snprintf(msg_pre_buf_1, sizeof(msg_pre_buf_1), http_info->doc,
+ res->status->code, res->status->msg, http_msg != NULL ? http_msg->msg : "", err_msg[0] != 0 ? err_msg : "");
+ ctx->content_length = snprintf(ctx->msg_buf, sizeof(ctx->msg_buf), http_default_doc, res->status->code,
+ res->status->msg, msg_pre_buf_1, http_info->mode, http_info->icon, http_info->color, ctx->req_host,
+ proxy_doc, ctx->msg_content[0] != 0 ? ctx->msg_content : "", SERVER_STR_HTML);
}
if (ctx->content_length >= 0) {
sprintf(buf0, "%li", ctx->content_length);