diff --git a/src/webclient.c b/src/webclient.c index 780cbdf..349d873 100644 --- a/src/webclient.c +++ b/src/webclient.c @@ -1406,40 +1406,40 @@ int webclient_request(const char *URI, const char *header, const char *post_data RT_ASSERT(URI); - if(post_data && header == RT_NULL) + if (post_data && header == RT_NULL) { LOG_E("request post failed, post input header cannot be empty."); return -WEBCLIENT_ERROR; } - if(post_data == RT_NULL && response == RT_NULL) + if (post_data == RT_NULL && response == RT_NULL) { LOG_E("request get failed, get response data cannot be empty."); return -WEBCLIENT_ERROR; } - if(post_data == RT_NULL) + if (post_data == RT_NULL) { session = webclient_session_create(WEBCLIENT_HEADER_BUFSZ); - if(session == RT_NULL) + if (session == RT_NULL) { rc = -WEBCLIENT_NOMEM; goto __exit; } - if(header != RT_NULL) + if (header != RT_NULL) { strncpy(session->header->buffer, header, strlen(header)); } - if(webclient_get(session, URI) != 200) + if (webclient_get(session, URI) != 200) { rc = -WEBCLIENT_ERROR; goto __exit; } totle_length = webclient_response(session, response); - if(totle_length <= 0) + if (totle_length <= 0) { rc = -WEBCLIENT_ERROR; goto __exit; @@ -1448,35 +1448,37 @@ int webclient_request(const char *URI, const char *header, const char *post_data else { session = webclient_session_create(WEBCLIENT_HEADER_BUFSZ); - if(session == RT_NULL) + if (session == RT_NULL) { rc = -WEBCLIENT_NOMEM; goto __exit; } - if(header != RT_NULL) + if (header != RT_NULL) { strncpy(session->header->buffer, header, strlen(header)); } - if(webclient_post(session, URI, post_data) != 200) + if (webclient_post(session, URI, post_data) != 200) { rc = -WEBCLIENT_ERROR; goto __exit; } } - if(header != RT_NULL) + + if (header != RT_NULL) { strncpy(session->header->buffer, header, strlen(header)); } + __exit: - if(session) + if (session) { webclient_close(session); session = RT_NULL; } - if(rc < 0) + if (rc < 0) { return rc; } diff --git a/src/webclient_file.c b/src/webclient_file.c index 08d30e6..fc22e21 100644 --- a/src/webclient_file.c +++ b/src/webclient_file.c @@ -87,7 +87,7 @@ int webclient_get_file(const char* URI, const char* filename) { write(fd, ptr, length); total_length += length; - rt_kprintf(">"); + LOG_RAW(">"); } else { @@ -107,7 +107,7 @@ int webclient_get_file(const char* URI, const char* filename) { write(fd, ptr, length); total_length += length; - rt_kprintf(">"); + LOG_RAW(">"); } else {