I did this
I built libcurl for multiple SSL-backends (including MBedTLS) and with
-DMBEDTLS_DEBUG=1 -DMBEDTLS_DEBUG_C=1 -DCURLDEBUG=1 in my CFLAGS.
But the result of running:
set CURL_SSL_BACKEND=mbedtls
curl --trace-ascii mbedtls-trace.txt https://example.com
or:
curl --trace-ascii - https://example.com > mbedtls-trace.txt
looks awful:
...
== Info: Didn't find Session ID in cache for host HTTPS://example.com:443
== Info: ALPN: curl offers h2,http/1.1
== Info: => handshake
== Info: => flush output
== Info: <= flush output
== Info: client state: MBEDTLS_SSL_HELLO_REQUEST
...
Since the function mbed_debug() already gets the line with \n termination.
And then infof() adds another \n to the output. Hence I stripped off the last \n and it looks better:
--- a/vtls/mbedtls.c 2024-04-08 15:10:01
+++ b/vtls/mbedtls.c 2024-04-09 06:42:19
@@ -164,13 +164,25 @@
int line_nb, const char *line)
{
struct Curl_easy *data = NULL;
+ const char *nl;
+ int len;
if(!context)
return;
data = (struct Curl_easy *)context;
+ nl = strrchr (line, '\n');
+ if (nl)
+ len = nl - line;
+ else
+ len = strlen(line);
+ infof(data, "%.*s", len, line);
- infof(data, "%s", line);
(void) level;
}
#endif
But as an added bonus, I'd like that a curl -vv https://example.com 2> mbedtls-trace.txt (verbose level 2), to
include the filename and line from MBedTls:
if (data->set.verbose >= 2)
infof(data, "%s(%u): %.*s", f_name, line_nb, len, line);
else
infof(data, "%.*s", len, line);
But that seems impossible now. How is this supposed to be handled?
I expected the following
No empty lines (like for other SSL-backends),
curl/libcurl version
curl 8.7.2-DEV (x86_64-pc-win32) from git master yesterday.
operating system
Win-10.
I did this
I built libcurl for multiple SSL-backends (including MBedTLS) and with
-DMBEDTLS_DEBUG=1 -DMBEDTLS_DEBUG_C=1 -DCURLDEBUG=1in myCFLAGS.But the result of running:
or:
looks awful:
Since the function
mbed_debug()already gets the line with\ntermination.And then
infof()adds another\nto the output. Hence I stripped off the last\nand it looks better:But as an added bonus, I'd like that a
curl -vv https://example.com 2> mbedtls-trace.txt(verbose level 2), toinclude the filename and line from MBedTls:
But that seems impossible now. How is this supposed to be handled?
I expected the following
No empty lines (like for other SSL-backends),
curl/libcurl version
curl 8.7.2-DEV (x86_64-pc-win32)fromgit masteryesterday.operating system
Win-10.