mirror of
https://github.com/curl/curl.git
synced 2026-08-26 10:53:36 +03:00
Error out on old medTLS versions immediately (as per @bagder request). Also, clarify debug function to exit-out early on "empty" lines. Should quiet up valgrind warnings.
This commit is contained in:
parent
857f445a9d
commit
67d1792d1f
1 changed files with 20 additions and 6 deletions
|
|
@ -71,6 +71,12 @@
|
||||||
#include "../curl_memory.h"
|
#include "../curl_memory.h"
|
||||||
#include "../memdebug.h"
|
#include "../memdebug.h"
|
||||||
|
|
||||||
|
/* Error-out on old mbedTLS versions immediately */
|
||||||
|
#if MBEDTLS_VERSION_NUMBER < 0x03060000
|
||||||
|
/* https://github.com/Mbed-TLS/mbedtls/releases */
|
||||||
|
#error "mbedTLS 3.6.x is the oldest supported version of mbedTLS"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ALPN for http2 */
|
/* ALPN for http2 */
|
||||||
#if defined(USE_HTTP2) && defined(MBEDTLS_SSL_ALPN)
|
#if defined(USE_HTTP2) && defined(MBEDTLS_SSL_ALPN)
|
||||||
# define HAS_ALPN_MBEDTLS
|
# define HAS_ALPN_MBEDTLS
|
||||||
|
|
@ -138,14 +144,22 @@ static void mbed_debug(void *context, int level, const char *f_name,
|
||||||
(void)level;
|
(void)level;
|
||||||
(void)line_nb;
|
(void)line_nb;
|
||||||
(void)f_name;
|
(void)f_name;
|
||||||
|
size_t len = line ? strlen(line) : 0;
|
||||||
|
|
||||||
if(data) {
|
/* bail out on nowhere to write data
|
||||||
size_t len = strlen(line);
|
or if data is empty */
|
||||||
if(len && (line[len - 1] == '\n'))
|
if(!data || len == 0 || line[0] == 0)
|
||||||
/* discount any trailing newline */
|
return;
|
||||||
len--;
|
|
||||||
infof(data, "%.*s", (int)len, line);
|
/* discount any trailing newline */
|
||||||
|
if(line[len - 1] == '\n'){
|
||||||
|
len--;
|
||||||
|
|
||||||
|
if(len == 0)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infof(data, "%.*s", (int)len, line);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue