mirror of
https://github.com/simon987/sist2.git
synced 2025-04-10 14:06:45 +00:00
wip
This commit is contained in:
parent
cf513b4ad8
commit
5686bc864d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,3 +4,6 @@
|
||||
[submodule "third-party/argparse"]
|
||||
path = third-party/argparse
|
||||
url = https://github.com/cofyc/argparse
|
||||
[submodule "third-party/mongoose"]
|
||||
path = third-party/mongoose
|
||||
url = https://github.com/cesanta/mongoose/
|
||||
|
@ -28,20 +28,22 @@ add_executable(
|
||||
|
||||
# argparse
|
||||
third-party/argparse/argparse.h third-party/argparse/argparse.c
|
||||
third-party/mongoose/mongoose.h third-party/mongoose/mongoose.c
|
||||
|
||||
src/cli.c src/cli.h
|
||||
)
|
||||
|
||||
target_compile_definitions(sist2 PUBLIC MG_ENABLE_SSL=1)
|
||||
|
||||
target_link_directories(sist2 PRIVATE BEFORE ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib)
|
||||
|
||||
find_package(lmdb CONFIG REQUIRED)
|
||||
find_package(cJSON CONFIG REQUIRED)
|
||||
find_package(unofficial-glib CONFIG REQUIRED)
|
||||
find_package(unofficial-mongoose CONFIG REQUIRED)
|
||||
find_library(UUID_LIB NAMES uuid)
|
||||
|
||||
#find_package(OpenSSL REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
|
||||
target_include_directories(
|
||||
@ -72,7 +74,6 @@ if (SIST_DEBUG)
|
||||
sist2
|
||||
PRIVATE
|
||||
-fsanitize=address
|
||||
# -static
|
||||
)
|
||||
set_target_properties(
|
||||
sist2
|
||||
@ -103,8 +104,7 @@ target_link_libraries(
|
||||
cjson
|
||||
argparse
|
||||
unofficial::glib::glib
|
||||
unofficial::mongoose::mongoose
|
||||
# OpenSSL::SSL OpenSSL::Crypto
|
||||
OpenSSL::SSL OpenSSL::Crypto
|
||||
|
||||
${UUID_LIB}
|
||||
pthread
|
||||
|
@ -2,9 +2,6 @@
|
||||
#include "src/sist.h"
|
||||
#include "src/ctx.h"
|
||||
|
||||
#include <mongoose.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
void free_response(response_t *resp) {
|
||||
if (resp->body != NULL) {
|
||||
@ -77,7 +74,19 @@ subreq_ctx_t *http_req(const char *url, const char *extra_headers, const char *p
|
||||
|
||||
char address[8196];
|
||||
snprintf(address, sizeof(address), "tcp://%.*s:%u", (int) host.len, host.p, port);
|
||||
struct mg_connection *nc = mg_connect(&ctx->mgr, address, http_req_ev);
|
||||
struct mg_connect_opts opts;
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.ssl_key = "./a.key";
|
||||
opts.ssl_cert = "./cert.crt";
|
||||
opts.ssl_ca_cert = "*";
|
||||
opts.ssl_server_name = "dev2.simon987.net:443";
|
||||
const char* tmp[256];
|
||||
opts.error_string = tmp;
|
||||
|
||||
struct mg_connection *nc = mg_connect_opt(&ctx->mgr, address, http_req_ev, opts);
|
||||
printf("%d\n", nc->err);
|
||||
|
||||
|
||||
nc->user_data = &ctx->ev_data;
|
||||
mg_set_protocol_http_websocket(nc);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define SIST2_WEB_H
|
||||
|
||||
#include "src/sist.h"
|
||||
#include <mongoose.h>
|
||||
#include "third-party/mongoose/mongoose.h"
|
||||
|
||||
typedef struct response {
|
||||
char *body;
|
||||
|
1
third-party/mongoose
vendored
Submodule
1
third-party/mongoose
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 359060a151998c5ab08e54af1420b7406005dc6b
|
Loading…
x
Reference in New Issue
Block a user