Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,17 @@ int HttpClient::startRequest(const char* aURLPath, const char* aHttpMethod,

if (hasBody)
{
write(aBody, aContentLength);
int sent, written;
sent = 0;
while (sent < aContentLength)
{
written = write(&aBody[sent], aContentLength - sent);
if (written < 0)
{
return HTTP_ERROR_SOCKET_CLIENT;
}
sent += written;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/HttpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static const int HTTP_ERROR_TIMED_OUT =-3;
// The response from the server is invalid, is it definitely an HTTP
// server?
static const int HTTP_ERROR_INVALID_RESPONSE =-4;
// Socket client returned an error
static const int HTTP_ERROR_SOCKET_CLIENT =-5;

// Define some of the common methods and headers here
// That lets other code reuse them without having to declare another copy
Expand Down
Loading