]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix_http_mongoose.c
get send encrypted to send :)
[matrix_esp_thesis] / src / matrix_http_mongoose.c
index 020b4c8cf638256edc9db6a521b454f7c71c4f98..2e500d69c5557ae35dff29bacb2a89bd4b8e4845 100644 (file)
@@ -36,7 +36,7 @@ MatrixHttpCallback(
         // If s_url is https://, tell client connection to use TLS\r
         if (mg_url_is_ssl(client->server))\r
         {\r
-            struct mg_tls_opts opts;\r
+            static struct mg_tls_opts opts;\r
             opts.srvname = host;\r
             mg_tls_init(c, &opts);\r
         }\r
@@ -71,7 +71,8 @@ MatrixHttpInit(
     \r
     mg_mgr_init(&conn->mgr);\r
 \r
-    mg_http_connect(&conn->mgr, client->server, MatrixHttpCallback, client);\r
+    struct mg_connection * c =\r
+        mg_http_connect(&conn->mgr, client->server, MatrixHttpCallback, client);\r
 \r
     while (! conn->connected)\r
         mg_mgr_poll(&conn->mgr, 1000);\r
@@ -198,6 +199,20 @@ MatrixHttpPut(
     else\r
         authorizationHeader[0] = '\0';\r
 \r
+    printf("PUT %s HTTP/1.0\r\n"\r
+            "Host: %.*s\r\n"\r
+            "%s"\r
+            "Content-Type: application/json\r\n"\r
+            "Content-Length: %d\r\n"\r
+            "\r\n"\r
+            "%s"\r
+            "\r\n",\r
+            url,\r
+            host.len, host.ptr,\r
+            authorizationHeader,\r
+            strlen(requestBuffer),\r
+            requestBuffer);\r
+\r
     mg_printf(conn->connection,\r
             "PUT %s HTTP/1.0\r\n"\r
             "Host: %.*s\r\n"\r