build: fully omit verbose strings and code when disabled

When the compiler supports C99.

- map logging functions to macro stubs when verbose logging is disabled
  and the compiler is C99. Make sure these stubs silence unused variable
  warnings for non-variadic arguments.
  Before this patch they mapped to function stubs, the same codepath
  used for C89 compiler in this configuration.

- introduce new macros to tell the compiler which code to include
  when verbose code is active, or inactive:

  - `CURLVERBOSE`: defined when verbose code is active.
    To enclose blocks of code only used for verbose logging.

  - `VERBOSE(statement);`:
    compile statement when verbose code is active.
    To mark code lines only used for verbose logging.

  - `NOVERBOSE(statement);`:
    compile statement when verbose code is inactive.
    To suppress warnings for arguments passed to logging functions via
    printf masks, e.g. `NOVERBOSE((void)ipaddress);`, yet keeping
    the warning in verbose builds.

  Note these macros are not the same as `CURL_DISABLE_VERBOSE_STRINGS`.
  Verbose code is always active in C89 mode (without variadic macro
  support).

- drop existing uses of `CURL_DISABLE_VERBOSE_STRINGS` where redundant,
  or replace with the above macros. Ending up reducing the number of
  `#ifdef`s, and also the number of lines.

Assisted-by: Daniel Stenberg
Assisted-by: Jay Satiro
Reported-by: Dan Fandrich
Fixes #20341
Refs: #12105 #12167

Closes #20353
This commit is contained in:
Viktor Szakats 2026-01-19 07:29:43 +01:00
parent e286589c71
commit 61093e2a81
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
49 changed files with 294 additions and 265 deletions

View file

@ -192,8 +192,9 @@ jobs:
- name: 'openssl arm C89' - name: 'openssl arm C89'
image: ubuntu-24.04-arm image: ubuntu-24.04-arm
install_packages: libssh2-1-dev
install_steps: pytest install_steps: pytest
configure: CFLAGS=-std=gnu89 --with-openssl --enable-debug --disable-verbose configure: CFLAGS=-std=gnu89 --with-openssl --with-libssh2 --enable-debug --disable-verbose
- name: 'openssl -O3 libssh valgrind 1' - name: 'openssl -O3 libssh valgrind 1'
install_packages: libssh-dev valgrind install_packages: libssh-dev valgrind

View file

@ -39,7 +39,7 @@
#define CURL_NEW_ENV_VAR 0 #define CURL_NEW_ENV_VAR 0
#define CURL_NEW_ENV_VALUE 1 #define CURL_NEW_ENV_VALUE 1
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
/* /*
* The telnet options represented as strings * The telnet options represented as strings
*/ */
@ -81,7 +81,7 @@ static const char * const telnetoptions[] = {
#define CURL_DONT 254 /* DO NOT use this option! */ #define CURL_DONT 254 /* DO NOT use this option! */
#define CURL_IAC 255 /* Interpret As Command */ #define CURL_IAC 255 /* Interpret As Command */
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
/* /*
* Then those numbers represented as strings: * Then those numbers represented as strings:
*/ */
@ -104,7 +104,7 @@ static const char * const telnetcmds[] = {
#define CURL_TELCMD_OK(x) (((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \ #define CURL_TELCMD_OK(x) (((unsigned int)(x) >= CURL_TELCMD_MINIMUM) && \
((unsigned int)(x) <= CURL_TELCMD_MAXIMUM)) ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM))
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
#define CURL_TELCMD(x) telnetcmds[(x) - CURL_TELCMD_MINIMUM] #define CURL_TELCMD(x) telnetcmds[(x) - CURL_TELCMD_MINIMUM]
#else #else
#define CURL_TELCMD(x) "" #define CURL_TELCMD(x) ""

View file

@ -740,7 +740,7 @@ CURLcode Curl_async_getaddrinfo(struct Curl_easy *data, const char *hostname,
ares->ares_status = ARES_ENOTFOUND; ares->ares_status = ARES_ENOTFOUND;
ares->result = CURLE_OK; ares->result = CURLE_OK;
#if !defined(CURL_DISABLE_VERBOSE_STRINGS) && \ #if defined(CURLVERBOSE) && \
ARES_VERSION >= 0x011800 /* >= v1.24.0 */ ARES_VERSION >= 0x011800 /* >= v1.24.0 */
if(CURL_TRC_DNS_is_verbose(data)) { if(CURL_TRC_DNS_is_verbose(data)) {
char *csv = ares_get_servers_csv(ares->channel); char *csv = ares_get_servers_csv(ares->channel);

View file

@ -426,7 +426,7 @@ static ssize_t on_session_send(nghttp2_session *h2,
NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten; NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static int proxy_h2_fr_print(const nghttp2_frame *frame, static int proxy_h2_fr_print(const nghttp2_frame *frame,
char *buffer, size_t blen) char *buffer, size_t blen)
{ {
@ -516,7 +516,7 @@ static int proxy_h2_on_frame_send(nghttp2_session *session,
} }
return 0; return 0;
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
static int proxy_h2_on_frame_recv(nghttp2_session *session, static int proxy_h2_on_frame_recv(nghttp2_session *session,
const nghttp2_frame *frame, const nghttp2_frame *frame,
@ -529,7 +529,7 @@ static int proxy_h2_on_frame_recv(nghttp2_session *session,
(void)session; (void)session;
DEBUGASSERT(data); DEBUGASSERT(data);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_cf_is_verbose(cf, data)) { if(Curl_trc_cf_is_verbose(cf, data)) {
char buffer[256]; char buffer[256];
int len; int len;
@ -537,7 +537,7 @@ static int proxy_h2_on_frame_recv(nghttp2_session *session,
buffer[len] = 0; buffer[len] = 0;
CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer); CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer);
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
if(!stream_id) { if(!stream_id) {
/* stream ID zero is for connection-oriented stuff */ /* stream ID zero is for connection-oriented stuff */
@ -973,7 +973,7 @@ static CURLcode cf_h2_proxy_ctx_init(struct Curl_cfilter *cf,
nghttp2_session_callbacks_set_send_callback(cbs, on_session_send); nghttp2_session_callbacks_set_send_callback(cbs, on_session_send);
nghttp2_session_callbacks_set_on_frame_recv_callback( nghttp2_session_callbacks_set_on_frame_recv_callback(
cbs, proxy_h2_on_frame_recv); cbs, proxy_h2_on_frame_recv);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
nghttp2_session_callbacks_set_on_frame_send_callback(cbs, nghttp2_session_callbacks_set_on_frame_send_callback(cbs,
proxy_h2_on_frame_send); proxy_h2_on_frame_send);
#endif #endif

View file

@ -351,7 +351,8 @@ static CURLcode cf_ip_ballers_run(struct cf_ip_ballers *bs,
struct cf_ip_attempt *a = NULL, **panchor; struct cf_ip_attempt *a = NULL, **panchor;
bool do_more; bool do_more;
timediff_t next_expire_ms; timediff_t next_expire_ms;
int i, inconclusive, ongoing; int inconclusive, ongoing;
VERBOSE(int i);
if(bs->winner) if(bs->winner)
return CURLE_OK; return CURLE_OK;
@ -360,9 +361,9 @@ evaluate:
ongoing = inconclusive = 0; ongoing = inconclusive = 0;
/* check if a running baller connects now */ /* check if a running baller connects now */
i = -1; VERBOSE(i = -1);
for(panchor = &bs->running; *panchor; panchor = &((*panchor)->next)) { for(panchor = &bs->running; *panchor; panchor = &((*panchor)->next)) {
++i; VERBOSE(++i);
a = *panchor; a = *panchor;
a->result = cf_ip_attempt_connect(a, data, connected); a->result = cf_ip_attempt_connect(a, data, connected);
if(!a->result) { if(!a->result) {
@ -455,9 +456,9 @@ evaluate:
timediff_t delay_ms = bs->attempt_delay_ms - since_ms; timediff_t delay_ms = bs->attempt_delay_ms - since_ms;
if(delay_ms <= 0) { if(delay_ms <= 0) {
CURL_TRC_CF(data, cf, "all attempts inconclusive, restarting one"); CURL_TRC_CF(data, cf, "all attempts inconclusive, restarting one");
i = -1; VERBOSE(i = -1);
for(a = bs->running; a; a = a->next) { for(a = bs->running; a; a = a->next) {
++i; VERBOSE(++i);
if(!a->inconclusive) if(!a->inconclusive)
continue; continue;
result = cf_ip_attempt_restart(a, cf, data); result = cf_ip_attempt_restart(a, cf, data);
@ -482,7 +483,7 @@ evaluate:
/* no more addresses, no inconclusive attempts */ /* no more addresses, no inconclusive attempts */
CURL_TRC_CF(data, cf, "no more attempts to try"); CURL_TRC_CF(data, cf, "no more attempts to try");
result = CURLE_COULDNT_CONNECT; result = CURLE_COULDNT_CONNECT;
i = 0; VERBOSE(i = 0);
for(a = bs->running; a; a = a->next) { for(a = bs->running; a; a = a->next) {
CURL_TRC_CF(data, cf, "baller %d: result=%d", i, a->result); CURL_TRC_CF(data, cf, "baller %d: result=%d", i, a->result);
if(a->result) if(a->result)
@ -795,7 +796,7 @@ static CURLcode cf_ip_happy_connect(struct Curl_cfilter *cf,
if(cf->conn->scheme->protocol & PROTO_FAMILY_SSH) if(cf->conn->scheme->protocol & PROTO_FAMILY_SSH)
Curl_pgrsTime(data, TIMER_APPCONNECT); /* we are connected already */ Curl_pgrsTime(data, TIMER_APPCONNECT); /* we are connected already */
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_cf_is_verbose(cf, data)) { if(Curl_trc_cf_is_verbose(cf, data)) {
struct ip_quadruple ipquad; struct ip_quadruple ipquad;
bool is_ipv6; bool is_ipv6;

View file

@ -84,7 +84,7 @@ static void tcpnodelay(struct Curl_cfilter *cf,
#if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED) #if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED)
curl_socklen_t onoff = (curl_socklen_t)1; curl_socklen_t onoff = (curl_socklen_t)1;
int level = IPPROTO_TCP; int level = IPPROTO_TCP;
char buffer[STRERROR_LEN]; VERBOSE(char buffer[STRERROR_LEN]);
if(setsockopt(sockfd, level, TCP_NODELAY, if(setsockopt(sockfd, level, TCP_NODELAY,
(void *)&onoff, sizeof(onoff)) < 0) (void *)&onoff, sizeof(onoff)) < 0)
@ -834,15 +834,12 @@ static CURLcode socket_connect_result(struct Curl_easy *data,
default: default:
/* unknown error, fallthrough and try another address! */ /* unknown error, fallthrough and try another address! */
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)ipaddress;
#else
{ {
char buffer[STRERROR_LEN]; VERBOSE(char buffer[STRERROR_LEN]);
infof(data, "Immediate connect fail for %s: %s", ipaddress, infof(data, "Immediate connect fail for %s: %s", ipaddress,
curlx_strerror(error, buffer, sizeof(buffer))); curlx_strerror(error, buffer, sizeof(buffer)));
NOVERBOSE((void)ipaddress);
} }
#endif
data->state.os_errno = error; data->state.os_errno = error;
/* connect failed */ /* connect failed */
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
@ -982,14 +979,13 @@ static void set_local_ip(struct Curl_cfilter *cf,
if((ctx->sock != CURL_SOCKET_BAD) && if((ctx->sock != CURL_SOCKET_BAD) &&
!(data->conn->scheme->protocol & CURLPROTO_TFTP)) { !(data->conn->scheme->protocol & CURLPROTO_TFTP)) {
/* TFTP does not connect, so it cannot get the IP like this */ /* TFTP does not connect, so it cannot get the IP like this */
char buffer[STRERROR_LEN];
struct Curl_sockaddr_storage ssloc; struct Curl_sockaddr_storage ssloc;
curl_socklen_t slen = sizeof(struct Curl_sockaddr_storage); curl_socklen_t slen = sizeof(struct Curl_sockaddr_storage);
VERBOSE(char buffer[STRERROR_LEN]);
memset(&ssloc, 0, sizeof(ssloc)); memset(&ssloc, 0, sizeof(ssloc));
if(getsockname(ctx->sock, (struct sockaddr *)&ssloc, &slen)) { if(getsockname(ctx->sock, (struct sockaddr *)&ssloc, &slen)) {
int error = SOCKERRNO; VERBOSE(int error = SOCKERRNO);
infof(data, "getsockname() failed with errno %d: %s", infof(data, "getsockname() failed with errno %d: %s",
error, curlx_strerror(error, buffer, sizeof(buffer))); error, curlx_strerror(error, buffer, sizeof(buffer)));
} }
@ -1292,19 +1288,15 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf,
out: out:
if(result) { if(result) {
if(ctx->error) { if(ctx->error) {
VERBOSE(char buffer[STRERROR_LEN]);
set_local_ip(cf, data); set_local_ip(cf, data);
data->state.os_errno = ctx->error; data->state.os_errno = ctx->error;
SET_SOCKERRNO(ctx->error); SET_SOCKERRNO(ctx->error);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
{
char buffer[STRERROR_LEN];
infof(data, "connect to %s port %u from %s port %d failed: %s", infof(data, "connect to %s port %u from %s port %d failed: %s",
ctx->ip.remote_ip, ctx->ip.remote_port, ctx->ip.remote_ip, ctx->ip.remote_port,
ctx->ip.local_ip, ctx->ip.local_port, ctx->ip.local_ip, ctx->ip.local_port,
curlx_strerror(ctx->error, buffer, sizeof(buffer))); curlx_strerror(ctx->error, buffer, sizeof(buffer)));
} }
#endif
}
if(ctx->sock != CURL_SOCKET_BAD) { if(ctx->sock != CURL_SOCKET_BAD) {
socket_close(data, cf->conn, TRUE, ctx->sock); socket_close(data, cf->conn, TRUE, ctx->sock);
ctx->sock = CURL_SOCKET_BAD; ctx->sock = CURL_SOCKET_BAD;
@ -1380,8 +1372,8 @@ static CURLcode cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data,
struct cf_socket_ctx *ctx = cf->ctx; struct cf_socket_ctx *ctx = cf->ctx;
curl_socket_t fdsave; curl_socket_t fdsave;
ssize_t rv; ssize_t rv;
size_t orig_len = len;
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
VERBOSE(size_t orig_len = len);
(void)eos; (void)eos;
*pnwritten = 0; *pnwritten = 0;
@ -1476,10 +1468,9 @@ static CURLcode cf_socket_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
} }
} }
if(cf->cft != &Curl_cft_udp && ctx->recv_max && ctx->recv_max < len) { if(cf->cft != &Curl_cft_udp && ctx->recv_max && ctx->recv_max < len) {
size_t orig_len = len;
len = ctx->recv_max;
CURL_TRC_CF(data, cf, "recv(len=%zu) SIMULATE max read of %zu bytes", CURL_TRC_CF(data, cf, "recv(len=%zu) SIMULATE max read of %zu bytes",
orig_len, len); len, ctx->recv_max);
len = ctx->recv_max;
} }
#endif #endif

View file

@ -420,7 +420,7 @@ CURLcode Curl_conn_cf_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
return CURLE_RECV_ERROR; return CURLE_RECV_ERROR;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static CURLcode cf_verboseconnect(struct Curl_easy *data, static CURLcode cf_verboseconnect(struct Curl_easy *data,
struct Curl_cfilter *cf) struct Curl_cfilter *cf)
{ {
@ -535,9 +535,7 @@ CURLcode Curl_conn_connect(struct Curl_easy *data,
cf_cntrl_update_info(data, data->conn); cf_cntrl_update_info(data, data->conn);
conn_report_connect_stats(cf, data); conn_report_connect_stats(cf, data);
data->conn->keepalive = *Curl_pgrs_now(data); data->conn->keepalive = *Curl_pgrs_now(data);
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(result = cf_verboseconnect(data, cf));
result = cf_verboseconnect(data, cf);
#endif
goto out; goto out;
} }
else if(result) { else if(result) {

View file

@ -297,7 +297,7 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
*/ */
void Curl_conncontrol(struct connectdata *conn, void Curl_conncontrol(struct connectdata *conn,
int ctrl /* see defines in header */ int ctrl /* see defines in header */
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
, const char *reason , const char *reason
#endif #endif
) )
@ -307,7 +307,7 @@ void Curl_conncontrol(struct connectdata *conn,
associated with a transfer. */ associated with a transfer. */
bool closeit, is_multiplex; bool closeit, is_multiplex;
DEBUGASSERT(conn); DEBUGASSERT(conn);
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
(void)reason; /* useful for debugging */ (void)reason; /* useful for debugging */
#endif #endif
is_multiplex = Curl_conn_is_multiplex(conn, FIRSTSOCKET); is_multiplex = Curl_conn_is_multiplex(conn, FIRSTSOCKET);

View file

@ -93,16 +93,16 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
void Curl_conncontrol(struct connectdata *conn, void Curl_conncontrol(struct connectdata *conn,
int closeit int closeit
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
, const char *reason , const char *reason
#endif #endif
); );
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
#define streamclose(x, y) Curl_conncontrol(x, CONNCTRL_STREAM, y) #define streamclose(x, y) Curl_conncontrol(x, CONNCTRL_STREAM, y)
#define connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION, y) #define connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION, y)
#define connkeep(x, y) Curl_conncontrol(x, CONNCTRL_KEEP, y) #define connkeep(x, y) Curl_conncontrol(x, CONNCTRL_KEEP, y)
#else /* if !DEBUGBUILD || CURL_DISABLE_VERBOSE_STRINGS */ #else /* !DEBUGBUILD || !CURLVERBOSE */
#define streamclose(x, y) Curl_conncontrol(x, CONNCTRL_STREAM) #define streamclose(x, y) Curl_conncontrol(x, CONNCTRL_STREAM)
#define connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION) #define connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION)
#define connkeep(x, y) Curl_conncontrol(x, CONNCTRL_KEEP) #define connkeep(x, y) Curl_conncontrol(x, CONNCTRL_KEEP)

View file

@ -183,7 +183,7 @@ void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data,
static void sasl_state(struct SASL *sasl, struct Curl_easy *data, static void sasl_state(struct SASL *sasl, struct Curl_easy *data,
saslstate newstate) saslstate newstate)
{ {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* for debug purposes */ /* for debug purposes */
static const char * const names[]={ static const char * const names[]={
"STOP", "STOP",
@ -834,7 +834,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
return result; return result;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static void sasl_unchosen(struct Curl_easy *data, unsigned short mech, static void sasl_unchosen(struct Curl_easy *data, unsigned short mech,
unsigned short enabledmechs, unsigned short enabledmechs,
bool built_in, bool platform, bool built_in, bool platform,
@ -865,11 +865,11 @@ static void sasl_unchosen(struct Curl_easy *data, unsigned short mech,
infof(data, "SASL: %s is missing username", mname); infof(data, "SASL: %s is missing username", mname);
} }
} }
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
CURLcode Curl_sasl_is_blocked(struct SASL *sasl, struct Curl_easy *data) CURLcode Curl_sasl_is_blocked(struct SASL *sasl, struct Curl_easy *data)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
#ifdef USE_KERBEROS5 #ifdef USE_KERBEROS5
#define CURL_SASL_KERBEROS5 TRUE #define CURL_SASL_KERBEROS5 TRUE
#else #else
@ -924,7 +924,7 @@ CURLcode Curl_sasl_is_blocked(struct SASL *sasl, struct Curl_easy *data)
data->set.str[STRING_BEARER] ? data->set.str[STRING_BEARER] ?
NULL : "CURLOPT_XOAUTH2_BEARER"); NULL : "CURLOPT_XOAUTH2_BEARER");
} }
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
(void)sasl; (void)sasl;
(void)data; (void)data;
return CURLE_LOGIN_DENIED; return CURLE_LOGIN_DENIED;

View file

@ -1217,4 +1217,18 @@ typedef struct sockaddr_un {
# define CURL_INLINE /* empty */ # define CURL_INLINE /* empty */
#endif #endif
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CURL_HAVE_C99
#endif
#if (defined(CURL_HAVE_C99) && !defined(CURL_DISABLE_VERBOSE_STRINGS)) || \
!defined(CURL_HAVE_C99)
#define CURLVERBOSE
#define VERBOSE(x) x
#define NOVERBOSE(x) Curl_nop_stmt
#else
#define VERBOSE(x) Curl_nop_stmt
#define NOVERBOSE(x) x
#endif
#endif /* HEADER_CURL_SETUP_H */ #endif /* HEADER_CURL_SETUP_H */

View file

@ -194,6 +194,29 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
} }
} }
#ifdef CURLVERBOSE
struct curl_trc_feat Curl_trc_feat_multi = {
"MULTI",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_read = {
"READ",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_write = {
"WRITE",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_dns = {
"DNS",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_timer = {
"TIMER",
CURL_LOG_LVL_NONE,
};
#endif
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURL_DISABLE_VERBOSE_STRINGS
static void trc_infof(struct Curl_easy *data, static void trc_infof(struct Curl_easy *data,
@ -248,27 +271,6 @@ void Curl_trc_cf_infof(struct Curl_easy *data, const struct Curl_cfilter *cf,
} }
} }
struct curl_trc_feat Curl_trc_feat_multi = {
"MULTI",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_read = {
"READ",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_write = {
"WRITE",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_dns = {
"DNS",
CURL_LOG_LVL_NONE,
};
struct curl_trc_feat Curl_trc_feat_timer = {
"TIMER",
CURL_LOG_LVL_NONE,
};
static const char * const Curl_trc_timer_names[] = { static const char * const Curl_trc_timer_names[] = {
"100_TIMEOUT", "100_TIMEOUT",
"ASYNC_NAME", "ASYNC_NAME",

View file

@ -64,10 +64,6 @@ void Curl_failf(struct Curl_easy *data,
#define CURL_LOG_LVL_NONE 0 #define CURL_LOG_LVL_NONE 0
#define CURL_LOG_LVL_INFO 1 #define CURL_LOG_LVL_INFO 1
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CURL_HAVE_C99
#endif
/** /**
* Output an informational message when transfer's verbose logging is enabled. * Output an informational message when transfer's verbose logging is enabled.
*/ */
@ -206,7 +202,70 @@ void Curl_trc_ws(struct Curl_easy *data,
} while(0) } while(0)
#endif /* !CURL_DISABLE_WEBSOCKETS && !CURL_DISABLE_HTTP */ #endif /* !CURL_DISABLE_WEBSOCKETS && !CURL_DISABLE_HTTP */
#else /* CURL_HAVE_C99 */ #elif defined(CURL_HAVE_C99) && defined(CURL_DISABLE_VERBOSE_STRINGS)
#define infof(data, ...) \
do { \
(void)data; \
} while(0)
#define CURL_TRC_M(data, ...) \
do { \
(void)(data); \
} while(0)
#define CURL_TRC_CF(data, cf, ...) \
do { \
(void)(data); \
(void)(cf); \
} while(0)
#define CURL_TRC_WRITE(data, ...) \
do { \
(void)(data); \
} while(0)
#define CURL_TRC_READ(data, ...) \
do { \
(void)(data); \
} while(0)
#define CURL_TRC_DNS(data, ...) \
do { \
(void)(data); \
} while(0)
#define CURL_TRC_TIMER(data, tid, ...) \
do { \
(void)(data); \
(void)(tid); \
} while(0)
#ifndef CURL_DISABLE_FTP
#define CURL_TRC_FTP(data, ...) \
do { \
(void)(data); \
} while(0)
#endif /* !CURL_DISABLE_FTP */
#ifndef CURL_DISABLE_SMTP
#define CURL_TRC_SMTP(data, ...) \
do { \
(void)(data); \
} while(0)
#endif /* !CURL_DISABLE_SMTP */
#ifdef USE_SSL
#define CURL_TRC_SSLS(data, ...) \
do { \
(void)(data); \
} while(0)
#endif /* USE_SSL */
#ifdef USE_SSH
#define CURL_TRC_SSH(data, ...) \
do { \
(void)(data); \
} while(0)
#endif /* USE_SSH */
#if !defined(CURL_DISABLE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
#define CURL_TRC_WS(data, ...) \
do { \
(void)(data); \
} while(0)
#endif
#else /* !CURL_HAVE_C99 */
#define infof Curl_infof #define infof Curl_infof
#define CURL_TRC_M Curl_trc_multi #define CURL_TRC_M Curl_trc_multi
@ -234,15 +293,16 @@ void Curl_trc_ws(struct Curl_easy *data,
#endif /* !CURL_HAVE_C99 */ #endif /* !CURL_HAVE_C99 */
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
/* informational messages enabled */
extern struct curl_trc_feat Curl_trc_feat_multi; extern struct curl_trc_feat Curl_trc_feat_multi;
extern struct curl_trc_feat Curl_trc_feat_read; extern struct curl_trc_feat Curl_trc_feat_read;
extern struct curl_trc_feat Curl_trc_feat_write; extern struct curl_trc_feat Curl_trc_feat_write;
extern struct curl_trc_feat Curl_trc_feat_dns; extern struct curl_trc_feat Curl_trc_feat_dns;
extern struct curl_trc_feat Curl_trc_feat_timer; extern struct curl_trc_feat Curl_trc_feat_timer;
#endif
#ifndef CURL_DISABLE_VERBOSE_STRINGS
/* informational messages enabled */
#define Curl_trc_is_verbose(data) \ #define Curl_trc_is_verbose(data) \
((data) && (data)->set.verbose && \ ((data) && (data)->set.verbose && \
(!(data)->state.feat || \ (!(data)->state.feat || \
@ -262,13 +322,11 @@ extern struct curl_trc_feat Curl_trc_feat_timer;
#else /* CURL_DISABLE_VERBOSE_STRINGS */ #else /* CURL_DISABLE_VERBOSE_STRINGS */
/* All informational messages are not compiled in for size savings */ /* All informational messages are not compiled in for size savings */
#define Curl_trc_is_verbose(d) (FALSE) #define Curl_trc_is_verbose(d) (FALSE)
#define Curl_trc_cf_is_verbose(x, y) (FALSE) #define Curl_trc_cf_is_verbose(x, y) (FALSE)
#define Curl_trc_ft_is_verbose(x, y) (FALSE) #define Curl_trc_ft_is_verbose(x, y) (FALSE)
#define CURL_MSTATE_NAME(x) ((void)(x), "-") #define CURL_MSTATE_NAME(x) ((void)(x), "-")
#define CURL_TRC_EASY_TIMERS(x) Curl_nop_stmt #define CURL_TRC_EASY_TIMERS(x) Curl_nop_stmt
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* !CURL_DISABLE_VERBOSE_STRINGS */
#endif /* HEADER_CURL_TRC_H */ #endif /* HEADER_CURL_TRC_H */

View file

@ -43,17 +43,15 @@
*/ */
static const char *get_winsock_error(int err, char *buf, size_t len) static const char *get_winsock_error(int err, char *buf, size_t len)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(const char *p);
const char *p; VERBOSE(size_t alen);
size_t alen;
#endif
if(!len) if(!len)
return NULL; return NULL;
*buf = '\0'; *buf = '\0';
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURLVERBOSE
(void)err; (void)err;
return NULL; return NULL;
#else #else

View file

@ -75,7 +75,7 @@ const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen)
*buf = '\0'; *buf = '\0';
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(!curlx_get_winapi_error(err, buf, buflen)) { if(!curlx_get_winapi_error(err, buf, buflen)) {
#if defined(__GNUC__) && __GNUC__ >= 7 #if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic push #pragma GCC diagnostic push

View file

@ -182,6 +182,8 @@ static CURLcode cw_out_cb_write(struct cw_out_ctx *ctx,
size_t nwritten; size_t nwritten;
CURLcode result; CURLcode result;
NOVERBOSE((void)otype);
DEBUGASSERT(data->conn); DEBUGASSERT(data->conn);
*pnwritten = 0; *pnwritten = 0;
Curl_set_in_callback(data, TRUE); Curl_set_in_callback(data, TRUE);

View file

@ -40,7 +40,7 @@
#define DNS_CLASS_IN 0x01 #define DNS_CLASS_IN 0x01
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static const char * const errors[] = { static const char * const errors[] = {
"", "",
"Bad label", "Bad label",
@ -65,7 +65,7 @@ static const char *doh_strerror(DOHcode code)
return "bad error code"; return "bad error code";
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
/* @unittest 1655 /* @unittest 1655
*/ */
@ -324,9 +324,7 @@ static CURLcode doh_probe_run(struct Curl_easy *data,
/* pass in the struct pointer via a local variable to please coverity and /* pass in the struct pointer via a local variable to please coverity and
the gcc typecheck helpers */ the gcc typecheck helpers */
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(doh->state.feat = &Curl_trc_feat_dns);
doh->state.feat = &Curl_trc_feat_dns;
#endif
ERROR_CHECK_SETOPT(CURLOPT_URL, url); ERROR_CHECK_SETOPT(CURLOPT_URL, url);
ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https"); ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https");
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_probe_write_cb); ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_probe_write_cb);
@ -853,7 +851,7 @@ UNITTEST DOHcode doh_resp_decode(const unsigned char *doh,
return DOH_OK; /* ok */ return DOH_OK; /* ok */
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static void doh_show(struct Curl_easy *data, static void doh_show(struct Curl_easy *data,
const struct dohentry *d) const struct dohentry *d)
{ {
@ -1009,7 +1007,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname,
return result; return result;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static const char *doh_type2name(DNStype dnstype) static const char *doh_type2name(DNStype dnstype)
{ {
switch(dnstype) { switch(dnstype) {
@ -1233,12 +1231,10 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
rc[slot] = doh_resp_decode(curlx_dyn_uptr(&p->body), rc[slot] = doh_resp_decode(curlx_dyn_uptr(&p->body),
curlx_dyn_len(&p->body), curlx_dyn_len(&p->body),
p->dnstype, &de); p->dnstype, &de);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(rc[slot]) { if(rc[slot]) {
CURL_TRC_DNS(data, "DoH: %s type %s for %s", doh_strerror(rc[slot]), CURL_TRC_DNS(data, "DoH: %s type %s for %s", doh_strerror(rc[slot]),
doh_type2name(p->dnstype), dohp->host); doh_type2name(p->dnstype), dohp->host);
} }
#endif
} /* next slot */ } /* next slot */
result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */ result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */

View file

@ -84,10 +84,10 @@
/* macro to check for the last line in an FTP server response */ /* macro to check for the last line in an FTP server response */
#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3])) #define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURLVERBOSE
#define ftp_pasv_verbose(a, b, c, d) Curl_nop_stmt #define ftp_pasv_verbose(a, b, c, d) Curl_nop_stmt
#define FTP_CSTATE(c) ((void)(c), "") #define FTP_CSTATE(c) ((void)(c), "")
#else /* CURL_DISABLE_VERBOSE_STRINGS */ #else /* !CURLVERBOSE */
/*************************************************************************** /***************************************************************************
* *
* ftp_pasv_verbose() * ftp_pasv_verbose()
@ -149,7 +149,7 @@ static const char * const ftp_state_names[] = {
}; };
#define FTP_CSTATE(ftpc) ((ftpc) ? ftp_state_names[(ftpc)->state] : "???") #define FTP_CSTATE(ftpc) ((ftpc) ? ftp_state_names[(ftpc)->state] : "???")
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
/* This is the ONLY way to change FTP state! */ /* This is the ONLY way to change FTP state! */
static void ftp_state_low(struct Curl_easy *data, static void ftp_state_low(struct Curl_easy *data,
@ -160,22 +160,16 @@ static void ftp_state_low(struct Curl_easy *data,
#endif #endif
) )
{ {
#ifdef CURL_DISABLE_VERBOSE_STRINGS if(ftpc->state != newstate) {
(void)data;
#ifdef DEBUGBUILD
(void)lineno;
#endif
#else /* CURL_DISABLE_VERBOSE_STRINGS */
if(ftpc->state != newstate)
#ifdef DEBUGBUILD #ifdef DEBUGBUILD
NOVERBOSE((void)lineno);
CURL_TRC_FTP(data, "[%s] -> [%s] (line %d)", FTP_CSTATE(ftpc), CURL_TRC_FTP(data, "[%s] -> [%s] (line %d)", FTP_CSTATE(ftpc),
ftp_state_names[newstate], lineno); ftp_state_names[newstate], lineno);
#else #else
CURL_TRC_FTP(data, "[%s] -> [%s]", FTP_CSTATE(ftpc), CURL_TRC_FTP(data, "[%s] -> [%s]", FTP_CSTATE(ftpc),
ftp_state_names[newstate]); ftp_state_names[newstate]);
#endif #endif
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ }
ftpc->state = newstate; ftpc->state = newstate;
} }

View file

@ -114,7 +114,7 @@
* CURLRES_* defines based on the config*.h and curl_setup.h defines. * CURLRES_* defines based on the config*.h and curl_setup.h defines.
*/ */
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static void show_resolve_info(struct Curl_easy *data, static void show_resolve_info(struct Curl_easy *data,
struct Curl_dns_entry *dns) struct Curl_dns_entry *dns)
{ {
@ -1325,12 +1325,10 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
struct Curl_addrinfo *head = NULL, *tail = NULL; struct Curl_addrinfo *head = NULL, *tail = NULL;
size_t entry_len; size_t entry_len;
char address[64]; char address[64];
#ifndef CURL_DISABLE_VERBOSE_STRINGS
const char *addresses = NULL;
#endif
curl_off_t port = 0; curl_off_t port = 0;
bool permanent = TRUE; bool permanent = TRUE;
bool error = TRUE; bool error = TRUE;
VERBOSE(const char *addresses = NULL);
if(*host == '+') { if(*host == '+') {
host++; host++;
@ -1350,9 +1348,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
curlx_str_single(&host, ':')) curlx_str_single(&host, ':'))
goto err; goto err;
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(addresses = host);
addresses = host;
#endif
/* start the address section */ /* start the address section */
while(*host) { while(*host) {
@ -1460,11 +1456,9 @@ err:
if(!dns) if(!dns)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
infof(data, "Added %.*s:%" CURL_FORMAT_CURL_OFF_T ":%s to DNS cache%s", infof(data, "Added %.*s:%" CURL_FORMAT_CURL_OFF_T ":%s to DNS cache%s",
(int)curlx_strlen(&source), curlx_str(&source), port, addresses, (int)curlx_strlen(&source), curlx_str(&source), port, addresses,
permanent ? "" : " (non-permanent)"); permanent ? "" : " (non-permanent)");
#endif
/* Wildcard hostname */ /* Wildcard hostname */
if(curlx_str_casecompare(&source, "*")) { if(curlx_str_casecompare(&source, "*")) {

View file

@ -394,7 +394,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
* amount remains. This may be overridden by authentications further * amount remains. This may be overridden by authentications further
* below! */ * below! */
bool abort_upload = (!data->req.upload_done && !little_upload_remains); bool abort_upload = (!data->req.upload_done && !little_upload_remains);
const char *ongoing_auth = NULL; VERBOSE(const char *ongoing_auth = NULL);
/* We need a rewind before uploading client read data again. The /* We need a rewind before uploading client read data again. The
* checks below just influence of the upload is to be continued * checks below just influence of the upload is to be continued
@ -416,7 +416,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
#ifdef USE_NTLM #ifdef USE_NTLM
if((data->state.authproxy.picked == CURLAUTH_NTLM) || if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
(data->state.authhost.picked == CURLAUTH_NTLM)) { (data->state.authhost.picked == CURLAUTH_NTLM)) {
ongoing_auth = "NTLM"; VERBOSE(ongoing_auth = "NTLM");
if((conn->http_ntlm_state != NTLMSTATE_NONE) || if((conn->http_ntlm_state != NTLMSTATE_NONE) ||
(conn->proxy_ntlm_state != NTLMSTATE_NONE)) { (conn->proxy_ntlm_state != NTLMSTATE_NONE)) {
/* The NTLM-negotiation has started, keep on sending. /* The NTLM-negotiation has started, keep on sending.
@ -429,7 +429,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
/* There is still data left to send */ /* There is still data left to send */
if((data->state.authproxy.picked == CURLAUTH_NEGOTIATE) || if((data->state.authproxy.picked == CURLAUTH_NEGOTIATE) ||
(data->state.authhost.picked == CURLAUTH_NEGOTIATE)) { (data->state.authhost.picked == CURLAUTH_NEGOTIATE)) {
ongoing_auth = "NEGOTIATE"; VERBOSE(ongoing_auth = "NEGOTIATE");
if((conn->http_negotiate_state != GSS_AUTHNONE) || if((conn->http_negotiate_state != GSS_AUTHNONE) ||
(conn->proxy_negotiate_state != GSS_AUTHNONE)) { (conn->proxy_negotiate_state != GSS_AUTHNONE)) {
/* The NEGOTIATE-negotiation has started, keep on sending. /* The NEGOTIATE-negotiation has started, keep on sending.
@ -1101,8 +1101,10 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
static void http_switch_to_get(struct Curl_easy *data, int code) static void http_switch_to_get(struct Curl_easy *data, int code)
{ {
const char *req = data->set.str[STRING_CUSTOMREQUEST]; const char *req = data->set.str[STRING_CUSTOMREQUEST];
if((req || data->state.httpreq != HTTPREQ_GET) && if((req || data->state.httpreq != HTTPREQ_GET) &&
(data->set.http_follow_mode == CURLFOLLOW_OBEYCODE)) { (data->set.http_follow_mode == CURLFOLLOW_OBEYCODE)) {
NOVERBOSE((void)code);
infof(data, "Switch to GET because of %d response", code); infof(data, "Switch to GET because of %d response", code);
data->state.http_ignorecustom = TRUE; data->state.http_ignorecustom = TRUE;
} }

View file

@ -52,7 +52,7 @@
#error too old nghttp2 version, upgrade! #error too old nghttp2 version, upgrade!
#endif #endif
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURLVERBOSE
#define nghttp2_session_callbacks_set_error_callback(x, y) #define nghttp2_session_callbacks_set_error_callback(x, y)
#endif #endif
@ -1051,7 +1051,7 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf,
return CURLE_OK; return CURLE_OK;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen) static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen)
{ {
switch(frame->hd.type) { switch(frame->hd.type) {
@ -1149,7 +1149,7 @@ static int on_frame_send(nghttp2_session *session, const nghttp2_frame *frame,
} }
return 0; return 0;
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
void *userp) void *userp)
@ -1160,7 +1160,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
int32_t stream_id = frame->hd.stream_id; int32_t stream_id = frame->hd.stream_id;
DEBUGASSERT(data); DEBUGASSERT(data);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_cf_is_verbose(cf, data)) { if(Curl_trc_cf_is_verbose(cf, data)) {
char buffer[256]; char buffer[256];
int len; int len;
@ -1168,7 +1168,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
buffer[len] = 0; buffer[len] = 0;
CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer); CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer);
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
if(!stream_id) { if(!stream_id) {
/* stream ID zero is for connection-oriented stuff */ /* stream ID zero is for connection-oriented stuff */
@ -1238,14 +1238,14 @@ static int cf_h2_on_invalid_frame_recv(nghttp2_session *session,
data = nghttp2_session_get_stream_user_data(session, stream_id); data = nghttp2_session_get_stream_user_data(session, stream_id);
if(data) { if(data) {
struct h2_stream_ctx *stream; struct h2_stream_ctx *stream;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
char buffer[256]; char buffer[256];
int len; int len;
len = fr_print(frame, buffer, sizeof(buffer) - 1); len = fr_print(frame, buffer, sizeof(buffer) - 1);
buffer[len] = 0; buffer[len] = 0;
failf(data, "[HTTP2] [%d] received invalid frame: %s, error %d: %s", failf(data, "[HTTP2] [%d] received invalid frame: %s, error %d: %s",
stream_id, buffer, ngerr, nghttp2_strerror(ngerr)); stream_id, buffer, ngerr, nghttp2_strerror(ngerr));
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
stream = H2_STREAM_CTX(ctx, data); stream = H2_STREAM_CTX(ctx, data);
if(stream) { if(stream) {
nghttp2_submit_rst_stream(ctx->h2, NGHTTP2_FLAG_NONE, nghttp2_submit_rst_stream(ctx->h2, NGHTTP2_FLAG_NONE,
@ -1623,7 +1623,7 @@ static ssize_t req_body_read_callback(nghttp2_session *session,
return (nread == 0) ? NGHTTP2_ERR_DEFERRED : nread; return (nread == 0) ? NGHTTP2_ERR_DEFERRED : nread;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static int error_callback(nghttp2_session *session, static int error_callback(nghttp2_session *session,
const char *msg, const char *msg,
size_t len, size_t len,
@ -2153,7 +2153,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream,
goto out; goto out;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
#define MAX_ACC 60000 /* <64KB to account for some overhead */ #define MAX_ACC 60000 /* <64KB to account for some overhead */
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
size_t acc = 0, i; size_t acc = 0, i;
@ -2400,7 +2400,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
nghttp2_session_callbacks_set_on_frame_recv_callback(cbs, on_frame_recv); nghttp2_session_callbacks_set_on_frame_recv_callback(cbs, on_frame_recv);
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback(cbs, nghttp2_session_callbacks_set_on_invalid_frame_recv_callback(cbs,
cf_h2_on_invalid_frame_recv); cf_h2_on_invalid_frame_recv);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
nghttp2_session_callbacks_set_on_frame_send_callback(cbs, on_frame_send); nghttp2_session_callbacks_set_on_frame_send_callback(cbs, on_frame_send);
#endif #endif
nghttp2_session_callbacks_set_on_data_chunk_recv_callback( nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
@ -2409,7 +2409,7 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
nghttp2_session_callbacks_set_on_begin_headers_callback( nghttp2_session_callbacks_set_on_begin_headers_callback(
cbs, on_begin_headers); cbs, on_begin_headers);
nghttp2_session_callbacks_set_on_header_callback(cbs, on_header); nghttp2_session_callbacks_set_on_header_callback(cbs, on_header);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
nghttp2_session_callbacks_set_error_callback(cbs, error_callback); nghttp2_session_callbacks_set_error_callback(cbs, error_callback);
#endif #endif

View file

@ -466,7 +466,7 @@ static void imap_state(struct Curl_easy *data,
struct imap_conn *imapc, struct imap_conn *imapc,
imapstate newstate) imapstate newstate)
{ {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* for debug purposes */ /* for debug purposes */
static const char * const names[] = { static const char * const names[] = {
"STOP", "STOP",
@ -490,8 +490,9 @@ static void imap_state(struct Curl_easy *data,
if(imapc->state != newstate) if(imapc->state != newstate)
infof(data, "IMAP %p state change from %s to %s", infof(data, "IMAP %p state change from %s to %s",
(void *)imapc, names[imapc->state], names[newstate]); (void *)imapc, names[imapc->state], names[newstate]);
#endif #else
(void)data; (void)data;
#endif
imapc->state = newstate; imapc->state = newstate;
} }

View file

@ -340,7 +340,7 @@ CURLM *curl_multi_init(void)
CURL_TLS_SESSION_SIZE); CURL_TLS_SESSION_SIZE);
} }
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
static void multi_warn_debug(struct Curl_multi *multi, struct Curl_easy *data) static void multi_warn_debug(struct Curl_multi *multi, struct Curl_easy *data)
{ {
if(!multi->warned) { if(!multi->warned) {
@ -597,7 +597,7 @@ static void multi_done_locked(struct connectdata *conn,
void *userdata) void *userdata)
{ {
struct multi_done_ctx *mdctx = userdata; struct multi_done_ctx *mdctx = userdata;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
const char *host = const char *host =
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
conn->bits.socksproxy ? conn->bits.socksproxy ?
@ -612,7 +612,7 @@ static void multi_done_locked(struct connectdata *conn,
#endif #endif
conn->bits.conn_to_port ? conn->conn_to_port : conn->bits.conn_to_port ? conn->conn_to_port :
conn->remote_port; conn->remote_port;
#endif #endif /* CURLVERBOSE */
Curl_detach_connection(data); Curl_detach_connection(data);
@ -632,21 +632,17 @@ static void multi_done_locked(struct connectdata *conn,
Curl_dnscache_prune(data); Curl_dnscache_prune(data);
if(multi_conn_should_close(conn, data, (bool)mdctx->premature)) { if(multi_conn_should_close(conn, data, (bool)mdctx->premature)) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
CURL_TRC_M(data, "multi_done, terminating conn #%" FMT_OFF_T " to %s:%d, " CURL_TRC_M(data, "multi_done, terminating conn #%" FMT_OFF_T " to %s:%d, "
"forbid=%d, close=%d, premature=%d, conn_multiplex=%d", "forbid=%d, close=%d, premature=%d, conn_multiplex=%d",
conn->connection_id, host, port, data->set.reuse_forbid, conn->connection_id, host, port, data->set.reuse_forbid,
conn->bits.close, mdctx->premature, conn->bits.close, mdctx->premature,
Curl_conn_is_multiplex(conn, FIRSTSOCKET)); Curl_conn_is_multiplex(conn, FIRSTSOCKET));
#endif
connclose(conn, "disconnecting"); connclose(conn, "disconnecting");
Curl_conn_terminate(data, conn, (bool)mdctx->premature); Curl_conn_terminate(data, conn, (bool)mdctx->premature);
} }
else if(!Curl_conn_get_max_concurrent(data, conn, FIRSTSOCKET)) { else if(!Curl_conn_get_max_concurrent(data, conn, FIRSTSOCKET)) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS
CURL_TRC_M(data, "multi_done, conn #%" FMT_OFF_T " to %s:%d was shutdown" CURL_TRC_M(data, "multi_done, conn #%" FMT_OFF_T " to %s:%d was shutdown"
" by server, not reusing", conn->connection_id, host, port); " by server, not reusing", conn->connection_id, host, port);
#endif
connclose(conn, "server shutdown"); connclose(conn, "server shutdown");
Curl_conn_terminate(data, conn, (bool)mdctx->premature); Curl_conn_terminate(data, conn, (bool)mdctx->premature);
} }
@ -655,10 +651,8 @@ static void multi_done_locked(struct connectdata *conn,
if(Curl_cpool_conn_now_idle(data, conn)) { if(Curl_cpool_conn_now_idle(data, conn)) {
/* connection kept in the cpool */ /* connection kept in the cpool */
data->state.lastconnect_id = conn->connection_id; data->state.lastconnect_id = conn->connection_id;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
infof(data, "Connection #%" FMT_OFF_T " to host %s:%d left intact", infof(data, "Connection #%" FMT_OFF_T " to host %s:%d left intact",
conn->connection_id, host, port); conn->connection_id, host, port);
#endif
} }
else { else {
/* connection was removed from the cpool and destroyed. */ /* connection was removed from the cpool and destroyed. */
@ -1178,7 +1172,7 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data,
goto out; goto out;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(CURL_TRC_M_is_verbose(data)) { if(CURL_TRC_M_is_verbose(data)) {
size_t timeout_count = Curl_llist_count(&data->state.timeoutlist); size_t timeout_count = Curl_llist_count(&data->state.timeoutlist);
switch(ps->n) { switch(ps->n) {
@ -3045,7 +3039,7 @@ static void multi_mark_expired_as_dirty(struct Curl_multi *multi,
data = Curl_splayget(t); /* assign this for next loop */ data = Curl_splayget(t); /* assign this for next loop */
if(!data) if(!data)
continue; continue;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(CURL_TRC_TIMER_is_verbose(data)) { if(CURL_TRC_TIMER_is_verbose(data)) {
struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist);
if(e) { if(e) {
@ -3325,9 +3319,7 @@ static void multi_timeout(struct Curl_multi *multi,
long *timeout_ms) long *timeout_ms)
{ {
static const struct curltime tv_zero = { 0, 0 }; static const struct curltime tv_zero = { 0, 0 };
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(struct Curl_easy *data = NULL);
struct Curl_easy *data = NULL;
#endif
if(multi->dead) { if(multi->dead) {
*timeout_ms = 0; *timeout_ms = 0;
@ -3354,19 +3346,14 @@ static void multi_timeout(struct Curl_multi *multi,
/* some time left before expiration */ /* some time left before expiration */
timediff_t diff_ms = timediff_t diff_ms =
curlx_timediff_ceil_ms(multi->timetree->key, *pnow); curlx_timediff_ceil_ms(multi->timetree->key, *pnow);
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(data = Curl_splayget(multi->timetree));
data = Curl_splayget(multi->timetree);
#endif
/* this should be safe even on 32-bit archs, as we do not use that /* this should be safe even on 32-bit archs, as we do not use that
overly long timeouts */ overly long timeouts */
*timeout_ms = (long)diff_ms; *timeout_ms = (long)diff_ms;
} }
else { else {
#ifndef CURL_DISABLE_VERBOSE_STRINGS if(multi->timetree)
if(multi->timetree) { VERBOSE(data = Curl_splayget(multi->timetree));
data = Curl_splayget(multi->timetree);
}
#endif
/* 0 means immediately */ /* 0 means immediately */
*timeout_ms = 0; *timeout_ms = 0;
} }
@ -3376,7 +3363,7 @@ static void multi_timeout(struct Curl_multi *multi,
*timeout_ms = -1; *timeout_ms = -1;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(data && CURL_TRC_TIMER_is_verbose(data)) { if(data && CURL_TRC_TIMER_is_verbose(data)) {
struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist);
if(e) { if(e) {

View file

@ -195,6 +195,7 @@ static CURLMcode mev_forget_socket(struct Curl_multi *multi,
/* We managed this socket before, tell the socket callback to forget it. */ /* We managed this socket before, tell the socket callback to forget it. */
if(entry->announced && multi->socket_cb) { if(entry->announced && multi->socket_cb) {
NOVERBOSE((void)cause);
CURL_TRC_M(data, "ev %s, call(fd=%" FMT_SOCKET_T ", ev=REMOVE)", cause, s); CURL_TRC_M(data, "ev %s, call(fd=%" FMT_SOCKET_T ", ev=REMOVE)", cause, s);
mev_in_callback(multi, TRUE); mev_in_callback(multi, TRUE);
rc = multi->socket_cb(data, s, CURL_POLL_REMOVE, rc = multi->socket_cb(data, s, CURL_POLL_REMOVE,

View file

@ -123,7 +123,7 @@ struct ldapreqinfo {
static void oldap_state(struct Curl_easy *data, struct ldapconninfo *li, static void oldap_state(struct Curl_easy *data, struct ldapconninfo *li,
ldapstate newstate) ldapstate newstate)
{ {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* for debug purposes */ /* for debug purposes */
static const char * const names[] = { static const char * const names[] = {
"STOP", "STOP",
@ -140,8 +140,9 @@ static void oldap_state(struct Curl_easy *data, struct ldapconninfo *li,
if(li->state != newstate) if(li->state != newstate)
infof(data, "LDAP %p state change from %s to %s", infof(data, "LDAP %p state change from %s to %s",
(void *)li, names[li->state], names[newstate]); (void *)li, names[li->state], names[newstate]);
#endif #else
(void)data; (void)data;
#endif
li->state = newstate; li->state = newstate;
} }

View file

@ -388,7 +388,7 @@ static void pop3_state(struct Curl_easy *data, pop3state newstate)
struct pop3_conn *pop3c = struct pop3_conn *pop3c =
Curl_conn_meta_get(data->conn, CURL_META_POP3_CONN); Curl_conn_meta_get(data->conn, CURL_META_POP3_CONN);
if(pop3c) { if(pop3c) {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* for debug purposes */ /* for debug purposes */
static const char * const names[] = { static const char * const names[] = {
"STOP", "STOP",

View file

@ -319,7 +319,7 @@ static curl_off_t smb_swap64(curl_off_t x)
static void conn_state(struct Curl_easy *data, struct smb_conn *smbc, static void conn_state(struct Curl_easy *data, struct smb_conn *smbc,
enum smb_conn_state newstate) enum smb_conn_state newstate)
{ {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* For debug purposes */ /* For debug purposes */
static const char * const names[] = { static const char * const names[] = {
"SMB_NOT_CONNECTED", "SMB_NOT_CONNECTED",
@ -333,8 +333,9 @@ static void conn_state(struct Curl_easy *data, struct smb_conn *smbc,
if(smbc->state != newstate) if(smbc->state != newstate)
infof(data, "SMB conn %p state change from %s to %s", infof(data, "SMB conn %p state change from %s to %s",
(void *)smbc, names[smbc->state], names[newstate]); (void *)smbc, names[smbc->state], names[newstate]);
#endif #else
(void)data; (void)data;
#endif
smbc->state = newstate; smbc->state = newstate;
} }
@ -343,7 +344,7 @@ static void request_state(struct Curl_easy *data,
{ {
struct smb_request *req = Curl_meta_get(data, CURL_META_SMB_EASY); struct smb_request *req = Curl_meta_get(data, CURL_META_SMB_EASY);
if(req) { if(req) {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
/* For debug purposes */ /* For debug purposes */
static const char * const names[] = { static const char * const names[] = {
"SMB_REQUESTING", "SMB_REQUESTING",

View file

@ -576,7 +576,7 @@ static void smtp_state(struct Curl_easy *data,
struct smtp_conn *smtpc, struct smtp_conn *smtpc,
smtpstate newstate) smtpstate newstate)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
/* for debug purposes */ /* for debug purposes */
static const char * const names[] = { static const char * const names[] = {
"STOP", "STOP",

View file

@ -43,10 +43,6 @@
#include "curlx/inet_pton.h" #include "curlx/inet_pton.h"
#include "url.h" #include "url.h"
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
#define DEBUG_AND_VERBOSE
#endif
/* for the (SOCKS) connect state machine */ /* for the (SOCKS) connect state machine */
enum socks_state_t { enum socks_state_t {
SOCKS_ST_INIT, SOCKS_ST_INIT,
@ -72,7 +68,7 @@ enum socks_state_t {
SOCKS_ST_FAILED SOCKS_ST_FAILED
}; };
#ifdef DEBUG_AND_VERBOSE #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
static const char * const cf_socks_statename[] = { static const char * const cf_socks_statename[] = {
"SOCKS_INIT", "SOCKS_INIT",
"SOCKS4_START", "SOCKS4_START",
@ -160,8 +156,7 @@ CURLcode Curl_blockread_all(struct Curl_cfilter *cf,
} }
#endif #endif
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
#define DEBUG_AND_VERBOSE
#define sxstate(x, c, d, y) socksstate(x, c, d, y, __LINE__) #define sxstate(x, c, d, y) socksstate(x, c, d, y, __LINE__)
#else #else
#define sxstate(x, c, d, y) socksstate(x, c, d, y) #define sxstate(x, c, d, y) socksstate(x, c, d, y)
@ -172,24 +167,26 @@ static void socksstate(struct socks_state *sx,
struct Curl_cfilter *cf, struct Curl_cfilter *cf,
struct Curl_easy *data, struct Curl_easy *data,
enum socks_state_t state enum socks_state_t state
#ifdef DEBUG_AND_VERBOSE #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
, int lineno , int lineno
#endif #endif
) )
{ {
enum socks_state_t oldstate = sx->state; enum socks_state_t oldstate = sx->state;
(void)cf;
(void)data;
if(oldstate == state) if(oldstate == state)
/* do not bother when the new state is the same as the old state */ /* do not bother when the new state is the same as the old state */
return; return;
sx->state = state; sx->state = state;
#ifdef DEBUG_AND_VERBOSE #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
CURL_TRC_CF(data, cf, "[%s] -> [%s] (line %d)", CURL_TRC_CF(data, cf, "[%s] -> [%s] (line %d)",
cf_socks_statename[oldstate], cf_socks_statename[oldstate],
cf_socks_statename[sx->state], lineno); cf_socks_statename[sx->state], lineno);
#else
(void)cf;
(void)data;
#endif #endif
} }
@ -1288,7 +1285,7 @@ static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf,
else if(sx->state != SOCKS_ST_SUCCESS) else if(sx->state != SOCKS_ST_SUCCESS)
goto out; goto out;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
struct ip_quadruple ipquad; struct ip_quadruple ipquad;
bool is_ipv6; bool is_ipv6;

View file

@ -292,12 +292,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
goto error; goto error;
} }
else { else {
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(char *user_utf8 = curlx_convert_tchar_to_UTF8(names.sUserName));
char *user_utf8 = curlx_convert_tchar_to_UTF8(names.sUserName);
infof(data, "SOCKS5 server authenticated user %s with GSS-API.", infof(data, "SOCKS5 server authenticated user %s with GSS-API.",
(user_utf8 ? user_utf8 : "(unknown)")); (user_utf8 ? user_utf8 : "(unknown)"));
curlx_free(user_utf8); VERBOSE(curlx_free(user_utf8));
#endif
Curl_pSecFn->FreeContextBuffer(names.sUserName); Curl_pSecFn->FreeContextBuffer(names.sUserName);
names.sUserName = NULL; names.sUserName = NULL;
} }

View file

@ -33,7 +33,7 @@
const char *curl_easy_strerror(CURLcode error) const char *curl_easy_strerror(CURLcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
switch(error) { switch(error) {
case CURLE_OK: case CURLE_OK:
return "No error"; return "No error";
@ -325,7 +325,7 @@ const char *curl_easy_strerror(CURLcode error)
const char *curl_multi_strerror(CURLMcode error) const char *curl_multi_strerror(CURLMcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
switch(error) { switch(error) {
case CURLM_CALL_MULTI_PERFORM: case CURLM_CALL_MULTI_PERFORM:
return "Please call curl_multi_perform() soon"; return "Please call curl_multi_perform() soon";
@ -384,7 +384,7 @@ const char *curl_multi_strerror(CURLMcode error)
const char *curl_share_strerror(CURLSHcode error) const char *curl_share_strerror(CURLSHcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
switch(error) { switch(error) {
case CURLSHE_OK: case CURLSHE_OK:
return "No error"; return "No error";
@ -419,7 +419,7 @@ const char *curl_share_strerror(CURLSHcode error)
const char *curl_url_strerror(CURLUcode error) const char *curl_url_strerror(CURLUcode error)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
switch(error) { switch(error) {
case CURLUE_OK: case CURLUE_OK:
return "No error"; return "No error";
@ -541,14 +541,14 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen)
DWORD old_win_err = GetLastError(); DWORD old_win_err = GetLastError();
#endif #endif
int old_errno = errno; int old_errno = errno;
const char *txt; VERBOSE(const char *txt);
if(!buflen) if(!buflen)
return NULL; return NULL;
*buf = '\0'; *buf = '\0';
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
switch(err) { switch(err) {
case SEC_E_OK: case SEC_E_OK:
txt = "No error"; txt = "No error";
@ -656,8 +656,7 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen)
else else
curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err); curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err);
} }
#else /* !CURL_DISABLE_VERBOSE_STRINGS */ #else /* CURLVERBOSE */
(void)txt;
if(err == SEC_E_OK) if(err == SEC_E_OK)
curlx_strcopy(buf, buflen, STRCONST("No error")); curlx_strcopy(buf, buflen, STRCONST("No error"));
else else

View file

@ -128,7 +128,7 @@ struct TELNET {
unsigned char *subpointer, *subend; /* buffer for sub-options */ unsigned char *subpointer, *subend; /* buffer for sub-options */
}; };
#ifdef CURL_DISABLE_VERBOSE_STRINGS #ifndef CURLVERBOSE
#define printoption(a, b, c, d) Curl_nop_stmt #define printoption(a, b, c, d) Curl_nop_stmt
#else #else
static void printoption(struct Curl_easy *data, static void printoption(struct Curl_easy *data,
@ -165,7 +165,7 @@ static void printoption(struct Curl_easy *data,
} }
} }
} }
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* !CURLVERBOSE */
static void telnet_easy_dtor(void *key, size_t klen, void *entry) static void telnet_easy_dtor(void *key, size_t klen, void *entry)
{ {

View file

@ -497,11 +497,9 @@ static CURLcode tftp_connect_for_tx(struct tftp_conn *state,
tftp_event_t event) tftp_event_t event)
{ {
CURLcode result; CURLcode result;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
struct Curl_easy *data = state->data;
infof(data, "%s", "Connected for transmit"); infof(state->data, "%s", "Connected for transmit");
#endif
state->state = TFTP_STATE_TX; state->state = TFTP_STATE_TX;
result = tftp_set_timeouts(state); result = tftp_set_timeouts(state);
if(result) if(result)
@ -635,11 +633,9 @@ static CURLcode tftp_connect_for_rx(struct tftp_conn *state,
tftp_event_t event) tftp_event_t event)
{ {
CURLcode result; CURLcode result;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
struct Curl_easy *data = state->data;
infof(data, "%s", "Connected for receive"); infof(state->data, "%s", "Connected for receive");
#endif
state->state = TFTP_STATE_RX; state->state = TFTP_STATE_RX;
result = tftp_set_timeouts(state); result = tftp_set_timeouts(state);
if(result) if(result)

View file

@ -1533,7 +1533,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
{ {
char *zoneid; char *zoneid;
CURLUcode uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0); CURLUcode uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
#if !defined(HAVE_IF_NAMETOINDEX) || defined(CURL_DISABLE_VERBOSE_STRINGS) #if !defined(HAVE_IF_NAMETOINDEX) || !defined(CURLVERBOSE)
(void)data; (void)data;
#endif #endif
@ -1549,7 +1549,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
unsigned int scopeidx = 0; unsigned int scopeidx = 0;
scopeidx = if_nametoindex(zoneid); scopeidx = if_nametoindex(zoneid);
if(!scopeidx) { if(!scopeidx) {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
char buffer[STRERROR_LEN]; char buffer[STRERROR_LEN];
infof(data, "Invalid zoneid: %s; %s", zoneid, infof(data, "Invalid zoneid: %s; %s", zoneid,
curlx_strerror(errno, buffer, sizeof(buffer))); curlx_strerror(errno, buffer, sizeof(buffer)));
@ -1903,7 +1903,8 @@ static char *detect_proxy(struct Curl_easy *data,
* checked if the lowercase versions do not exist. * checked if the lowercase versions do not exist.
*/ */
char proxy_env[20]; char proxy_env[20];
const char *envp = proxy_env; const char *envp;
VERBOSE(envp = proxy_env);
curl_msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", curl_msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy",
conn->scheme->name); conn->scheme->name);
@ -3457,8 +3458,8 @@ static CURLcode create_conn(struct Curl_easy *data,
* `existing` and thus we need to cleanup the one we just * `existing` and thus we need to cleanup the one we just
* allocated before we can move along and use `existing`. * allocated before we can move along and use `existing`.
*/ */
bool tls_upgraded = (!(conn->given->flags & PROTOPT_SSL) && VERBOSE(bool tls_upgraded = (!(conn->given->flags & PROTOPT_SSL) &&
Curl_conn_is_ssl(conn, FIRSTSOCKET)); Curl_conn_is_ssl(conn, FIRSTSOCKET)));
reuse_conn(data, conn, existing); reuse_conn(data, conn, existing);
conn = existing; conn = existing;

View file

@ -1039,7 +1039,7 @@ struct UrlState {
curl_easy_setopt(COOKIEFILE) calls */ curl_easy_setopt(COOKIEFILE) calls */
#endif #endif
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */ struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */
#endif #endif

View file

@ -193,6 +193,8 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
status == SEC_I_COMPLETE_AND_CONTINUE) status == SEC_I_COMPLETE_AND_CONTINUE)
Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc); Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc);
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) { else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
VERBOSE(char buffer[STRERROR_LEN]);
Curl_pSecFn->FreeCredentialsHandle(&credentials); Curl_pSecFn->FreeCredentialsHandle(&credentials);
Curl_sspi_free_identity(p_identity); Curl_sspi_free_identity(p_identity);
curlx_free(spn); curlx_free(spn);
@ -201,13 +203,8 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
if(status == SEC_E_INSUFFICIENT_MEMORY) if(status == SEC_E_INSUFFICIENT_MEMORY)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
{
char buffer[STRERROR_LEN];
infof(data, "schannel: InitializeSecurityContext failed: %s", infof(data, "schannel: InitializeSecurityContext failed: %s",
Curl_sspi_strerror(status, buffer, sizeof(buffer))); Curl_sspi_strerror(status, buffer, sizeof(buffer)));
}
#endif
return CURLE_AUTH_ERROR; return CURLE_AUTH_ERROR;
} }
@ -591,6 +588,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
status == SEC_I_COMPLETE_AND_CONTINUE) status == SEC_I_COMPLETE_AND_CONTINUE)
Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc); Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc);
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) { else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
VERBOSE(char buffer[STRERROR_LEN]);
Curl_pSecFn->FreeCredentialsHandle(&credentials); Curl_pSecFn->FreeCredentialsHandle(&credentials);
Curl_sspi_free_identity(p_identity); Curl_sspi_free_identity(p_identity);
@ -601,13 +600,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
if(status == SEC_E_INSUFFICIENT_MEMORY) if(status == SEC_E_INSUFFICIENT_MEMORY)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
{
char buffer[STRERROR_LEN];
infof(data, "schannel: InitializeSecurityContext failed: %s", infof(data, "schannel: InitializeSecurityContext failed: %s",
Curl_sspi_strerror(status, buffer, sizeof(buffer))); Curl_sspi_strerror(status, buffer, sizeof(buffer)));
}
#endif
return CURLE_AUTH_ERROR; return CURLE_AUTH_ERROR;
} }

View file

@ -516,7 +516,7 @@ static int cf_ngtcp2_handshake_completed(ngtcp2_conn *tconn, void *user_data)
ctx->tls_vrfy_result = Curl_vquic_tls_verify_peer(&ctx->tls, cf, ctx->tls_vrfy_result = Curl_vquic_tls_verify_peer(&ctx->tls, cf,
data, &ctx->peer); data, &ctx->peer);
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
const ngtcp2_transport_params *rp; const ngtcp2_transport_params *rp;
rp = ngtcp2_conn_get_remote_transport_params(ctx->qconn); rp = ngtcp2_conn_get_remote_transport_params(ctx->qconn);
@ -1401,6 +1401,7 @@ static CURLcode cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
(void)ctx; (void)ctx;
(void)buf; (void)buf;
NOVERBOSE((void)blen);
CF_DATA_SAVE(save, cf, data); CF_DATA_SAVE(save, cf, data);
DEBUGASSERT(cf->connected); DEBUGASSERT(cf->connected);
@ -1730,7 +1731,7 @@ static CURLcode cf_ngtcp2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
CURL_TRC_CF(data, cf, "failed to open stream -> %d", result); CURL_TRC_CF(data, cf, "failed to open stream -> %d", result);
goto out; goto out;
} }
stream = H3_STREAM_CTX(ctx, data); VERBOSE(stream = H3_STREAM_CTX(ctx, data));
} }
else if(stream->xfer_result) { else if(stream->xfer_result) {
CURL_TRC_CF(data, cf, "[%" PRId64 "] xfer write failed", stream->id); CURL_TRC_CF(data, cf, "[%" PRId64 "] xfer write failed", stream->id);
@ -2735,7 +2736,7 @@ out:
} }
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(result) { if(result) {
struct ip_quadruple ip; struct ip_quadruple ip;

View file

@ -1420,7 +1420,7 @@ static CURLcode cf_quiche_connect(struct Curl_cfilter *cf,
} }
out: out:
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(result && result != CURLE_AGAIN) { if(result && result != CURLE_AGAIN) {
struct ip_quadruple ip; struct ip_quadruple ip;

View file

@ -235,8 +235,9 @@ static CURLcode send_packet_no_gso(struct Curl_cfilter *cf,
size_t gsolen, size_t *psent) size_t gsolen, size_t *psent)
{ {
const uint8_t *p, *end = pkt + pktlen; const uint8_t *p, *end = pkt + pktlen;
size_t sent, len, calls = 0; size_t sent, len;
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
VERBOSE(size_t calls = 0);
*psent = 0; *psent = 0;
@ -246,7 +247,7 @@ static CURLcode send_packet_no_gso(struct Curl_cfilter *cf,
if(result) if(result)
goto out; goto out;
*psent += sent; *psent += sent;
++calls; VERBOSE(++calls);
} }
out: out:
CURL_TRC_CF(data, cf, "vquic_%s(len=%zu, gso=%zu, calls=%zu)" CURL_TRC_CF(data, cf, "vquic_%s(len=%zu, gso=%zu, calls=%zu)"
@ -737,7 +738,7 @@ CURLcode Curl_conn_may_http3(struct Curl_easy *data,
return CURLE_OK; return CURLE_OK;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
const char *vquic_h3_err_str(uint64_t error_code) const char *vquic_h3_err_str(uint64_t error_code)
{ {
if(error_code <= UINT_MAX) { if(error_code <= UINT_MAX) {
@ -785,7 +786,7 @@ const char *vquic_h3_err_str(uint64_t error_code)
return "NO_ERROR"; return "NO_ERROR";
return "unknown"; return "unknown";
} }
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
#if defined(USE_NGTCP2) || defined(USE_NGHTTP3) #if defined(USE_NGTCP2) || defined(USE_NGHTTP3)

View file

@ -53,11 +53,11 @@ typedef enum {
CURL_H3_ERR_VERSION_FALLBACK = 0x0110, CURL_H3_ERR_VERSION_FALLBACK = 0x0110,
} vquic_h3_error; } vquic_h3_error;
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
const char *vquic_h3_err_str(uint64_t error_code); const char *vquic_h3_err_str(uint64_t error_code);
#else #else
#define vquic_h3_err_str(x) "" #define vquic_h3_err_str(x) ""
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
struct cf_quic_ctx { struct cf_quic_ctx {
curl_socket_t sockfd; /* connected UDP socket */ curl_socket_t sockfd; /* connected UDP socket */

View file

@ -108,7 +108,7 @@ static CURLcode sftp_error_to_CURLE(int err)
return CURLE_SSH; return CURLE_SSH;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static const char *myssh_statename(sshstate state) static const char *myssh_statename(sshstate state)
{ {
static const char * const names[] = { static const char * const names[] = {
@ -179,7 +179,7 @@ static const char *myssh_statename(sshstate state)
} }
#else #else
#define myssh_statename(x) "" #define myssh_statename(x) ""
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
#define myssh_to(x, y, z) myssh_set_state(x, y, z) #define myssh_to(x, y, z) myssh_set_state(x, y, z)
@ -191,7 +191,7 @@ static void myssh_set_state(struct Curl_easy *data,
struct ssh_conn *sshc, struct ssh_conn *sshc,
sshstate nowstate) sshstate nowstate)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
CURL_TRC_SSH(data, "[%s] -> [%s]", CURL_TRC_SSH(data, "[%s] -> [%s]",
myssh_statename(sshc->state), myssh_statename(sshc->state),

View file

@ -251,7 +251,7 @@ static LIBSSH2_FREE_FUNC(my_libssh2_free)
Curl_cfree(ptr); Curl_cfree(ptr);
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static const char *myssh_statename(sshstate state) static const char *myssh_statename(sshstate state)
{ {
static const char * const names[] = { static const char * const names[] = {
@ -322,7 +322,7 @@ static const char *myssh_statename(sshstate state)
} }
#else #else
#define myssh_statename(x) "" #define myssh_statename(x) ""
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
#define myssh_state(x, y, z) myssh_set_state(x, y, z) #define myssh_state(x, y, z) myssh_set_state(x, y, z)
@ -334,7 +334,7 @@ static void myssh_set_state(struct Curl_easy *data,
struct ssh_conn *sshc, struct ssh_conn *sshc,
sshstate nowstate) sshstate nowstate)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(sshc->state != nowstate) { if(sshc->state != nowstate) {
CURL_TRC_SSH(data, "[%s] -> [%s]", CURL_TRC_SSH(data, "[%s] -> [%s]",
myssh_statename(sshc->state), myssh_statename(sshc->state),

View file

@ -233,7 +233,7 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf,
result = SecTrustEvaluateWithError(trust, &error) ? result = SecTrustEvaluateWithError(trust, &error) ?
CURLE_OK : CURLE_PEER_FAILED_VERIFICATION; CURLE_OK : CURLE_PEER_FAILED_VERIFICATION;
if(error) { if(error) {
CFIndex code = CFErrorGetCode(error); VERBOSE(CFIndex code = CFErrorGetCode(error));
error_ref = CFErrorCopyDescription(error); error_ref = CFErrorCopyDescription(error);
if(error_ref) { if(error_ref) {

View file

@ -166,7 +166,7 @@ static void gtls_cleanup(void)
Curl_tls_keylog_close(); Curl_tls_keylog_close();
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
static void showtime(struct Curl_easy *data, const char *text, time_t stamp) static void showtime(struct Curl_easy *data, const char *text, time_t stamp)
{ {
struct tm buffer; struct tm buffer;
@ -1326,7 +1326,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
void Curl_gtls_report_handshake(struct Curl_easy *data, struct gtls_ctx *gctx) void Curl_gtls_report_handshake(struct Curl_easy *data, struct gtls_ctx *gctx)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
const char *ptr; const char *ptr;
gnutls_protocol_t version = gnutls_protocol_get_version(gctx->session); gnutls_protocol_t version = gnutls_protocol_get_version(gctx->session);
@ -1379,7 +1379,7 @@ static void gtls_msg_verify_result(struct Curl_easy *data,
static void gtls_infof_cert(struct Curl_easy *data, static void gtls_infof_cert(struct Curl_easy *data,
gnutls_x509_crt_t x509_cert) gnutls_x509_crt_t x509_cert)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
gnutls_datum_t certfields; gnutls_datum_t certfields;
int rc, algo; int rc, algo;

View file

@ -389,7 +389,7 @@ add_ciphers:
static void mbed_dump_cert_info(struct Curl_easy *data, static void mbed_dump_cert_info(struct Curl_easy *data,
const mbedtls_x509_crt *crt) const mbedtls_x509_crt *crt)
{ {
#if defined(CURL_DISABLE_VERBOSE_STRINGS) || defined(MBEDTLS_X509_REMOVE_INFO) #if !defined(CURLVERBOSE) || defined(MBEDTLS_X509_REMOVE_INFO)
(void)data, (void)crt; (void)data, (void)crt;
#else #else
const size_t bufsize = 16384; const size_t bufsize = 16384;

View file

@ -1596,7 +1596,7 @@ static CURLcode client_cert(struct Curl_easy *data,
return CURLE_OK; return CURLE_OK;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
/* returns non-zero on failure */ /* returns non-zero on failure */
static CURLcode x509_name_oneline(X509_NAME *a, struct dynbuf *d) static CURLcode x509_name_oneline(X509_NAME *a, struct dynbuf *d)
{ {
@ -1845,7 +1845,6 @@ static CURLcode ossl_shutdown(struct Curl_cfilter *cf,
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
char buf[1024]; char buf[1024];
int nread = -1, err; int nread = -1, err;
unsigned long sslerr;
size_t i; size_t i;
DEBUGASSERT(octx); DEBUGASSERT(octx);
@ -1938,12 +1937,14 @@ static CURLcode ossl_shutdown(struct Curl_cfilter *cf,
default: default:
/* Server seems to have closed the connection without sending us /* Server seems to have closed the connection without sending us
* a close notify. */ * a close notify. */
sslerr = ERR_get_error(); {
VERBOSE(unsigned long sslerr = ERR_get_error());
CURL_TRC_CF(data, cf, "SSL shutdown, ignore recv error: '%s', errno %d", CURL_TRC_CF(data, cf, "SSL shutdown, ignore recv error: '%s', errno %d",
(sslerr ? (sslerr ?
ossl_strerror(sslerr, buf, sizeof(buf)) : ossl_strerror(sslerr, buf, sizeof(buf)) :
SSL_ERROR_to_str(err)), SSL_ERROR_to_str(err)),
SOCKERRNO); SOCKERRNO);
}
*done = TRUE; *done = TRUE;
result = CURLE_OK; result = CURLE_OK;
break; break;
@ -2842,7 +2843,7 @@ static CURLcode ossl_win_load_store(struct Curl_easy *data,
if(!pContext) if(!pContext)
break; break;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #if defined(DEBUGBUILD) && defined(CURLVERBOSE)
else { else {
char cert_name[256]; char cert_name[256];
if(!CertGetNameStringA(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, if(!CertGetNameStringA(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
@ -2931,7 +2932,7 @@ static CURLcode ossl_win_load_store(struct Curl_easy *data,
such as duplicate certificate, which is allowed by MS but not such as duplicate certificate, which is allowed by MS but not
OpenSSL. */ OpenSSL. */
if(X509_STORE_add_cert(store, x509) == 1) { if(X509_STORE_add_cert(store, x509) == 1) {
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) #ifdef DEBUGBUILD
infof(data, "SSL: Imported cert"); infof(data, "SSL: Imported cert");
#endif #endif
*padded = TRUE; *padded = TRUE;
@ -3345,7 +3346,6 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx,
struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data); struct ssl_config_data *ssl_config = Curl_ssl_cf_get_config(cf, data);
struct ssl_primary_config *conn_cfg = Curl_ssl_cf_get_primary_config(cf); struct ssl_primary_config *conn_cfg = Curl_ssl_cf_get_primary_config(cf);
struct alpn_spec alpns; struct alpn_spec alpns;
char error_buffer[256];
CURLcode result; CURLcode result;
Curl_alpn_copy(&alpns, alpns_requested); Curl_alpn_copy(&alpns, alpns_requested);
@ -3366,6 +3366,7 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx,
(long)der_sessionid_size); (long)der_sessionid_size);
if(ssl_session) { if(ssl_session) {
if(!SSL_set_session(octx->ssl, ssl_session)) { if(!SSL_set_session(octx->ssl, ssl_session)) {
VERBOSE(char error_buffer[256]);
infof(data, "SSL: SSL_set_session not accepted, " infof(data, "SSL: SSL_set_session not accepted, "
"continuing without: %s", "continuing without: %s",
ossl_strerror(ERR_get_error(), error_buffer, ossl_strerror(ERR_get_error(), error_buffer,
@ -3985,7 +3986,7 @@ static CURLcode ossl_on_session_reuse(struct Curl_cfilter *cf,
void Curl_ossl_report_handshake(struct Curl_easy *data, struct ossl_ctx *octx) void Curl_ossl_report_handshake(struct Curl_easy *data, struct ossl_ctx *octx)
{ {
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
if(Curl_trc_is_verbose(data)) { if(Curl_trc_is_verbose(data)) {
int psigtype_nid = NID_undef; int psigtype_nid = NID_undef;
const char *negotiated_group_name = NULL; const char *negotiated_group_name = NULL;
@ -4010,7 +4011,7 @@ void Curl_ossl_report_handshake(struct Curl_easy *data, struct ossl_ctx *octx)
#else #else
(void)data; (void)data;
(void)octx; (void)octx;
#endif /* CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
} }
static CURLcode ossl_connect_step1(struct Curl_cfilter *cf, static CURLcode ossl_connect_step1(struct Curl_cfilter *cf,
@ -4413,7 +4414,7 @@ static CURLcode ossl_pkp_pin_peer_pubkey(struct Curl_easy *data, X509 *cert,
#if !(defined(LIBRESSL_VERSION_NUMBER) && \ #if !(defined(LIBRESSL_VERSION_NUMBER) && \
LIBRESSL_VERSION_NUMBER < 0x3060000fL) && \ LIBRESSL_VERSION_NUMBER < 0x3060000fL) && \
!defined(HAVE_BORINGSSL_LIKE) && !defined(CURL_DISABLE_VERBOSE_STRINGS) !defined(HAVE_BORINGSSL_LIKE) && defined(CURLVERBOSE)
static void infof_certstack(struct Curl_easy *data, const SSL *ssl) static void infof_certstack(struct Curl_easy *data, const SSL *ssl)
{ {
STACK_OF(X509) *certstack; STACK_OF(X509) *certstack;
@ -4580,7 +4581,7 @@ static CURLcode ossl_check_pinned_key(struct Curl_cfilter *cf,
return result; return result;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
#define MAX_CERT_NAME_LENGTH 2048 #define MAX_CERT_NAME_LENGTH 2048
static CURLcode ossl_infof_cert(struct Curl_cfilter *cf, static CURLcode ossl_infof_cert(struct Curl_cfilter *cf,
struct Curl_easy *data, struct Curl_easy *data,
@ -4631,7 +4632,7 @@ out:
curlx_dyn_free(&dname); curlx_dyn_free(&dname);
return result; return result;
} }
#endif /* !CURL_DISABLE_VERBOSE_STRINGS */ #endif /* CURLVERBOSE */
#ifdef USE_APPLE_SECTRUST #ifdef USE_APPLE_SECTRUST
struct ossl_certs_ctx { struct ossl_certs_ctx {
@ -4744,7 +4745,7 @@ CURLcode Curl_ossl_check_peer_cert(struct Curl_cfilter *cf,
goto out; goto out;
} }
#ifndef CURL_DISABLE_VERBOSE_STRINGS #ifdef CURLVERBOSE
result = ossl_infof_cert(cf, data, server_cert); result = ossl_infof_cert(cf, data, server_cert);
if(result) if(result)
goto out; goto out;

View file

@ -2259,11 +2259,9 @@ static CURLcode schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
goto cleanup; goto cleanup;
} }
else { else {
#ifndef CURL_DISABLE_VERBOSE_STRINGS VERBOSE(char buffer[STRERROR_LEN]);
char buffer[STRERROR_LEN];
failf(data, "schannel: failed to read data from server: %s", failf(data, "schannel: failed to read data from server: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer))); Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
#endif
result = CURLE_RECV_ERROR; result = CURLE_RECV_ERROR;
goto cleanup; goto cleanup;
} }

View file

@ -129,6 +129,7 @@ struct websocket {
size_t sendbuf_payload; /* number of payload bytes in sendbuf */ size_t sendbuf_payload; /* number of payload bytes in sendbuf */
}; };
#ifdef CURLVERBOSE
static const char *ws_frame_name_of_op(uint8_t firstbyte) static const char *ws_frame_name_of_op(uint8_t firstbyte)
{ {
switch(firstbyte & WSBIT_OPCODE_MASK) { switch(firstbyte & WSBIT_OPCODE_MASK) {
@ -148,6 +149,7 @@ static const char *ws_frame_name_of_op(uint8_t firstbyte)
return "???"; return "???";
} }
} }
#endif
static int ws_frame_firstbyte2flags(struct Curl_easy *data, static int ws_frame_firstbyte2flags(struct Curl_easy *data,
uint8_t firstbyte, int cont_flags) uint8_t firstbyte, int cont_flags)
@ -294,6 +296,7 @@ static CURLcode ws_frame_flags2firstbyte(struct Curl_easy *data,
static void ws_dec_info(struct ws_decoder *dec, struct Curl_easy *data, static void ws_dec_info(struct ws_decoder *dec, struct Curl_easy *data,
const char *msg) const char *msg)
{ {
NOVERBOSE((void)msg);
switch(dec->head_len) { switch(dec->head_len) {
case 0: case 0:
break; break;
@ -776,6 +779,8 @@ static const struct Curl_cwtype ws_cw_decode = {
static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data, static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data,
const char *msg) const char *msg)
{ {
NOVERBOSE((void)enc);
NOVERBOSE((void)msg);
CURL_TRC_WS(data, "WS-ENC: %s [%s%s payload=%" CURL_TRC_WS(data, "WS-ENC: %s [%s%s payload=%"
FMT_OFF_T "/%" FMT_OFF_T "]", FMT_OFF_T "/%" FMT_OFF_T "]",
msg, ws_frame_name_of_op(enc->firstbyte), msg, ws_frame_name_of_op(enc->firstbyte),

View file

@ -119,12 +119,8 @@ struct cf_test_ctx {
static void cf_test_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) static void cf_test_destroy(struct Curl_cfilter *cf, struct Curl_easy *data)
{ {
struct cf_test_ctx *ctx = cf->ctx; struct cf_test_ctx *ctx = cf->ctx;
#ifndef CURL_DISABLE_VERBOSE_STRINGS
infof(data, "%04dms: cf[%s] destroyed", infof(data, "%04dms: cf[%s] destroyed",
(int)curlx_timediff_ms(curlx_now(), current_tr->started), ctx->id); (int)curlx_timediff_ms(curlx_now(), current_tr->started), ctx->id);
#else
(void)data;
#endif
curlx_free(ctx); curlx_free(ctx);
cf->ctx = NULL; cf->ctx = NULL;
} }