abouttreesummaryrefslogcommitdiff
path: root/src/matrix_http_mongoose.c
diff options
context:
space:
mode:
authorPatrick2023-06-21 20:16:44 +0200
committerPatrick2023-06-21 20:16:44 +0200
commit1273c8ea309926e377cbd5cc6dab6740910aa6ff (patch)
tree2be94eb34848cd14668b1abe31e04ea1d91ad53f /src/matrix_http_mongoose.c
parentad9d01050b7b6d592a83ce14eeef7068bd981028 (diff)
downloadmatrix_esp_thesis-1273c8ea309926e377cbd5cc6dab6740910aa6ff.tar.gz
matrix_esp_thesis-1273c8ea309926e377cbd5cc6dab6740910aa6ff.zip
get send encrypted to send :)
Diffstat (limited to 'src/matrix_http_mongoose.c')
-rw-r--r--src/matrix_http_mongoose.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/matrix_http_mongoose.c b/src/matrix_http_mongoose.c
index 020b4c8..2e500d6 100644
--- a/src/matrix_http_mongoose.c
+++ b/src/matrix_http_mongoose.c
@@ -36,7 +36,7 @@ MatrixHttpCallback(
// If s_url is https://, tell client connection to use TLS
if (mg_url_is_ssl(client->server))
{
- struct mg_tls_opts opts;
+ static struct mg_tls_opts opts;
opts.srvname = host;
mg_tls_init(c, &opts);
}
@@ -71,7 +71,8 @@ MatrixHttpInit(
mg_mgr_init(&conn->mgr);
- mg_http_connect(&conn->mgr, client->server, MatrixHttpCallback, client);
+ struct mg_connection * c =
+ mg_http_connect(&conn->mgr, client->server, MatrixHttpCallback, client);
while (! conn->connected)
mg_mgr_poll(&conn->mgr, 1000);
@@ -198,6 +199,20 @@ MatrixHttpPut(
else
authorizationHeader[0] = '\0';
+ printf("PUT %s HTTP/1.0\r\n"
+ "Host: %.*s\r\n"
+ "%s"
+ "Content-Type: application/json\r\n"
+ "Content-Length: %d\r\n"
+ "\r\n"
+ "%s"
+ "\r\n",
+ url,
+ host.len, host.ptr,
+ authorizationHeader,
+ strlen(requestBuffer),
+ requestBuffer);
+
mg_printf(conn->connection,
"PUT %s HTTP/1.0\r\n"
"Host: %.*s\r\n"