Skip to content

Commit 834d412

Browse files
committed
Merge pull request #6 from don/CRLF
Use carriage return and line feed in request
2 parents fc8beb4 + 1bd2498 commit 834d412

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

RestClient.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,29 @@ int RestClient::request(const char* method, String path, String body){
7777
requestString += " ";
7878
requestString += path;
7979
requestString += " HTTP/1.1";
80-
requestString += "\n";
80+
requestString += "\r\n";
8181
for(int i=0; i<num_headers; i++){
8282
requestString += headers[i];
83-
requestString += "\n";
83+
requestString += "\r\n";
8484
}
8585
requestString += "Host: ";
8686
requestString += host;
87-
requestString += "\n";
87+
requestString += "\r\n";
8888
requestString += "Connection: close";
89-
requestString += "\n";
89+
requestString += "\r\n";
9090
//TODO: deal with binary content
9191
if(body != ""){
9292
requestString += "Content-Length: ";
9393
requestString += body.length();
94-
requestString += "\n";
94+
requestString += "\r\n";
9595
requestString += "Content-Type: ";
9696
requestString += contentType;
97-
requestString += "\n\n";
97+
requestString += "\r\n\r\n";
9898
requestString += body;
9999
}
100-
requestString += "\n\n";
100+
requestString += "\r\n\r\n";
101101
client->print(requestString);
102+
HTTP_DEBUG_PRINT(requestString);
102103

103104
// make sure you've sent all bytes. Ugly hack.
104105
// TODO: check output buffer instead?

0 commit comments

Comments
 (0)