From 5bf46f3b60a7062dd6aa6ba99a20f000420d880a Mon Sep 17 00:00:00 2001 From: chenyong <1521761801@qq.com> Date: Fri, 10 Aug 2018 16:36:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=20LOG=20=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenyong <1521761801@qq.com> --- src/webclient.c | 28 +++++++++++++++------------- src/webclient_file.c | 4 ++-- 2 files changed, 17 insertions(+), 15 deletions(-) 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 {