mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Fix clang formatting
PUBLISHED_FROM=ea64670e42ae58bbe26abee5d928f2afcd83bd46
This commit is contained in:
1 parent
3a61186491
commit
39b0b8e2fd
9 files changed
+79
-67
No files matched your search
@@ -8,7 +8,8 @@
|
|||||||
#pragma comment(linker, "/nodefaultlib:libc.lib")
|
#pragma comment(linker, "/nodefaultlib:libc.lib")
|
||||||
#pragma comment(linker, "/nodefaultlib:libcd.lib")
|
#pragma comment(linker, "/nodefaultlib:libcd.lib")
|
||||||
|
|
||||||
// NOTE - this value is not strongly correlated to the Windows CE OS version being targeted
|
// NOTE - this value is not strongly correlated to the Windows CE OS version
|
||||||
|
// being targeted
|
||||||
#define WINVER _WIN32_WCE
|
#define WINVER _WIN32_WCE
|
||||||
|
|
||||||
#include <ceconfig.h>
|
#include <ceconfig.h>
|
||||||
@@ -25,8 +26,6 @@
|
|||||||
#include <aygshell.h>
|
#include <aygshell.h>
|
||||||
#pragma comment(lib, "aygshell.lib")
|
#pragma comment(lib, "aygshell.lib")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
@@ -40,15 +39,16 @@
|
|||||||
#include "DeviceResolutionAware.h"
|
#include "DeviceResolutionAware.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _WIN32_WCE < 0x500 && ( defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) )
|
#if _WIN32_WCE < 0x500 && \
|
||||||
#pragma comment(lib, "ccrtrtti.lib")
|
(defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
|
||||||
#ifdef _X86_
|
#pragma comment(lib, "ccrtrtti.lib")
|
||||||
#if defined(_DEBUG)
|
#ifdef _X86_
|
||||||
#pragma comment(lib, "libcmtx86d.lib")
|
#if defined(_DEBUG)
|
||||||
#else
|
#pragma comment(lib, "libcmtx86d.lib")
|
||||||
#pragma comment(lib, "libcmtx86.lib")
|
#else
|
||||||
#endif
|
#pragma comment(lib, "libcmtx86.lib")
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <altcecrt.h>
|
#include <altcecrt.h>
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
void *db_open(const char *db_path) {
|
void *db_open(const char *db_path) {
|
||||||
sqlite3 *db = NULL;
|
sqlite3 *db = NULL;
|
||||||
if (sqlite3_open_v2(db_path, &db, SQLITE_OPEN_READWRITE |
|
if (sqlite3_open_v2(db_path, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
|
||||||
SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL) == SQLITE_OK) {
|
SQLITE_OPEN_FULLMUTEX,
|
||||||
sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS kv(key PRIMARY KEY, val);",
|
NULL) == SQLITE_OK) {
|
||||||
0, 0, 0);
|
sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS kv(key PRIMARY KEY, val);", 0,
|
||||||
|
0, 0);
|
||||||
}
|
}
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
@@ -27,12 +28,12 @@ static void op_set(struct mg_connection *nc, const struct http_message *hm,
|
|||||||
const struct mg_str *key, void *db) {
|
const struct mg_str *key, void *db) {
|
||||||
sqlite3_stmt *stmt = NULL;
|
sqlite3_stmt *stmt = NULL;
|
||||||
char value[200];
|
char value[200];
|
||||||
const struct mg_str *body = hm->query_string.len > 0 ?
|
const struct mg_str *body =
|
||||||
&hm->query_string : &hm->body;
|
hm->query_string.len > 0 ? &hm->query_string : &hm->body;
|
||||||
|
|
||||||
mg_get_http_var(body, "value", value, sizeof(value));
|
mg_get_http_var(body, "value", value, sizeof(value));
|
||||||
if (sqlite3_prepare_v2(db, "INSERT OR REPLACE INTO kv VALUES (?, ?);",
|
if (sqlite3_prepare_v2(db, "INSERT OR REPLACE INTO kv VALUES (?, ?);", -1,
|
||||||
-1, &stmt, NULL) == SQLITE_OK) {
|
&stmt, NULL) == SQLITE_OK) {
|
||||||
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
||||||
sqlite3_bind_text(stmt, 2, value, strlen(value), SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 2, value, strlen(value), SQLITE_STATIC);
|
||||||
sqlite3_step(stmt);
|
sqlite3_step(stmt);
|
||||||
@@ -48,23 +49,26 @@ static void op_get(struct mg_connection *nc, const struct http_message *hm,
|
|||||||
int result;
|
int result;
|
||||||
(void) hm;
|
(void) hm;
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, "SELECT val FROM kv WHERE key = ?;",
|
if (sqlite3_prepare_v2(db, "SELECT val FROM kv WHERE key = ?;", -1, &stmt,
|
||||||
-1, &stmt, NULL) == SQLITE_OK) {
|
NULL) == SQLITE_OK) {
|
||||||
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
||||||
result = sqlite3_step(stmt);
|
result = sqlite3_step(stmt);
|
||||||
data = (char *) sqlite3_column_text(stmt, 0);
|
data = (char *) sqlite3_column_text(stmt, 0);
|
||||||
if ((result == SQLITE_OK || result == SQLITE_ROW) && data != NULL) {
|
if ((result == SQLITE_OK || result == SQLITE_ROW) && data != NULL) {
|
||||||
mg_printf(nc, "HTTP/1.1 200 OK\r\n"
|
mg_printf(nc,
|
||||||
|
"HTTP/1.1 200 OK\r\n"
|
||||||
"Content-Type: text/plain\r\n"
|
"Content-Type: text/plain\r\n"
|
||||||
"Content-Length: %d\r\n\r\n%s",
|
"Content-Length: %d\r\n\r\n%s",
|
||||||
(int) strlen(data), data);
|
(int) strlen(data), data);
|
||||||
} else {
|
} else {
|
||||||
mg_printf(nc, "%s", "HTTP/1.1 404 Not Found\r\n"
|
mg_printf(nc, "%s",
|
||||||
|
"HTTP/1.1 404 Not Found\r\n"
|
||||||
"Content-Length: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
} else {
|
} else {
|
||||||
mg_printf(nc, "%s", "HTTP/1.1 500 Server Error\r\n"
|
mg_printf(nc, "%s",
|
||||||
|
"HTTP/1.1 500 Server Error\r\n"
|
||||||
"Content-Length: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,19 +79,21 @@ static void op_del(struct mg_connection *nc, const struct http_message *hm,
|
|||||||
int result;
|
int result;
|
||||||
(void) hm;
|
(void) hm;
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, "DELETE FROM kv WHERE key = ?;",
|
if (sqlite3_prepare_v2(db, "DELETE FROM kv WHERE key = ?;", -1, &stmt,
|
||||||
-1, &stmt, NULL) == SQLITE_OK) {
|
NULL) == SQLITE_OK) {
|
||||||
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
sqlite3_bind_text(stmt, 1, key->p, key->len, SQLITE_STATIC);
|
||||||
result = sqlite3_step(stmt);
|
result = sqlite3_step(stmt);
|
||||||
if (result == SQLITE_OK || result == SQLITE_ROW) {
|
if (result == SQLITE_OK || result == SQLITE_ROW) {
|
||||||
mg_printf(nc, "%s", "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
|
mg_printf(nc, "%s", "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
|
||||||
} else {
|
} else {
|
||||||
mg_printf(nc, "%s", "HTTP/1.1 404 Not Found\r\n"
|
mg_printf(nc, "%s",
|
||||||
|
"HTTP/1.1 404 Not Found\r\n"
|
||||||
"Content-Length: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
} else {
|
} else {
|
||||||
mg_printf(nc, "%s", "HTTP/1.1 500 Server Error\r\n"
|
mg_printf(nc, "%s",
|
||||||
|
"HTTP/1.1 500 Server Error\r\n"
|
||||||
"Content-Length: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,13 +101,19 @@ static void op_del(struct mg_connection *nc, const struct http_message *hm,
|
|||||||
void db_op(struct mg_connection *nc, const struct http_message *hm,
|
void db_op(struct mg_connection *nc, const struct http_message *hm,
|
||||||
const struct mg_str *key, void *db, int op) {
|
const struct mg_str *key, void *db, int op) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case API_OP_GET: op_get(nc, hm, key, db); break;
|
case API_OP_GET:
|
||||||
case API_OP_SET: op_set(nc, hm, key, db); break;
|
op_get(nc, hm, key, db);
|
||||||
case API_OP_DEL: op_del(nc, hm, key, db); break;
|
break;
|
||||||
|
case API_OP_SET:
|
||||||
|
op_set(nc, hm, key, db);
|
||||||
|
break;
|
||||||
|
case API_OP_DEL:
|
||||||
|
op_del(nc, hm, key, db);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
mg_printf(nc, "%s", "HTTP/1.0 501 Not Implemented\r\n"
|
mg_printf(nc, "%s",
|
||||||
|
"HTTP/1.0 501 Not Implemented\r\n"
|
||||||
"Content-Length: 0\r\n\r\n");
|
"Content-Length: 0\r\n\r\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
s_exit_flag = 1;
|
s_exit_flag = 1;
|
||||||
break;
|
break;
|
||||||
case MG_EV_CLOSE:
|
case MG_EV_CLOSE:
|
||||||
if(s_exit_flag == 0) {
|
if (s_exit_flag == 0) {
|
||||||
printf("Server closed connection\n");
|
printf("Server closed connection\n");
|
||||||
s_exit_flag = 1;
|
s_exit_flag = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ static void ev_handler(struct mg_connection *nc, int ev, void *p) {
|
|||||||
mg_hexdump(nc->recv_mbuf.buf, msg->payload.len, hex, sizeof(hex));
|
mg_hexdump(nc->recv_mbuf.buf, msg->payload.len, hex, sizeof(hex));
|
||||||
printf("Got incoming message %.*s:\n%s", (int)msg->topic.len, msg->topic.p, hex);
|
printf("Got incoming message %.*s:\n%s", (int)msg->topic.len, msg->topic.p, hex);
|
||||||
#else
|
#else
|
||||||
printf("Got incoming message %.*s: %.*s\n", (int)msg->topic.len,
|
printf("Got incoming message %.*s: %.*s\n", (int) msg->topic.len,
|
||||||
msg->topic.p, (int) msg->payload.len, msg->payload.p);
|
msg->topic.p, (int) msg->payload.len, msg->payload.p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("Forwarding to /test\n");
|
printf("Forwarding to /test\n");
|
||||||
|
|||||||
@@ -5,4 +5,3 @@
|
|||||||
|
|
||||||
void bleconfig_init(void);
|
void bleconfig_init(void);
|
||||||
void bleconfig_poll(void);
|
void bleconfig_poll(void);
|
||||||
|
|
||||||
@@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a callback invoked by Mongoose to signal that a poll is needed soon.
|
* This is a callback invoked by Mongoose to signal that a poll is needed soon.
|
||||||
* Since we're in a tight polling loop anyway (see below), we don't need to do anything.
|
* Since we're in a tight polling loop anyway (see below), we don't need to do
|
||||||
|
* anything.
|
||||||
*/
|
*/
|
||||||
void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr) {
|
void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Define an event handler function
|
// Define an event handler function
|
||||||
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_POLL) return;
|
if (ev == MG_EV_POLL) return;
|
||||||
@@ -53,13 +53,10 @@ void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for application main entry.
|
* @brief Function for application main entry.
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
|
|
||||||
cs_log_set_file(stdout);
|
cs_log_set_file(stdout);
|
||||||
|
|
||||||
bleconfig_init();
|
bleconfig_init();
|
||||||
@@ -76,7 +73,9 @@ int main(void)
|
|||||||
struct mg_connection *nc = NULL;
|
struct mg_connection *nc = NULL;
|
||||||
memset(&opts, 0x00, sizeof(opts));
|
memset(&opts, 0x00, sizeof(opts));
|
||||||
opts.error_string = &err;
|
opts.error_string = &err;
|
||||||
nc = mg_bind_opt(&mgr, "80", ev_handler, opts); // Create listening connection and add it to the event manager
|
nc = mg_bind_opt(
|
||||||
|
&mgr, "80", ev_handler,
|
||||||
|
opts); // Create listening connection and add it to the event manager
|
||||||
if (nc == NULL) {
|
if (nc == NULL) {
|
||||||
printf("Failed to create listener: %s\n", err);
|
printf("Failed to create listener: %s\n", err);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -88,5 +87,4 @@ int main(void)
|
|||||||
mg_mgr_poll(&mgr, 0);
|
mg_mgr_poll(&mgr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a callback invoked by Mongoose to signal that a poll is needed soon.
|
* This is a callback invoked by Mongoose to signal that a poll is needed soon.
|
||||||
* Since we're in a tight polling loop anyway (see below), we don't need to do anything.
|
* Since we're in a tight polling loop anyway (see below), we don't need to do
|
||||||
|
* anything.
|
||||||
*/
|
*/
|
||||||
void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr) {
|
void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Define an event handler function
|
// Define an event handler function
|
||||||
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_POLL) return;
|
if (ev == MG_EV_POLL) return;
|
||||||
@@ -53,13 +53,10 @@ void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for application main entry.
|
* @brief Function for application main entry.
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
|
|
||||||
cs_log_set_file(stdout);
|
cs_log_set_file(stdout);
|
||||||
|
|
||||||
bleconfig_init();
|
bleconfig_init();
|
||||||
@@ -76,7 +73,9 @@ int main(void)
|
|||||||
struct mg_connection *nc = NULL;
|
struct mg_connection *nc = NULL;
|
||||||
memset(&opts, 0x00, sizeof(opts));
|
memset(&opts, 0x00, sizeof(opts));
|
||||||
opts.error_string = &err;
|
opts.error_string = &err;
|
||||||
nc = mg_bind_opt(&mgr, "80", ev_handler, opts); // Create listening connection and add it to the event manager
|
nc = mg_bind_opt(
|
||||||
|
&mgr, "80", ev_handler,
|
||||||
|
opts); // Create listening connection and add it to the event manager
|
||||||
if (nc == NULL) {
|
if (nc == NULL) {
|
||||||
printf("Failed to create listener: %s\n", err);
|
printf("Failed to create listener: %s\n", err);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -91,5 +90,4 @@ int main(void)
|
|||||||
mg_mgr_free(&mgr);
|
mg_mgr_free(&mgr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+14
-11
@@ -2695,7 +2695,7 @@ struct mg_connection *mg_connect_opt(struct mg_mgr *mgr, const char *address,
|
|||||||
if (strcmp(opts.ssl_server_name, "*") != 0) {
|
if (strcmp(opts.ssl_server_name, "*") != 0) {
|
||||||
params.server_name = opts.ssl_server_name;
|
params.server_name = opts.ssl_server_name;
|
||||||
}
|
}
|
||||||
} else if (rc == 0) { /* If it's a DNS name, use host. */
|
} else if (rc == 0) { /* If it's a DNS name, use host. */
|
||||||
params.server_name = host;
|
params.server_name = host;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3091,13 +3091,13 @@ static int mg_is_error(int n) {
|
|||||||
int err = mg_get_errno();
|
int err = mg_get_errno();
|
||||||
return (n < 0 && err != EINPROGRESS && err != EWOULDBLOCK
|
return (n < 0 && err != EINPROGRESS && err != EWOULDBLOCK
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
&& err != EAGAIN && err != EINTR
|
&& err != EAGAIN && err != EINTR
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
&& WSAGetLastError() != WSAEINTR &&
|
&& WSAGetLastError() != WSAEINTR &&
|
||||||
WSAGetLastError() != WSAEWOULDBLOCK
|
WSAGetLastError() != WSAEWOULDBLOCK
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mg_socket_if_connect_tcp(struct mg_connection *nc,
|
void mg_socket_if_connect_tcp(struct mg_connection *nc,
|
||||||
@@ -4046,7 +4046,8 @@ enum mg_ssl_if_result mg_ssl_if_conn_init(
|
|||||||
|
|
||||||
mg_set_cipher_list(ctx->ssl_ctx);
|
mg_set_cipher_list(ctx->ssl_ctx);
|
||||||
|
|
||||||
if (!(nc->flags & MG_F_LISTENING) && (ctx->ssl = SSL_new(ctx->ssl_ctx)) == NULL) {
|
if (!(nc->flags & MG_F_LISTENING) &&
|
||||||
|
(ctx->ssl = SSL_new(ctx->ssl_ctx)) == NULL) {
|
||||||
MG_SET_PTRPTR(err_msg, "Failed to create SSL session");
|
MG_SET_PTRPTR(err_msg, "Failed to create SSL session");
|
||||||
return MG_SSL_ERROR;
|
return MG_SSL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -4056,7 +4057,8 @@ enum mg_ssl_if_result mg_ssl_if_conn_init(
|
|||||||
return MG_SSL_OK;
|
return MG_SSL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum mg_ssl_if_result mg_ssl_if_ssl_err(struct mg_connection *nc, int res) {
|
static enum mg_ssl_if_result mg_ssl_if_ssl_err(struct mg_connection *nc,
|
||||||
|
int res) {
|
||||||
struct mg_ssl_if_ctx *ctx = (struct mg_ssl_if_ctx *) nc->ssl_if_data;
|
struct mg_ssl_if_ctx *ctx = (struct mg_ssl_if_ctx *) nc->ssl_if_data;
|
||||||
int err = SSL_get_error(ctx->ssl, res);
|
int err = SSL_get_error(ctx->ssl, res);
|
||||||
if (err == SSL_ERROR_WANT_READ) return MG_SSL_WANT_READ;
|
if (err == SSL_ERROR_WANT_READ) return MG_SSL_WANT_READ;
|
||||||
@@ -4154,7 +4156,8 @@ static const char mg_s_cipher_list[] =
|
|||||||
* Will be used if none are provided by the user in the certificate file.
|
* Will be used if none are provided by the user in the certificate file.
|
||||||
*/
|
*/
|
||||||
#if !MG_DISABLE_PFS && !defined(KR_VERSION)
|
#if !MG_DISABLE_PFS && !defined(KR_VERSION)
|
||||||
static const char mg_s_default_dh_params[] = "\
|
static const char mg_s_default_dh_params[] =
|
||||||
|
"\
|
||||||
-----BEGIN DH PARAMETERS-----\n\
|
-----BEGIN DH PARAMETERS-----\n\
|
||||||
MIIBCAKCAQEAlvbgD/qh9znWIlGFcV0zdltD7rq8FeShIqIhkQ0C7hYFThrBvF2E\n\
|
MIIBCAKCAQEAlvbgD/qh9znWIlGFcV0zdltD7rq8FeShIqIhkQ0C7hYFThrBvF2E\n\
|
||||||
Z9bmgaP+sfQwGpVlv9mtaWjvERbu6mEG7JTkgmVUJrUt/wiRzwTaCXBqZkdUO8Tq\n\
|
Z9bmgaP+sfQwGpVlv9mtaWjvERbu6mEG7JTkgmVUJrUt/wiRzwTaCXBqZkdUO8Tq\n\
|
||||||
@@ -7524,8 +7527,8 @@ struct mg_connection *mg_connect_http_opt(struct mg_mgr *mgr,
|
|||||||
mg_printf(nc, "%s %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %" SIZE_T_FMT
|
mg_printf(nc, "%s %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %" SIZE_T_FMT
|
||||||
"\r\n%.*s%s\r\n%s",
|
"\r\n%.*s%s\r\n%s",
|
||||||
post_data == NULL ? "GET" : "POST", path, addr,
|
post_data == NULL ? "GET" : "POST", path, addr,
|
||||||
post_data == NULL ? 0 : strlen(post_data),
|
post_data == NULL ? 0 : strlen(post_data), (int) auth.len,
|
||||||
(int) auth.len, (auth.buf == NULL ? "" : auth.buf),
|
(auth.buf == NULL ? "" : auth.buf),
|
||||||
extra_headers == NULL ? "" : extra_headers,
|
extra_headers == NULL ? "" : extra_headers,
|
||||||
post_data == NULL ? "" : post_data);
|
post_data == NULL ? "" : post_data);
|
||||||
|
|
||||||
@@ -9470,7 +9473,7 @@ void mg_send_mqtt_handshake_opt(struct mg_connection *nc, const char *client_id,
|
|||||||
uint8_t rem_len;
|
uint8_t rem_len;
|
||||||
uint16_t keep_alive;
|
uint16_t keep_alive;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
struct mg_mqtt_proto_data* pd = (struct mg_mqtt_proto_data*) nc->proto_data;
|
struct mg_mqtt_proto_data *pd = (struct mg_mqtt_proto_data *) nc->proto_data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 9: version_header(len, magic_string, version_number), 1: flags, 2:
|
* 9: version_header(len, magic_string, version_number), 1: flags, 2:
|
||||||
|
|||||||
+4
-2
@@ -2982,9 +2982,11 @@ struct mg_ssl_if_conn_params {
|
|||||||
const char *server_name;
|
const char *server_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum mg_ssl_if_result mg_ssl_if_conn_init(struct mg_connection *nc, const struct mg_ssl_if_conn_params *params,
|
enum mg_ssl_if_result mg_ssl_if_conn_init(
|
||||||
|
struct mg_connection *nc, const struct mg_ssl_if_conn_params *params,
|
||||||
const char **err_msg);
|
const char **err_msg);
|
||||||
enum mg_ssl_if_result mg_ssl_if_conn_accept(struct mg_connection *nc, struct mg_connection *lc);
|
enum mg_ssl_if_result mg_ssl_if_conn_accept(struct mg_connection *nc,
|
||||||
|
struct mg_connection *lc);
|
||||||
void mg_ssl_if_conn_free(struct mg_connection *nc);
|
void mg_ssl_if_conn_free(struct mg_connection *nc);
|
||||||
|
|
||||||
enum mg_ssl_if_result mg_ssl_if_handshake(struct mg_connection *nc);
|
enum mg_ssl_if_result mg_ssl_if_handshake(struct mg_connection *nc);
|
||||||
|
|||||||
Reference in new issue
Block a user