Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: source/http_request.h
- Revision:
- 22:71fc1b1894f8
- Parent:
- 20:0e63d6a93c02
- Child:
- 23:15fa2726f793
diff -r fcd2bfd31a39 -r 71fc1b1894f8 source/http_request.h
--- a/source/http_request.h Thu Dec 14 16:19:22 2017 +0700
+++ b/source/http_request.h Wed Jan 03 11:23:22 2018 +0000
@@ -139,12 +139,27 @@
size_t request_size = 0;
char* request = request_builder->build(body, body_size, request_size);
- nsapi_size_or_error_t send_result = socket->send(request, request_size);
+ nsapi_size_or_error_t total_send_count = 0;
+ while (total_send_count < request_size) {
+ nsapi_size_or_error_t send_result = socket->send(request + total_send_count, request_size - total_send_count);
+
+ if (send_result < 0) {
+ total_send_count = send_result;
+ break;
+ }
+
+ if (send_result == 0) {
+ break;
+ }
+
+ total_send_count += send_result;
+ }
+
free(request);
- if (send_result != request_size) {
- error = send_result;
+ if (total_send_count < 0) {
+ error = total_send_count;
return NULL;
}