abouttreesummaryrefslogcommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/matrix.c2
-rw-r--r--src/matrix_http_mongoose.c19
2 files changed, 18 insertions, 3 deletions
diff --git a/src/matrix.c b/src/matrix.c
index 28e7634..cc34a0a 100644
--- a/src/matrix.c
+++ b/src/matrix.c
@@ -294,7 +294,7 @@ MatrixClientSendEventEncrypted(
"\"algorithm\":\"m.megolm.v1.aes-sha2\","
"\"sender_key\":\"%s\","
"\"ciphertext\":\"%s\","
- "\"session_id\":%s,"
+ "\"session_id\":\"%s\","
"\"device_id\":\"%s\""
"}",
senderKey,
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"