Hello! I want to remove Debug info for libculr when an app run with libcurl and I can’t find how?
Because In DebugView++ I see many debug info from libcurl.
Thanks in advance!
Use SetDebugInfoFilter method.
Thank you Mike. But I need an example please! Is this a curl method? Because I can’t find it.
Thanks in advance!
If you can’t find it, try to upgrade.
I update to last version but I use TCurlHttpClass and not TCurlClass.
The SetDebugInfoFilter is only in TCurlClass.
Thank you!
Read “CLASS (object declaration)” topic in the Clarion help.
GetImage PROCEDURE(STRING pURL, *STRING pErrorMsg)
curl TCurlHttpClass
res CURLcode
tempFileName STRING(255)
CODE
pErrorMsg = ''
tempFileName = CLIP(COM:S1URL4)
curl.Init()
IF UPPER(SUB(CLIP(pURL),1,5)) = 'HTTPS'
res = curl.SetSSLVerifyHost(FALSE)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVerifyHost Error: ' & curl.StrError(res)
RETURN
END
res = curl.SetSSLVerifyPeer(FALSE)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVerifyPeer Error: ' & curl.StrError(res)
RETURN
END
res = curl.SetSSLVersion(CURL_SSLVERSION_DEFAULT)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVersion Error: ' & curl.StrError(res)
RETURN
END
END
res = curl.ReadFile(pURL, tempFileName)
IF res = CURLE_OK
ELSIF res = -1
pErrorMsg = 'Cannot create local file: ' & tempFileName
ELSE
pErrorMsg = 'Download failed: ' & curl.StrError(res)
END
curl.Cleanup()
RETURN
Doesn’t this throw a compilation error, because the SetSSLVerifyHost method isn’t in TCurlHttpClass?
The version that I use now and compiled is:
GetImage PROCEDURE(STRING pURL, *STRING pErrorMsg)
curl TCurlHttpClass
res CURLcode
tempFileName STRING(255)
CODE
pErrorMsg = ''
tempFileName = CLIP(COM:S1URL4)
curl.Init()
res = curl.SetOpt(CURLOPT_VERBOSE, FALSE)
res = curl.SetOpt(CURLOPT_DEBUGFUNCTION, 0)
IF UPPER(SUB(CLIP(pURL),1,5)) = 'HTTPS'
res = curl.SetSSLVerifyHost(FALSE)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVerifyHost Error: ' & curl.StrError(res)
RETURN
END
res = curl.SetSSLVerifyPeer(FALSE)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVerifyPeer Error: ' & curl.StrError(res)
RETURN
END
res = curl.SetSSLVersion(CURL_SSLVERSION_DEFAULT)
IF res <> CURLE_OK
pErrorMsg = 'SetSSLVersion Error: ' & curl.StrError(res)
RETURN
END
END
res = curl.ReadFile(pURL, tempFileName)
IF res = CURLE_OK
ELSIF res = -1
pErrorMsg = 'Cannot create local file: ' & tempFileName
ELSE
pErrorMsg = 'Download failed: ' & curl.StrError(res)
END
curl.Cleanup()
RETURN
Yup, so much effort just to avoid reading the help
I don’t understand what you mean. I read the help but I can’t find how to make debug off.
@Michael_Diamantidis , maybe this help (CLASSes are not my strong part in Clarion)
First declare the class you want to use
curlLog CLASS(TCurlClass)
END!Class
Then (i guess at the init of the procedure) set this
curlLog.SetDebugInfoFilter(CURL_DEBUGINFO_NONE)
CURL_DEBUGINFO_NONE is an equate defined in libcurl.inc, there are other options as well. The default is CURL_DEBUGINFO_ALL
!- Debug info bits
CURL_DEBUGINFO_TEXT EQUATE(00000001b) !- informational text
CURL_DEBUGINFO_HEADER_IN EQUATE(00000010b) !- header (or header-like) data received from the peer
CURL_DEBUGINFO_HEADER_OUT EQUATE(00000100b) !- header (or header-like) data sent to the peer
CURL_DEBUGINFO_DATA_IN EQUATE(00001000b) !- unprocessed protocol data received from the peer
CURL_DEBUGINFO_DATA_OUT EQUATE(00010000b) !- protocol data sent to the peer
CURL_DEBUGINFO_SSL_DATA_IN EQUATE(00100000b) !- SSL/TLS (binary) data received from the peer
CURL_DEBUGINFO_SSL_DATA_OUT EQUATE(01000000b) !- SSL/TLS (binary) data sent to the peer
CURL_DEBUGINFO_IN EQUATE(00101011b) !- incoming on;ly
CURL_DEBUGINFO_OUT EQUATE(01010101b) !- outgoing only
!bitmasks
CURL_DEBUGINFO_NONE EQUATE(00000000b) !- off
CURL_DEBUGINFO_NO_DATA_IN EQUATE(11010111b) !- don't log CURL_DEBUGINFO_DATA_IN and CURL_DEBUGINFO_SSL_DATA_IN
CURL_DEBUGINFO_NO_DATA_OUT EQUATE(10101111b) !- don't log CURL_DEBUGINFO_DATA_OUT and CURL_DEBUGINFO_SSL_DATA_OUT
CURL_DEBUGINFO_NO_DATA EQUATE(00000111b) !- don't log any DATA
CURL_DEBUGINFO_ALL EQUATE(11111111b) !- no filters
Once again, to filter or completely turn the debug logging off I suggested
Use SetDebugInfoFilter method.
but it doesn’t work for you for some reason, no problem.
Ha! I figure it out
Check the example DownloadFile.clw @Michael_Diamantidis that is included in the libcurl template.
Hope this helps
Thank you for your help!