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