diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-07 19:21:49 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-07 19:21:49 +0800 |
commit | 33f8e8c79a619c2153210e297e17c6d0bca4d0d2 (patch) | |
tree | 221a399521da2acc8c7a0e830bae0dfbdf405752 | |
parent | 3cc0e54e13432387622d4f9815c150865ed87ae6 (diff) |
Started to test the response status
-rw-r--r-- | rtclient.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -72,16 +72,26 @@ user_callback(void *contents, size_t size, size_t nmemb, void *writedata) memcpy(&response[0], contents, realsize); response[realsize] = '\0'; char *token = strtok(response, "\n"); - while (token) { + if (strstr(token, "200 Ok")) + while (token) { + token = strtok(NULL, "\n"); #ifdef DEBUG #ifdef ANDROID - __android_log_print(ANDROID_LOG_ERROR, "librtclient.so", "Token:\n %s", token); + __android_log_print(ANDROID_LOG_ERROR, "librtclient.so", "Token:\n%s", token); #else - fprintf(stderr, "Token:\n%s\n", token); + fprintf(stderr, "Token:\n%s\n", token); #endif // ANDROID #endif // DEBUG - token = strtok(NULL, "\n"); + } +#ifdef DEBUG + else { +#ifdef ANDROID + __android_log_print(ANDROID_LOG_ERROR, "librtclient.so", "Not okay"); +#else + fprintf(stderr, "Not okay\n"); +#endif // ANDROID } +#endif return realsize; } |