-
Notifications
You must be signed in to change notification settings - Fork 22
Debug Traces for curl comparision #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d35bb5a
4d6a66d
739303e
515b8b2
02dbfc9
591181c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,40 @@ static size_t writeToFile(void *ptr, size_t size, size_t nmemb, void *stream) | |
| return written; | ||
| } | ||
|
|
||
| static int curl_debug_callback_func(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr) | ||
| { | ||
| // Suppress unused parameter warnings | ||
| (void)handle; | ||
| (void)userptr; | ||
|
|
||
| switch (type) { | ||
| case CURLINFO_TEXT: | ||
| T2Info("curl: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_HEADER_OUT: | ||
| T2Info("curl: => Send header: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_DATA_OUT: | ||
| T2Info("curl: => Send data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_SSL_DATA_OUT: | ||
| T2Info("curl: => Send SSL data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_HEADER_IN: | ||
| T2Info("curl: <= Recv header: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_DATA_IN: | ||
| T2Info("curl: <= Recv data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_SSL_DATA_IN: | ||
| T2Info("curl: <= Recv SSL data: %zu bytes", size); | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| static T2ERROR setHeader(CURL *curl, const char* destURL, struct curl_slist **headerList, childResponse *childCurlResponse) | ||
| { | ||
|
|
||
|
|
@@ -332,7 +366,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| pid_t childPid; | ||
| int sharedPipeFds[2]; | ||
|
|
||
| T2Debug("%s ++in\n", __FUNCTION__); | ||
| T2Info("%s ++in\n", __FUNCTION__); | ||
| if(httpUrl == NULL || payload == NULL) | ||
| { | ||
| return ret; | ||
|
|
@@ -430,7 +464,7 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| } | ||
| #endif | ||
| pthread_sigmask(SIG_UNBLOCK, &blocking_signal, NULL); | ||
| T2Debug("%s --out\n", __FUNCTION__); | ||
| T2Info("%s --out\n", __FUNCTION__); | ||
| return T2ERROR_FAILURE; | ||
| } | ||
|
|
||
|
|
@@ -455,6 +489,10 @@ T2ERROR sendReportOverHTTP(char *httpUrl, char *payload, pid_t* outForkedPid) | |
| curl_easy_cleanup(curl); // CID 189985: Resource leak | ||
| goto child_cleanReturn; | ||
| } | ||
| curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); | ||
| curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debug_callback_func); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity Issue - Unchecked return value from libraryCalling "curl_easy_setopt(curl, _curl_opt, curl_debug_callback_func)" without checking return value. This library function may fail and return an error code. Medium Impact, CWE-252 |
||
| curl_easy_setopt(curl, CURLOPT_DEBUGDATA, NULL); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity Issue - Unchecked return value from libraryCalling "curl_easy_setopt(curl, _curl_opt, NULL)" without checking return value. This library function may fail and return an error code. Medium Impact, CWE-252 |
||
|
|
||
| #ifdef LIBRDKCERTSEL_BUILD | ||
| pEngine = rdkcertselector_getEngine(thisCertSel); | ||
| if(pEngine != NULL) | ||
|
|
@@ -624,7 +662,7 @@ child_cleanReturn : | |
| ret = T2ERROR_SUCCESS; | ||
| T2Info("Report Sent Successfully over HTTP : %ld\n", childCurlResponse.http_code); | ||
| } | ||
| T2Debug("%s --out\n", __FUNCTION__); | ||
| T2Info("%s --out\n", __FUNCTION__); | ||
| return ret; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -547,6 +547,40 @@ static size_t httpGetCallBack(void *response, size_t len, size_t nmemb, | |
| return realsize; | ||
| } | ||
|
|
||
| static int curl_debug_callback_func(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr) | ||
| { | ||
| // Suppress unused parameter warnings | ||
| (void)handle; | ||
| (void)userptr; | ||
|
|
||
| switch (type) { | ||
| case CURLINFO_TEXT: | ||
| T2Info("curl: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_HEADER_OUT: | ||
| T2Info("curl: => Send header: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_DATA_OUT: | ||
| T2Info("curl: => Send data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_SSL_DATA_OUT: | ||
| T2Info("curl: => Send SSL data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_HEADER_IN: | ||
| T2Info("curl: <= Recv header: %.*s", (int)size, data); | ||
| break; | ||
| case CURLINFO_DATA_IN: | ||
| T2Info("curl: <= Recv data: %zu bytes", size); | ||
| break; | ||
| case CURLINFO_SSL_DATA_IN: | ||
| T2Info("curl: <= Recv SSL data: %zu bytes", size); | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| #ifdef LIBRDKCERTSEL_BUILD | ||
| void xcCertSelectorFree() | ||
| { | ||
|
|
@@ -579,7 +613,7 @@ static void xcCertSelectorInit() | |
| T2ERROR doHttpGet(char* httpsUrl, char **data) | ||
| { | ||
|
|
||
| T2Debug("%s ++in\n", __FUNCTION__); | ||
| T2Info("%s ++in\n", __FUNCTION__); | ||
|
|
||
| T2Info("%s with url %s \n", __FUNCTION__, httpsUrl); | ||
| CURL *curl; | ||
|
|
@@ -706,6 +740,10 @@ T2ERROR doHttpGet(char* httpsUrl, char **data) | |
| { | ||
| T2Error("%s : Curl set opts failed with error %s \n", __FUNCTION__, curl_easy_strerror(code)); | ||
| } | ||
| curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity Issue - Unchecked return value from libraryCalling "curl_easy_setopt(curl, _curl_opt, 1L)" without checking return value. This library function may fail and return an error code. Medium Impact, CWE-252 |
||
| curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, curl_debug_callback_func); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity Issue - Unchecked return value from libraryCalling "curl_easy_setopt(curl, _curl_opt, curl_debug_callback_func)" without checking return value. This library function may fail and return an error code. Medium Impact, CWE-252 |
||
| curl_easy_setopt(curl, CURLOPT_DEBUGDATA, NULL); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coverity Issue - Unchecked return value from libraryCalling "curl_easy_setopt(curl, _curl_opt, NULL)" without checking return value. This library function may fail and return an error code. Medium Impact, CWE-252 |
||
|
|
||
| #if defined(ENABLE_RDKB_SUPPORT) && !defined(RDKB_EXTENDER) | ||
|
|
||
| #if defined(WAN_FAILOVER_SUPPORTED) || defined(FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE) | ||
|
|
@@ -983,7 +1021,7 @@ status_return : | |
| } | ||
| } | ||
| } | ||
| T2Debug("%s --out\n", __FUNCTION__); | ||
| T2Info("%s --out\n", __FUNCTION__); | ||
| return ret; | ||
|
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverity Issue - Unchecked return value from library
Calling "curl_easy_setopt(curl, _curl_opt, 1L)" without checking return value. This library function may fail and return an error code.
Medium Impact, CWE-252
CHECKED_RETURN