X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/a6eff84624ab1f3786d02aa2ec740b9a88090d94..504241758d7b832af61939beaf61b0e0574174c4:/src/matrix_http_mongoose.c diff --git a/src/matrix_http_mongoose.c b/src/matrix_http_mongoose.c index 17edbc8..452e26c 100644 --- a/src/matrix_http_mongoose.c +++ b/src/matrix_http_mongoose.c @@ -43,6 +43,10 @@ MatrixHttpCallback( conn->connection = c; conn->connected = true; + } + if (ev == MG_EV_HTTP_CHUNK) + { + } if (ev == MG_EV_HTTP_MSG) { @@ -56,7 +60,7 @@ MatrixHttpCallback( conn->dataLen = hm->body.len; conn->dataReceived = true; - printf("received[%d]:\n%.*s\n", conn->dataLen, conn->dataLen, conn->data); + //printf("received[%d]:\n%.*s\n", conn->dataLen, conn->dataLen, conn->data); } if (ev == MG_EV_CLOSE) { @@ -86,7 +90,7 @@ MatrixHttpConnect( MatrixHttpConnection * conn = (MatrixHttpConnection *)client->httpUserData; - struct mg_connection * c = + //struct mg_connection * c = mg_http_connect(&conn->mgr, client->server, MatrixHttpCallback, client); while (! conn->connected) @@ -132,6 +136,15 @@ MatrixHttpGet( else authorizationHeader[0] = '\0'; + printf( + "GET %s HTTP/1.1\r\n" + "Host: %.*s\r\n" + "%s" + "\r\n", + url, + host.len, host.ptr, + authorizationHeader); + mg_printf(conn->connection, "GET %s HTTP/1.1\r\n" "Host: %.*s\r\n" @@ -173,6 +186,21 @@ MatrixHttpPost( else authorizationHeader[0] = '\0'; + printf( + "POST %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, "POST %s HTTP/1.0\r\n" "Host: %.*s\r\n" @@ -220,7 +248,9 @@ MatrixHttpPut( else authorizationHeader[0] = '\0'; - printf("PUT %s HTTP/1.0\r\n" + + printf( + "PUT %s HTTP/1.0\r\n" "Host: %.*s\r\n" "%s" "Content-Type: application/json\r\n"