X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/ad9d01050b7b6d592a83ce14eeef7068bd981028..fb5f3a8652d1cd3e4d8207f8718359f90636b5b3:/src/matrix_http_mongoose.c 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"