external/webclient: Modify WGET return value
There is an intermittent case where recv is called one more time after receiving all files.
In this case, returning 0 from the recv function is not an error.
If all data is received, the return value is changed to WGET_OK.
@@ -1048,8 +1048,14 @@ retry:
goto errout;
} else if (len == 0) {
ndbg("Finish read\n");
+ if (mlen.message_len - mlen.sentence_start == mlen.content_len) {
+ ndbg("download completed successfully\n");
+ break;
+ } else {
+ ndbg("Error: Receive Fail\n");
goto errout;
}
+ }
usleep(1);
read_finish = http_parse_message(param->response->message,
@@ -1198,8 +1204,14 @@ static pthread_addr_t wget_base(void *arg)
goto errout;
} else if (len == 0) {
ndbg("Finish read\n");
+ if (mlen.message_len - mlen.sentence_start == mlen.content_len) {
+ ndbg("download completed successfully\n");
+ break;
+ } else {
+ ndbg("Error: Receive Fail\n");
goto errout;
}
+ }
usleep(1);
read_finish = http_parse_message(param->response->message,
