From ecf8504d84aecde0f88448f9337016a5d939f559 Mon Sep 17 00:00:00 2001 From: cat101 Date: Sat, 3 Mar 2018 12:19:36 -0300 Subject: [PATCH] The content length was computed incorrectly I found that in certain conditions, the server would respond before the last CRLF was sent and then when the arduino tried put write it would receive a connection reset --- RestClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RestClient.cpp b/RestClient.cpp index 7afd641..d8b6cc7 100644 --- a/RestClient.cpp +++ b/RestClient.cpp @@ -130,7 +130,7 @@ int RestClient::request(const char* method, const char* path, if(body != NULL){ char contentLength[30]; - sprintf(contentLength, "Content-Length: %d\r\n", strlen(body)); + sprintf(contentLength, "Content-Length: %d\r\n", strlen(body)+1); //The code below sends an extra CRLF write(contentLength); write("Content-Type: ");