#include "mapzen_types.h"
#include "mapzen_jsonparser.hpp"
#include "mapzen_debug.h"
+#include "mapzen_util.h"
#define RESTCURL_USE_MULTI_CURL
struct MultiCurlArg_List *head = NULL;
struct MultiCurlArg_List *curr = NULL;
+static void __show_url_log(const char *url)
+{
+ char urlLog[1024] = {}, *tmp = NULL;
+ int url_index = 0, urlLog_index = 0;
+
+ if (!url) return;
+ tmp = strstr(url, "api_key=");
+ if (!tmp) {
+ MAP_DEBUG("HTTP URL [%s]", url);
+ return;
+ }
+ for (; url_index < strlen(url) && url_index < 1024; url_index++) {
+ if (&url[url_index] == tmp)
+ break;
+ urlLog[url_index] = url[url_index];
+ }
+ STRCAT(urlLog, "api_key=");
+ url_index = url_index + 8;
+ urlLog_index = url_index;
+ if ((url_index + 3 < strlen(url) && url[url_index] != '&') && (url[url_index] != 'n' || url[url_index+1] != 'u' || url[url_index+2] != 'l' || url[url_index+3] != 'l')) {
+ STRCAT(urlLog, "xxxx-xxxx");
+ for(;url_index < strlen(url); url_index++) {
+ if (url[url_index] == '&')
+ break;
+ }
+ urlLog_index = urlLog_index + 9;
+ }
+ for (; url_index < strlen(url); url_index++, urlLog_index++)
+ urlLog[urlLog_index] = url[url_index];
+ MAP_DEBUG("HTTP URL [%s]", urlLog);
+}
+
static struct MultiCurlArg_List *__create_list(struct MultiCurlArg *mcArg)
{
MAP_DEBUG("\n creating list with headnode as [%p]\n", mcArg);
}
#ifdef RESTCURL_USE_MULTI_CURL
- MAP_DEBUG("HTTP Req URL [%s]", url);
+ // block to hide key in log
+ //MAP_DEBUG("HTTP Req URL [%s]", url);
+ __show_url_log(url);
CURL *curl_handle;
struct MultiCurlArg *pMultiCurlArg = (struct MultiCurlArg *)g_malloc0(sizeof(struct MultiCurlArg));
pthread_mutex_unlock(&__MultiCurlArgsLock);
if (del && del->mcArg) {
- MAP_DEBUG("HTTP Url [%s]", del->mcArg->url);
+ // block to hide key in log
+ //MAP_DEBUG("HTTP Url [%s]", del->mcArg->url);
+ __show_url_log(del->mcArg->url);
MAP_DEBUG("Posting the result..");
__post_curl(del->mcArg->req_type, &(del->mcArg->m_chunk), del->mcArg->user_data);