updated format
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 12s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 12s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 12s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 12s
This commit is contained in:
1 parent
d6409140f1
commit
6c556624bd
23 files changed
+147
-113
No files matched your search
+6
-4
@@ -1,6 +1,7 @@
|
||||
#include <colors.h>
|
||||
#include <mongoose.h>
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "cors.h"
|
||||
#include "database.h"
|
||||
@@ -25,7 +26,7 @@ static const struct route routes[] = {
|
||||
|
||||
void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
if (ev == MG_EV_ERROR) {
|
||||
MG_LOG(MG_LL_ERROR, ("Ошибка соединения: %s", (char *) ev_data));
|
||||
MG_LOG(MG_LL_ERROR, ("Ошибка соединения: %s", (char *)ev_data));
|
||||
}
|
||||
const bool tls_enabled = cm_get_parameter_as_bool(config, "tls_enabled");
|
||||
if (tls_enabled) {
|
||||
@@ -40,7 +41,7 @@ void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
}
|
||||
}
|
||||
if (ev == MG_EV_HTTP_MSG) {
|
||||
const auto hm = (struct mg_http_message *) ev_data;
|
||||
const auto hm = (struct mg_http_message *)ev_data;
|
||||
bool route_found = false;
|
||||
|
||||
for (int i = 0; routes[i].path != nullptr; i++) {
|
||||
@@ -80,8 +81,9 @@ int main(void) {
|
||||
const char *tls_address = cm_get_parameter_as_string(config, "tls_address");
|
||||
char https_address[64];
|
||||
snprintf(https_address, sizeof(https_address), "https://%s", tls_address);
|
||||
tls_address ? mg_http_listen(&mgr, https_address, ev_handler, nullptr)
|
||||
: mg_http_listen(&mgr, "https://0.0.0.0:8223", ev_handler, nullptr);
|
||||
tls_address
|
||||
? mg_http_listen(&mgr, https_address, ev_handler, nullptr)
|
||||
: mg_http_listen(&mgr, "https://0.0.0.0:8223", ev_handler, nullptr);
|
||||
}
|
||||
for (;;) {
|
||||
mg_mgr_poll(&mgr, 1000);
|
||||
|
||||
Reference in new issue
Block a user