- while (! conn->dataReceived)\r
- mg_mgr_poll(&conn->mgr, 1000);\r
+ while (! hc->dataReceived)\r
+ mg_mgr_poll(&hc->mgr, 1000);\r
+\r
+ return hc->dataReceived;\r
+}\r
+\r
+bool\r
+MatrixHttpPut(\r
+ MatrixHttpConnection * hc,\r
+ const char * url,\r
+ const char * requestBuffer,\r
+ char * outResponseBuffer, int outResponseCap,\r
+ bool authenticated)\r
+{\r
+ if (! hc->connected)\r
+ MatrixHttpConnect(hc);\r
+\r
+ hc->dataReceived = false;\r
+\r
+ struct mg_str host = mg_url_host(hc->host);\r
+\r
+ static char authorizationHeader[AUTHORIZATION_HEADER_LEN];\r
+ if (authenticated)\r
+ snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,\r
+ "Authorization: Bearer %s\r\n", hc->accessToken);\r
+ else\r
+ authorizationHeader[0] = '\0';\r