This commit is contained in:
2020-05-13 17:37:40 -04:00
parent cf513b4ad8
commit 5686bc864d
5 changed files with 23 additions and 10 deletions

View File

@@ -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);

View File

@@ -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;