build: fully omit verbose strings and code when disabled
No binary (build failed)
—
(log yok)
| @@ -192,8 +192,9 @@ jobs: | |
| - name: 'openssl arm C89' | |
| image: ubuntu-24.04-arm | |
| + | install_packages: libssh2-1-dev |
| 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' | |
| install_packages: libssh-dev valgrind | |
| @@ -39,7 +39,7 @@ | |
| #define CURL_NEW_ENV_VAR 0 | |
| #define CURL_NEW_ENV_VALUE 1 | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| /* | |
| * 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_IAC 255 /* Interpret As Command */ | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| /* | |
| * 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) && \ | |
| ((unsigned int)(x) <= CURL_TELCMD_MAXIMUM)) | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| #define CURL_TELCMD(x) telnetcmds[(x) - CURL_TELCMD_MINIMUM] | |
| #else | |
| #define CURL_TELCMD(x) "" | |
| @@ -740,7 +740,7 @@ CURLcode Curl_async_getaddrinfo(struct Curl_easy *data, const char *hostname, | |
| ares->ares_status = ARES_ENOTFOUND; | |
| ares->result = CURLE_OK; | |
| - | #if !defined(CURL_DISABLE_VERBOSE_STRINGS) && \ |
| + | #if defined(CURLVERBOSE) && \ |
| ARES_VERSION >= 0x011800 /* >= v1.24.0 */ | |
| if(CURL_TRC_DNS_is_verbose(data)) { | |
| char *csv = ares_get_servers_csv(ares->channel); | |
| @@ -426,7 +426,7 @@ static ssize_t on_session_send(nghttp2_session *h2, | |
| NGHTTP2_ERR_CALLBACK_FAILURE : (ssize_t)nwritten; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static int proxy_h2_fr_print(const nghttp2_frame *frame, | |
| char *buffer, size_t blen) | |
| { | |
| @@ -516,7 +516,7 @@ static int proxy_h2_on_frame_send(nghttp2_session *session, | |
| } | |
| return 0; | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| static int proxy_h2_on_frame_recv(nghttp2_session *session, | |
| const nghttp2_frame *frame, | |
| @@ -529,7 +529,7 @@ static int proxy_h2_on_frame_recv(nghttp2_session *session, | |
| (void)session; | |
| DEBUGASSERT(data); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_cf_is_verbose(cf, data)) { | |
| char buffer[256]; | |
| int len; | |
| @@ -537,7 +537,7 @@ static int proxy_h2_on_frame_recv(nghttp2_session *session, | |
| buffer[len] = 0; | |
| CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer); | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| if(!stream_id) { | |
| /* 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_on_frame_recv_callback( | |
| cbs, proxy_h2_on_frame_recv); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| nghttp2_session_callbacks_set_on_frame_send_callback(cbs, | |
| proxy_h2_on_frame_send); | |
| #endif | |
| @@ -351,7 +351,8 @@ static CURLcode cf_ip_ballers_run(struct cf_ip_ballers *bs, | |
| struct cf_ip_attempt *a = NULL, **panchor; | |
| bool do_more; | |
| timediff_t next_expire_ms; | |
| - | int i, inconclusive, ongoing; |
| + | int inconclusive, ongoing; |
| + | VERBOSE(int i); |
| if(bs->winner) | |
| return CURLE_OK; | |
| @@ -360,9 +361,9 @@ evaluate: | |
| ongoing = inconclusive = 0; | |
| /* check if a running baller connects now */ | |
| - | i = -1; |
| + | VERBOSE(i = -1); |
| for(panchor = &bs->running; *panchor; panchor = &((*panchor)->next)) { | |
| - | ++i; |
| + | VERBOSE(++i); |
| a = *panchor; | |
| a->result = cf_ip_attempt_connect(a, data, connected); | |
| if(!a->result) { | |
| @@ -455,9 +456,9 @@ evaluate: | |
| timediff_t delay_ms = bs->attempt_delay_ms - since_ms; | |
| if(delay_ms <= 0) { | |
| CURL_TRC_CF(data, cf, "all attempts inconclusive, restarting one"); | |
| - | i = -1; |
| + | VERBOSE(i = -1); |
| for(a = bs->running; a; a = a->next) { | |
| - | ++i; |
| + | VERBOSE(++i); |
| if(!a->inconclusive) | |
| continue; | |
| result = cf_ip_attempt_restart(a, cf, data); | |
| @@ -482,7 +483,7 @@ evaluate: | |
| /* no more addresses, no inconclusive attempts */ | |
| CURL_TRC_CF(data, cf, "no more attempts to try"); | |
| result = CURLE_COULDNT_CONNECT; | |
| - | i = 0; |
| + | VERBOSE(i = 0); |
| for(a = bs->running; a; a = a->next) { | |
| CURL_TRC_CF(data, cf, "baller %d: result=%d", i, 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) | |
| Curl_pgrsTime(data, TIMER_APPCONNECT); /* we are connected already */ | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_cf_is_verbose(cf, data)) { | |
| struct ip_quadruple ipquad; | |
| bool is_ipv6; | |
| @@ -84,7 +84,7 @@ static void tcpnodelay(struct Curl_cfilter *cf, | |
| #if defined(TCP_NODELAY) && defined(CURL_TCP_NODELAY_SUPPORTED) | |
| curl_socklen_t onoff = (curl_socklen_t)1; | |
| int level = IPPROTO_TCP; | |
| - | char buffer[STRERROR_LEN]; |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| if(setsockopt(sockfd, level, TCP_NODELAY, | |
| (void *)&onoff, sizeof(onoff)) < 0) | |
| @@ -834,15 +834,12 @@ static CURLcode socket_connect_result(struct Curl_easy *data, | |
| default: | |
| /* 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, | |
| curlx_strerror(error, buffer, sizeof(buffer))); | |
| + | NOVERBOSE((void)ipaddress); |
| } | |
| - | #endif |
| data->state.os_errno = error; | |
| /* connect failed */ | |
| return CURLE_COULDNT_CONNECT; | |
| @@ -982,14 +979,13 @@ static void set_local_ip(struct Curl_cfilter *cf, | |
| if((ctx->sock != CURL_SOCKET_BAD) && | |
| !(data->conn->scheme->protocol & CURLPROTO_TFTP)) { | |
| /* TFTP does not connect, so it cannot get the IP like this */ | |
| - | |
| - | char buffer[STRERROR_LEN]; |
| struct Curl_sockaddr_storage ssloc; | |
| curl_socklen_t slen = sizeof(struct Curl_sockaddr_storage); | |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| memset(&ssloc, 0, sizeof(ssloc)); | |
| if(getsockname(ctx->sock, (struct sockaddr *)&ssloc, &slen)) { | |
| - | int error = SOCKERRNO; |
| + | VERBOSE(int error = SOCKERRNO); |
| infof(data, "getsockname() failed with errno %d: %s", | |
| error, curlx_strerror(error, buffer, sizeof(buffer))); | |
| } | |
| @@ -1292,18 +1288,14 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf, | |
| out: | |
| if(result) { | |
| if(ctx->error) { | |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| set_local_ip(cf, data); | |
| data->state.os_errno = 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", |
| - | ctx->ip.remote_ip, ctx->ip.remote_port, |
| - | ctx->ip.local_ip, ctx->ip.local_port, |
| - | curlx_strerror(ctx->error, buffer, sizeof(buffer))); |
| - | } |
| - | #endif |
| + | infof(data, "connect to %s port %u from %s port %d failed: %s", |
| + | ctx->ip.remote_ip, ctx->ip.remote_port, |
| + | ctx->ip.local_ip, ctx->ip.local_port, |
| + | curlx_strerror(ctx->error, buffer, sizeof(buffer))); |
| } | |
| if(ctx->sock != CURL_SOCKET_BAD) { | |
| socket_close(data, cf->conn, TRUE, ctx->sock); | |
| @@ -1380,8 +1372,8 @@ static CURLcode cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data, | |
| struct cf_socket_ctx *ctx = cf->ctx; | |
| curl_socket_t fdsave; | |
| ssize_t rv; | |
| - | size_t orig_len = len; |
| CURLcode result = CURLE_OK; | |
| + | VERBOSE(size_t orig_len = len); |
| (void)eos; | |
| *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) { | |
| - | size_t orig_len = len; |
| - | len = ctx->recv_max; |
| 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 | |
| @@ -420,7 +420,7 @@ CURLcode Curl_conn_cf_recv(struct Curl_cfilter *cf, struct Curl_easy *data, | |
| return CURLE_RECV_ERROR; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static CURLcode cf_verboseconnect(struct Curl_easy *data, | |
| struct Curl_cfilter *cf) | |
| { | |
| @@ -535,9 +535,7 @@ CURLcode Curl_conn_connect(struct Curl_easy *data, | |
| cf_cntrl_update_info(data, data->conn); | |
| conn_report_connect_stats(cf, data); | |
| data->conn->keepalive = *Curl_pgrs_now(data); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | result = cf_verboseconnect(data, cf); |
| - | #endif |
| + | VERBOSE(result = cf_verboseconnect(data, cf)); |
| goto out; | |
| } | |
| else if(result) { | |
| @@ -297,7 +297,7 @@ curl_socket_t Curl_getconnectinfo(struct Curl_easy *data, | |
| */ | |
| void Curl_conncontrol(struct connectdata *conn, | |
| int ctrl /* see defines in header */ | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| , const char *reason | |
| #endif | |
| ) | |
| @@ -307,7 +307,7 @@ void Curl_conncontrol(struct connectdata *conn, | |
| associated with a transfer. */ | |
| bool closeit, is_multiplex; | |
| DEBUGASSERT(conn); | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| (void)reason; /* useful for debugging */ | |
| #endif | |
| is_multiplex = Curl_conn_is_multiplex(conn, FIRSTSOCKET); | |
| @@ -93,16 +93,16 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen, | |
| void Curl_conncontrol(struct connectdata *conn, | |
| int closeit | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| , const char *reason | |
| #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 connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION, 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 connclose(x, y) Curl_conncontrol(x, CONNCTRL_CONNECTION) | |
| #define connkeep(x, y) Curl_conncontrol(x, CONNCTRL_KEEP) | |
| @@ -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, | |
| saslstate newstate) | |
| { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* for debug purposes */ | |
| static const char * const names[]={ | |
| "STOP", | |
| @@ -834,7 +834,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data, | |
| return result; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static void sasl_unchosen(struct Curl_easy *data, unsigned short mech, | |
| unsigned short enabledmechs, | |
| 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); | |
| } | |
| } | |
| - | #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| CURLcode Curl_sasl_is_blocked(struct SASL *sasl, struct Curl_easy *data) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| #ifdef USE_KERBEROS5 | |
| #define CURL_SASL_KERBEROS5 TRUE | |
| #else | |
| @@ -924,7 +924,7 @@ CURLcode Curl_sasl_is_blocked(struct SASL *sasl, struct Curl_easy *data) | |
| data->set.str[STRING_BEARER] ? | |
| NULL : "CURLOPT_XOAUTH2_BEARER"); | |
| } | |
| - | #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| (void)sasl; | |
| (void)data; | |
| return CURLE_LOGIN_DENIED; | |
| @@ -1217,4 +1217,18 @@ typedef struct sockaddr_un { | |
| # define CURL_INLINE /* empty */ | |
| #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 */ | |
| @@ -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 | |
| 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[] = { | |
| "100_TIMEOUT", | |
| "ASYNC_NAME", | |
| @@ -64,10 +64,6 @@ void Curl_failf(struct Curl_easy *data, | |
| #define CURL_LOG_LVL_NONE 0 | |
| #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. | |
| */ | |
| @@ -206,7 +202,70 @@ void Curl_trc_ws(struct Curl_easy *data, | |
| } while(0) | |
| #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 CURL_TRC_M Curl_trc_multi | |
| @@ -234,15 +293,16 @@ void Curl_trc_ws(struct Curl_easy *data, | |
| #endif /* !CURL_HAVE_C99 */ | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | /* informational messages enabled */ |
| - | |
| + | #ifdef CURLVERBOSE |
| 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_write; | |
| extern struct curl_trc_feat Curl_trc_feat_dns; | |
| extern struct curl_trc_feat Curl_trc_feat_timer; | |
| + | #endif |
| + | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | /* informational messages enabled */ |
| #define Curl_trc_is_verbose(data) \ | |
| ((data) && (data)->set.verbose && \ | |
| (!(data)->state.feat || \ | |
| @@ -262,13 +322,11 @@ extern struct curl_trc_feat Curl_trc_feat_timer; | |
| #else /* CURL_DISABLE_VERBOSE_STRINGS */ | |
| /* All informational messages are not compiled in for size savings */ | |
| - | |
| #define Curl_trc_is_verbose(d) (FALSE) | |
| #define Curl_trc_cf_is_verbose(x, y) (FALSE) | |
| #define Curl_trc_ft_is_verbose(x, y) (FALSE) | |
| #define CURL_MSTATE_NAME(x) ((void)(x), "-") | |
| #define CURL_TRC_EASY_TIMERS(x) Curl_nop_stmt | |
| - | |
| #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ | |
| #endif /* HEADER_CURL_TRC_H */ | |
| @@ -43,17 +43,15 @@ | |
| */ | |
| static const char *get_winsock_error(int err, char *buf, size_t len) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | const char *p; |
| - | size_t alen; |
| - | #endif |
| + | VERBOSE(const char *p); |
| + | VERBOSE(size_t alen); |
| if(!len) | |
| return NULL; | |
| *buf = '\0'; | |
| - | #ifdef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifndef CURLVERBOSE |
| (void)err; | |
| return NULL; | |
| #else | |
| @@ -75,7 +75,7 @@ const char *curlx_winapi_strerror(DWORD err, char *buf, size_t buflen) | |
| *buf = '\0'; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(!curlx_get_winapi_error(err, buf, buflen)) { | |
| #if defined(__GNUC__) && __GNUC__ >= 7 | |
| #pragma GCC diagnostic push | |
| @@ -182,6 +182,8 @@ static CURLcode cw_out_cb_write(struct cw_out_ctx *ctx, | |
| size_t nwritten; | |
| CURLcode result; | |
| + | NOVERBOSE((void)otype); |
| + | |
| DEBUGASSERT(data->conn); | |
| *pnwritten = 0; | |
| Curl_set_in_callback(data, TRUE); | |
| @@ -40,7 +40,7 @@ | |
| #define DNS_CLASS_IN 0x01 | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static const char * const errors[] = { | |
| "", | |
| "Bad label", | |
| @@ -65,7 +65,7 @@ static const char *doh_strerror(DOHcode code) | |
| return "bad error code"; | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| /* @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 | |
| the gcc typecheck helpers */ | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | doh->state.feat = &Curl_trc_feat_dns; |
| - | #endif |
| + | VERBOSE(doh->state.feat = &Curl_trc_feat_dns); |
| ERROR_CHECK_SETOPT(CURLOPT_URL, url); | |
| ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https"); | |
| 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 */ | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static void doh_show(struct Curl_easy *data, | |
| const struct dohentry *d) | |
| { | |
| @@ -1009,7 +1007,7 @@ static CURLcode doh2ai(const struct dohentry *de, const char *hostname, | |
| return result; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static const char *doh_type2name(DNStype 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), | |
| curlx_dyn_len(&p->body), | |
| p->dnstype, &de); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| if(rc[slot]) { | |
| CURL_TRC_DNS(data, "DoH: %s type %s for %s", doh_strerror(rc[slot]), | |
| doh_type2name(p->dnstype), dohp->host); | |
| } | |
| - | #endif |
| } /* next slot */ | |
| result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */ | |
| @@ -84,10 +84,10 @@ | |
| /* macro to check for the last line in an FTP server response */ | |
| #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_CSTATE(c) ((void)(c), "") | |
| - | #else /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #else /* !CURLVERBOSE */ |
| /*************************************************************************** | |
| * | |
| * ftp_pasv_verbose() | |
| @@ -149,7 +149,7 @@ static const char * const ftp_state_names[] = { | |
| }; | |
| #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! */ | |
| static void ftp_state_low(struct Curl_easy *data, | |
| @@ -160,22 +160,16 @@ static void ftp_state_low(struct Curl_easy *data, | |
| #endif | |
| ) | |
| { | |
| - | #ifdef CURL_DISABLE_VERBOSE_STRINGS |
| - | (void)data; |
| - | #ifdef DEBUGBUILD |
| - | (void)lineno; |
| - | #endif |
| - | #else /* CURL_DISABLE_VERBOSE_STRINGS */ |
| - | if(ftpc->state != newstate) |
| + | if(ftpc->state != newstate) { |
| #ifdef DEBUGBUILD | |
| + | NOVERBOSE((void)lineno); |
| CURL_TRC_FTP(data, "[%s] -> [%s] (line %d)", FTP_CSTATE(ftpc), | |
| ftp_state_names[newstate], lineno); | |
| #else | |
| CURL_TRC_FTP(data, "[%s] -> [%s]", FTP_CSTATE(ftpc), | |
| ftp_state_names[newstate]); | |
| #endif | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| - | |
| + | } |
| ftpc->state = newstate; | |
| } | |
| @@ -114,7 +114,7 @@ | |
| * 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, | |
| struct Curl_dns_entry *dns) | |
| { | |
| @@ -1325,12 +1325,10 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) | |
| struct Curl_addrinfo *head = NULL, *tail = NULL; | |
| size_t entry_len; | |
| char address[64]; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | const char *addresses = NULL; |
| - | #endif |
| curl_off_t port = 0; | |
| bool permanent = TRUE; | |
| bool error = TRUE; | |
| + | VERBOSE(const char *addresses = NULL); |
| if(*host == '+') { | |
| host++; | |
| @@ -1350,9 +1348,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) | |
| curlx_str_single(&host, ':')) | |
| goto err; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | addresses = host; |
| - | #endif |
| + | VERBOSE(addresses = host); |
| /* start the address section */ | |
| while(*host) { | |
| @@ -1460,11 +1456,9 @@ err: | |
| if(!dns) | |
| return CURLE_OUT_OF_MEMORY; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| infof(data, "Added %.*s:%" CURL_FORMAT_CURL_OFF_T ":%s to DNS cache%s", | |
| (int)curlx_strlen(&source), curlx_str(&source), port, addresses, | |
| permanent ? "" : " (non-permanent)"); | |
| - | #endif |
| /* Wildcard hostname */ | |
| if(curlx_str_casecompare(&source, "*")) { | |
| @@ -394,7 +394,7 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data, | |
| * amount remains. This may be overridden by authentications further | |
| * below! */ | |
| 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 | |
| * 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 | |
| if((data->state.authproxy.picked == CURLAUTH_NTLM) || | |
| (data->state.authhost.picked == CURLAUTH_NTLM)) { | |
| - | ongoing_auth = "NTLM"; |
| + | VERBOSE(ongoing_auth = "NTLM"); |
| if((conn->http_ntlm_state != NTLMSTATE_NONE) || | |
| (conn->proxy_ntlm_state != NTLMSTATE_NONE)) { | |
| /* 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 */ | |
| if((data->state.authproxy.picked == CURLAUTH_NEGOTIATE) || | |
| (data->state.authhost.picked == CURLAUTH_NEGOTIATE)) { | |
| - | ongoing_auth = "NEGOTIATE"; |
| + | VERBOSE(ongoing_auth = "NEGOTIATE"); |
| if((conn->http_negotiate_state != GSS_AUTHNONE) || | |
| (conn->proxy_negotiate_state != GSS_AUTHNONE)) { | |
| /* 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) | |
| { | |
| const char *req = data->set.str[STRING_CUSTOMREQUEST]; | |
| + | |
| if((req || data->state.httpreq != HTTPREQ_GET) && | |
| (data->set.http_follow_mode == CURLFOLLOW_OBEYCODE)) { | |
| + | NOVERBOSE((void)code); |
| infof(data, "Switch to GET because of %d response", code); | |
| data->state.http_ignorecustom = TRUE; | |
| } | |
| @@ -52,7 +52,7 @@ | |
| #error too old nghttp2 version, upgrade! | |
| #endif | |
| - | #ifdef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifndef CURLVERBOSE |
| #define nghttp2_session_callbacks_set_error_callback(x, y) | |
| #endif | |
| @@ -1051,7 +1051,7 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf, | |
| return CURLE_OK; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static int fr_print(const nghttp2_frame *frame, char *buffer, size_t blen) | |
| { | |
| switch(frame->hd.type) { | |
| @@ -1149,7 +1149,7 @@ static int on_frame_send(nghttp2_session *session, const nghttp2_frame *frame, | |
| } | |
| return 0; | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, | |
| 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; | |
| DEBUGASSERT(data); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_cf_is_verbose(cf, data)) { | |
| char buffer[256]; | |
| int len; | |
| @@ -1168,7 +1168,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, | |
| buffer[len] = 0; | |
| CURL_TRC_CF(data, cf, "[%d] <- %s", frame->hd.stream_id, buffer); | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| if(!stream_id) { | |
| /* 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); | |
| if(data) { | |
| struct h2_stream_ctx *stream; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| char buffer[256]; | |
| int len; | |
| len = fr_print(frame, buffer, sizeof(buffer) - 1); | |
| buffer[len] = 0; | |
| failf(data, "[HTTP2] [%d] received invalid frame: %s, error %d: %s", | |
| stream_id, buffer, ngerr, nghttp2_strerror(ngerr)); | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| stream = H2_STREAM_CTX(ctx, data); | |
| if(stream) { | |
| 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; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static int error_callback(nghttp2_session *session, | |
| const char *msg, | |
| size_t len, | |
| @@ -2153,7 +2153,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream, | |
| goto out; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| #define MAX_ACC 60000 /* <64KB to account for some overhead */ | |
| if(Curl_trc_is_verbose(data)) { | |
| 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_invalid_frame_recv_callback(cbs, | |
| 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); | |
| #endif | |
| 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( | |
| cbs, on_begin_headers); | |
| 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); | |
| #endif | |
| @@ -466,7 +466,7 @@ static void imap_state(struct Curl_easy *data, | |
| struct imap_conn *imapc, | |
| imapstate newstate) | |
| { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* for debug purposes */ | |
| static const char * const names[] = { | |
| "STOP", | |
| @@ -490,8 +490,9 @@ static void imap_state(struct Curl_easy *data, | |
| if(imapc->state != newstate) | |
| infof(data, "IMAP %p state change from %s to %s", | |
| (void *)imapc, names[imapc->state], names[newstate]); | |
| - | #endif |
| + | #else |
| (void)data; | |
| + | #endif |
| imapc->state = newstate; | |
| } | |
| @@ -340,7 +340,7 @@ CURLM *curl_multi_init(void) | |
| 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) | |
| { | |
| if(!multi->warned) { | |
| @@ -597,7 +597,7 @@ static void multi_done_locked(struct connectdata *conn, | |
| void *userdata) | |
| { | |
| struct multi_done_ctx *mdctx = userdata; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| const char *host = | |
| #ifndef CURL_DISABLE_PROXY | |
| conn->bits.socksproxy ? | |
| @@ -612,7 +612,7 @@ static void multi_done_locked(struct connectdata *conn, | |
| #endif | |
| conn->bits.conn_to_port ? conn->conn_to_port : | |
| conn->remote_port; | |
| - | #endif |
| + | #endif /* CURLVERBOSE */ |
| Curl_detach_connection(data); | |
| @@ -632,21 +632,17 @@ static void multi_done_locked(struct connectdata *conn, | |
| Curl_dnscache_prune(data); | |
| 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, " | |
| "forbid=%d, close=%d, premature=%d, conn_multiplex=%d", | |
| conn->connection_id, host, port, data->set.reuse_forbid, | |
| conn->bits.close, mdctx->premature, | |
| Curl_conn_is_multiplex(conn, FIRSTSOCKET)); | |
| - | #endif |
| connclose(conn, "disconnecting"); | |
| Curl_conn_terminate(data, conn, (bool)mdctx->premature); | |
| } | |
| 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" | |
| " by server, not reusing", conn->connection_id, host, port); | |
| - | #endif |
| connclose(conn, "server shutdown"); | |
| 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)) { | |
| /* connection kept in the cpool */ | |
| data->state.lastconnect_id = conn->connection_id; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| infof(data, "Connection #%" FMT_OFF_T " to host %s:%d left intact", | |
| conn->connection_id, host, port); | |
| - | #endif |
| } | |
| else { | |
| /* connection was removed from the cpool and destroyed. */ | |
| @@ -1178,7 +1172,7 @@ CURLMcode Curl_multi_pollset(struct Curl_easy *data, | |
| goto out; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(CURL_TRC_M_is_verbose(data)) { | |
| size_t timeout_count = Curl_llist_count(&data->state.timeoutlist); | |
| 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 */ | |
| if(!data) | |
| continue; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(CURL_TRC_TIMER_is_verbose(data)) { | |
| struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); | |
| if(e) { | |
| @@ -3325,9 +3319,7 @@ static void multi_timeout(struct Curl_multi *multi, | |
| long *timeout_ms) | |
| { | |
| static const struct curltime tv_zero = { 0, 0 }; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | struct Curl_easy *data = NULL; |
| - | #endif |
| + | VERBOSE(struct Curl_easy *data = NULL); |
| if(multi->dead) { | |
| *timeout_ms = 0; | |
| @@ -3354,19 +3346,14 @@ static void multi_timeout(struct Curl_multi *multi, | |
| /* some time left before expiration */ | |
| timediff_t diff_ms = | |
| curlx_timediff_ceil_ms(multi->timetree->key, *pnow); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | data = Curl_splayget(multi->timetree); |
| - | #endif |
| + | VERBOSE(data = Curl_splayget(multi->timetree)); |
| /* this should be safe even on 32-bit archs, as we do not use that | |
| overly long timeouts */ | |
| *timeout_ms = (long)diff_ms; | |
| } | |
| else { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | if(multi->timetree) { |
| - | data = Curl_splayget(multi->timetree); |
| - | } |
| - | #endif |
| + | if(multi->timetree) |
| + | VERBOSE(data = Curl_splayget(multi->timetree)); |
| /* 0 means immediately */ | |
| *timeout_ms = 0; | |
| } | |
| @@ -3376,7 +3363,7 @@ static void multi_timeout(struct Curl_multi *multi, | |
| *timeout_ms = -1; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(data && CURL_TRC_TIMER_is_verbose(data)) { | |
| struct Curl_llist_node *e = Curl_llist_head(&data->state.timeoutlist); | |
| if(e) { | |
| @@ -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. */ | |
| if(entry->announced && multi->socket_cb) { | |
| + | NOVERBOSE((void)cause); |
| CURL_TRC_M(data, "ev %s, call(fd=%" FMT_SOCKET_T ", ev=REMOVE)", cause, s); | |
| mev_in_callback(multi, TRUE); | |
| rc = multi->socket_cb(data, s, CURL_POLL_REMOVE, | |
| @@ -123,7 +123,7 @@ struct ldapreqinfo { | |
| static void oldap_state(struct Curl_easy *data, struct ldapconninfo *li, | |
| ldapstate newstate) | |
| { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* for debug purposes */ | |
| static const char * const names[] = { | |
| "STOP", | |
| @@ -140,8 +140,9 @@ static void oldap_state(struct Curl_easy *data, struct ldapconninfo *li, | |
| if(li->state != newstate) | |
| infof(data, "LDAP %p state change from %s to %s", | |
| (void *)li, names[li->state], names[newstate]); | |
| - | #endif |
| + | #else |
| (void)data; | |
| + | #endif |
| li->state = newstate; | |
| } | |
| @@ -388,7 +388,7 @@ static void pop3_state(struct Curl_easy *data, pop3state newstate) | |
| struct pop3_conn *pop3c = | |
| Curl_conn_meta_get(data->conn, CURL_META_POP3_CONN); | |
| if(pop3c) { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* for debug purposes */ | |
| static const char * const names[] = { | |
| "STOP", | |
| @@ -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, | |
| enum smb_conn_state newstate) | |
| { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* For debug purposes */ | |
| static const char * const names[] = { | |
| "SMB_NOT_CONNECTED", | |
| @@ -333,8 +333,9 @@ static void conn_state(struct Curl_easy *data, struct smb_conn *smbc, | |
| if(smbc->state != newstate) | |
| infof(data, "SMB conn %p state change from %s to %s", | |
| (void *)smbc, names[smbc->state], names[newstate]); | |
| - | #endif |
| + | #else |
| (void)data; | |
| + | #endif |
| 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); | |
| if(req) { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| /* For debug purposes */ | |
| static const char * const names[] = { | |
| "SMB_REQUESTING", | |
| @@ -576,7 +576,7 @@ static void smtp_state(struct Curl_easy *data, | |
| struct smtp_conn *smtpc, | |
| smtpstate newstate) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| /* for debug purposes */ | |
| static const char * const names[] = { | |
| "STOP", | |
| @@ -43,10 +43,6 @@ | |
| #include "curlx/inet_pton.h" | |
| #include "url.h" | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| - | #define DEBUG_AND_VERBOSE |
| - | #endif |
| - | |
| /* for the (SOCKS) connect state machine */ | |
| enum socks_state_t { | |
| SOCKS_ST_INIT, | |
| @@ -72,7 +68,7 @@ enum socks_state_t { | |
| SOCKS_ST_FAILED | |
| }; | |
| - | #ifdef DEBUG_AND_VERBOSE |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| static const char * const cf_socks_statename[] = { | |
| "SOCKS_INIT", | |
| "SOCKS4_START", | |
| @@ -160,8 +156,7 @@ CURLcode Curl_blockread_all(struct Curl_cfilter *cf, | |
| } | |
| #endif | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| - | #define DEBUG_AND_VERBOSE |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| #define sxstate(x, c, d, y) socksstate(x, c, d, y, __LINE__) | |
| #else | |
| #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_easy *data, | |
| enum socks_state_t state | |
| - | #ifdef DEBUG_AND_VERBOSE |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| , int lineno | |
| #endif | |
| ) | |
| { | |
| enum socks_state_t oldstate = sx->state; | |
| - | (void)cf; |
| - | (void)data; |
| + | |
| if(oldstate == state) | |
| /* do not bother when the new state is the same as the old state */ | |
| return; | |
| sx->state = state; | |
| - | #ifdef DEBUG_AND_VERBOSE |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| CURL_TRC_CF(data, cf, "[%s] -> [%s] (line %d)", | |
| cf_socks_statename[oldstate], | |
| cf_socks_statename[sx->state], lineno); | |
| + | #else |
| + | (void)cf; |
| + | (void)data; |
| #endif | |
| } | |
| @@ -1288,7 +1285,7 @@ static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf, | |
| else if(sx->state != SOCKS_ST_SUCCESS) | |
| goto out; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_is_verbose(data)) { | |
| struct ip_quadruple ipquad; | |
| bool is_ipv6; | |
| @@ -292,12 +292,10 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, | |
| goto error; | |
| } | |
| else { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | char *user_utf8 = curlx_convert_tchar_to_UTF8(names.sUserName); |
| + | VERBOSE(char *user_utf8 = curlx_convert_tchar_to_UTF8(names.sUserName)); |
| infof(data, "SOCKS5 server authenticated user %s with GSS-API.", | |
| (user_utf8 ? user_utf8 : "(unknown)")); | |
| - | curlx_free(user_utf8); |
| - | #endif |
| + | VERBOSE(curlx_free(user_utf8)); |
| Curl_pSecFn->FreeContextBuffer(names.sUserName); | |
| names.sUserName = NULL; | |
| } | |
| @@ -33,7 +33,7 @@ | |
| const char *curl_easy_strerror(CURLcode error) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| switch(error) { | |
| case CURLE_OK: | |
| return "No error"; | |
| @@ -325,7 +325,7 @@ const char *curl_easy_strerror(CURLcode error) | |
| const char *curl_multi_strerror(CURLMcode error) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| switch(error) { | |
| case CURLM_CALL_MULTI_PERFORM: | |
| 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) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| switch(error) { | |
| case CURLSHE_OK: | |
| return "No error"; | |
| @@ -419,7 +419,7 @@ const char *curl_share_strerror(CURLSHcode error) | |
| const char *curl_url_strerror(CURLUcode error) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| switch(error) { | |
| case CURLUE_OK: | |
| 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(); | |
| #endif | |
| int old_errno = errno; | |
| - | const char *txt; |
| + | VERBOSE(const char *txt); |
| if(!buflen) | |
| return NULL; | |
| *buf = '\0'; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| switch(err) { | |
| case SEC_E_OK: | |
| txt = "No error"; | |
| @@ -656,8 +656,7 @@ const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen) | |
| else | |
| curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err); | |
| } | |
| - | #else /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| - | (void)txt; |
| + | #else /* CURLVERBOSE */ |
| if(err == SEC_E_OK) | |
| curlx_strcopy(buf, buflen, STRCONST("No error")); | |
| else | |
| @@ -128,7 +128,7 @@ struct TELNET { | |
| unsigned char *subpointer, *subend; /* buffer for sub-options */ | |
| }; | |
| - | #ifdef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifndef CURLVERBOSE |
| #define printoption(a, b, c, d) Curl_nop_stmt | |
| #else | |
| 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) | |
| { | |
| @@ -497,11 +497,9 @@ static CURLcode tftp_connect_for_tx(struct tftp_conn *state, | |
| tftp_event_t event) | |
| { | |
| CURLcode result; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | struct Curl_easy *data = state->data; |
| - | infof(data, "%s", "Connected for transmit"); |
| - | #endif |
| + | infof(state->data, "%s", "Connected for transmit"); |
| + | |
| state->state = TFTP_STATE_TX; | |
| result = tftp_set_timeouts(state); | |
| if(result) | |
| @@ -635,11 +633,9 @@ static CURLcode tftp_connect_for_rx(struct tftp_conn *state, | |
| tftp_event_t event) | |
| { | |
| CURLcode result; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | struct Curl_easy *data = state->data; |
| - | infof(data, "%s", "Connected for receive"); |
| - | #endif |
| + | infof(state->data, "%s", "Connected for receive"); |
| + | |
| state->state = TFTP_STATE_RX; | |
| result = tftp_set_timeouts(state); | |
| if(result) | |
| @@ -1533,7 +1533,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data, | |
| { | |
| char *zoneid; | |
| 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; | |
| #endif | |
| @@ -1549,7 +1549,7 @@ static void zonefrom_url(CURLU *uh, struct Curl_easy *data, | |
| unsigned int scopeidx = 0; | |
| scopeidx = if_nametoindex(zoneid); | |
| if(!scopeidx) { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| char buffer[STRERROR_LEN]; | |
| infof(data, "Invalid zoneid: %s; %s", zoneid, | |
| 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. | |
| */ | |
| 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", | |
| 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 | |
| * allocated before we can move along and use `existing`. | |
| */ | |
| - | bool tls_upgraded = (!(conn->given->flags & PROTOPT_SSL) && |
| - | Curl_conn_is_ssl(conn, FIRSTSOCKET)); |
| + | VERBOSE(bool tls_upgraded = (!(conn->given->flags & PROTOPT_SSL) && |
| + | Curl_conn_is_ssl(conn, FIRSTSOCKET))); |
| reuse_conn(data, conn, existing); | |
| conn = existing; | |
| @@ -1039,7 +1039,7 @@ struct UrlState { | |
| curl_easy_setopt(COOKIEFILE) calls */ | |
| #endif | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */ | |
| #endif | |
| @@ -193,6 +193,8 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data, | |
| status == SEC_I_COMPLETE_AND_CONTINUE) | |
| Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc); | |
| else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) { | |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| + | |
| Curl_pSecFn->FreeCredentialsHandle(&credentials); | |
| Curl_sspi_free_identity(p_identity); | |
| curlx_free(spn); | |
| @@ -201,13 +203,8 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data, | |
| if(status == SEC_E_INSUFFICIENT_MEMORY) | |
| return CURLE_OUT_OF_MEMORY; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | { |
| - | char buffer[STRERROR_LEN]; |
| - | infof(data, "schannel: InitializeSecurityContext failed: %s", |
| - | Curl_sspi_strerror(status, buffer, sizeof(buffer))); |
| - | } |
| - | #endif |
| + | infof(data, "schannel: InitializeSecurityContext failed: %s", |
| + | Curl_sspi_strerror(status, buffer, sizeof(buffer))); |
| 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) | |
| Curl_pSecFn->CompleteAuthToken(&credentials, &resp_desc); | |
| else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) { | |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| + | |
| Curl_pSecFn->FreeCredentialsHandle(&credentials); | |
| 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) | |
| return CURLE_OUT_OF_MEMORY; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | { |
| - | char buffer[STRERROR_LEN]; |
| - | infof(data, "schannel: InitializeSecurityContext failed: %s", |
| - | Curl_sspi_strerror(status, buffer, sizeof(buffer))); |
| - | } |
| - | #endif |
| + | infof(data, "schannel: InitializeSecurityContext failed: %s", |
| + | Curl_sspi_strerror(status, buffer, sizeof(buffer))); |
| return CURLE_AUTH_ERROR; | |
| } | |
| @@ -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, | |
| data, &ctx->peer); | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_is_verbose(data)) { | |
| const ngtcp2_transport_params *rp; | |
| 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)buf; | |
| + | NOVERBOSE((void)blen); |
| CF_DATA_SAVE(save, cf, data); | |
| 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); | |
| goto out; | |
| } | |
| - | stream = H3_STREAM_CTX(ctx, data); |
| + | VERBOSE(stream = H3_STREAM_CTX(ctx, data)); |
| } | |
| else if(stream->xfer_result) { | |
| 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) { | |
| struct ip_quadruple ip; | |
| @@ -1420,7 +1420,7 @@ static CURLcode cf_quiche_connect(struct Curl_cfilter *cf, | |
| } | |
| out: | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(result && result != CURLE_AGAIN) { | |
| struct ip_quadruple ip; | |
| @@ -235,8 +235,9 @@ static CURLcode send_packet_no_gso(struct Curl_cfilter *cf, | |
| size_t gsolen, size_t *psent) | |
| { | |
| const uint8_t *p, *end = pkt + pktlen; | |
| - | size_t sent, len, calls = 0; |
| + | size_t sent, len; |
| CURLcode result = CURLE_OK; | |
| + | VERBOSE(size_t calls = 0); |
| *psent = 0; | |
| @@ -246,7 +247,7 @@ static CURLcode send_packet_no_gso(struct Curl_cfilter *cf, | |
| if(result) | |
| goto out; | |
| *psent += sent; | |
| - | ++calls; |
| + | VERBOSE(++calls); |
| } | |
| out: | |
| 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; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| const char *vquic_h3_err_str(uint64_t error_code) | |
| { | |
| if(error_code <= UINT_MAX) { | |
| @@ -785,7 +786,7 @@ const char *vquic_h3_err_str(uint64_t error_code) | |
| return "NO_ERROR"; | |
| return "unknown"; | |
| } | |
| - | #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| #if defined(USE_NGTCP2) || defined(USE_NGHTTP3) | |
| @@ -53,11 +53,11 @@ typedef enum { | |
| CURL_H3_ERR_VERSION_FALLBACK = 0x0110, | |
| } vquic_h3_error; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| const char *vquic_h3_err_str(uint64_t error_code); | |
| #else | |
| #define vquic_h3_err_str(x) "" | |
| - | #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| struct cf_quic_ctx { | |
| curl_socket_t sockfd; /* connected UDP socket */ | |
| @@ -108,7 +108,7 @@ static CURLcode sftp_error_to_CURLE(int err) | |
| return CURLE_SSH; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static const char *myssh_statename(sshstate state) | |
| { | |
| static const char * const names[] = { | |
| @@ -179,7 +179,7 @@ static const char *myssh_statename(sshstate state) | |
| } | |
| #else | |
| #define myssh_statename(x) "" | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| #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, | |
| sshstate nowstate) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(sshc->state != nowstate) { | |
| CURL_TRC_SSH(data, "[%s] -> [%s]", | |
| myssh_statename(sshc->state), | |
| @@ -251,7 +251,7 @@ static LIBSSH2_FREE_FUNC(my_libssh2_free) | |
| Curl_cfree(ptr); | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static const char *myssh_statename(sshstate state) | |
| { | |
| static const char * const names[] = { | |
| @@ -322,7 +322,7 @@ static const char *myssh_statename(sshstate state) | |
| } | |
| #else | |
| #define myssh_statename(x) "" | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| #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, | |
| sshstate nowstate) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(sshc->state != nowstate) { | |
| CURL_TRC_SSH(data, "[%s] -> [%s]", | |
| myssh_statename(sshc->state), | |
| @@ -233,7 +233,7 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf, | |
| result = SecTrustEvaluateWithError(trust, &error) ? | |
| CURLE_OK : CURLE_PEER_FAILED_VERIFICATION; | |
| if(error) { | |
| - | CFIndex code = CFErrorGetCode(error); |
| + | VERBOSE(CFIndex code = CFErrorGetCode(error)); |
| error_ref = CFErrorCopyDescription(error); | |
| if(error_ref) { | |
| @@ -166,7 +166,7 @@ static void gtls_cleanup(void) | |
| Curl_tls_keylog_close(); | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| static void showtime(struct Curl_easy *data, const char *text, time_t stamp) | |
| { | |
| 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) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_is_verbose(data)) { | |
| const char *ptr; | |
| 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, | |
| gnutls_x509_crt_t x509_cert) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_is_verbose(data)) { | |
| gnutls_datum_t certfields; | |
| int rc, algo; | |
| @@ -389,7 +389,7 @@ add_ciphers: | |
| static void mbed_dump_cert_info(struct Curl_easy *data, | |
| 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; | |
| #else | |
| const size_t bufsize = 16384; | |
| @@ -1596,7 +1596,7 @@ static CURLcode client_cert(struct Curl_easy *data, | |
| return CURLE_OK; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| /* returns non-zero on failure */ | |
| 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; | |
| char buf[1024]; | |
| int nread = -1, err; | |
| - | unsigned long sslerr; |
| size_t i; | |
| DEBUGASSERT(octx); | |
| @@ -1938,12 +1937,14 @@ static CURLcode ossl_shutdown(struct Curl_cfilter *cf, | |
| default: | |
| /* Server seems to have closed the connection without sending us | |
| * a close notify. */ | |
| - | sslerr = ERR_get_error(); |
| - | CURL_TRC_CF(data, cf, "SSL shutdown, ignore recv error: '%s', errno %d", |
| - | (sslerr ? |
| - | ossl_strerror(sslerr, buf, sizeof(buf)) : |
| - | SSL_ERROR_to_str(err)), |
| - | SOCKERRNO); |
| + | { |
| + | VERBOSE(unsigned long sslerr = ERR_get_error()); |
| + | CURL_TRC_CF(data, cf, "SSL shutdown, ignore recv error: '%s', errno %d", |
| + | (sslerr ? |
| + | ossl_strerror(sslerr, buf, sizeof(buf)) : |
| + | SSL_ERROR_to_str(err)), |
| + | SOCKERRNO); |
| + | } |
| *done = TRUE; | |
| result = CURLE_OK; | |
| break; | |
| @@ -2842,7 +2843,7 @@ static CURLcode ossl_win_load_store(struct Curl_easy *data, | |
| if(!pContext) | |
| break; | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #if defined(DEBUGBUILD) && defined(CURLVERBOSE) |
| else { | |
| char cert_name[256]; | |
| 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 | |
| OpenSSL. */ | |
| if(X509_STORE_add_cert(store, x509) == 1) { | |
| - | #if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) |
| + | #ifdef DEBUGBUILD |
| infof(data, "SSL: Imported cert"); | |
| #endif | |
| *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_primary_config *conn_cfg = Curl_ssl_cf_get_primary_config(cf); | |
| struct alpn_spec alpns; | |
| - | char error_buffer[256]; |
| CURLcode result; | |
| Curl_alpn_copy(&alpns, alpns_requested); | |
| @@ -3366,6 +3366,7 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx, | |
| (long)der_sessionid_size); | |
| if(ssl_session) { | |
| if(!SSL_set_session(octx->ssl, ssl_session)) { | |
| + | VERBOSE(char error_buffer[256]); |
| infof(data, "SSL: SSL_set_session not accepted, " | |
| "continuing without: %s", | |
| 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) | |
| { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| if(Curl_trc_is_verbose(data)) { | |
| int psigtype_nid = NID_undef; | |
| const char *negotiated_group_name = NULL; | |
| @@ -4010,7 +4011,7 @@ void Curl_ossl_report_handshake(struct Curl_easy *data, struct ossl_ctx *octx) | |
| #else | |
| (void)data; | |
| (void)octx; | |
| - | #endif /* CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| } | |
| 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) && \ | |
| 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) | |
| { | |
| STACK_OF(X509) *certstack; | |
| @@ -4580,7 +4581,7 @@ static CURLcode ossl_check_pinned_key(struct Curl_cfilter *cf, | |
| return result; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| #define MAX_CERT_NAME_LENGTH 2048 | |
| static CURLcode ossl_infof_cert(struct Curl_cfilter *cf, | |
| struct Curl_easy *data, | |
| @@ -4631,7 +4632,7 @@ out: | |
| curlx_dyn_free(&dname); | |
| return result; | |
| } | |
| - | #endif /* !CURL_DISABLE_VERBOSE_STRINGS */ |
| + | #endif /* CURLVERBOSE */ |
| #ifdef USE_APPLE_SECTRUST | |
| struct ossl_certs_ctx { | |
| @@ -4744,7 +4745,7 @@ CURLcode Curl_ossl_check_peer_cert(struct Curl_cfilter *cf, | |
| goto out; | |
| } | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| + | #ifdef CURLVERBOSE |
| result = ossl_infof_cert(cf, data, server_cert); | |
| if(result) | |
| goto out; | |
| @@ -2259,11 +2259,9 @@ static CURLcode schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data, | |
| goto cleanup; | |
| } | |
| else { | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| - | char buffer[STRERROR_LEN]; |
| + | VERBOSE(char buffer[STRERROR_LEN]); |
| failf(data, "schannel: failed to read data from server: %s", | |
| Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer))); | |
| - | #endif |
| result = CURLE_RECV_ERROR; | |
| goto cleanup; | |
| } | |
| @@ -129,6 +129,7 @@ struct websocket { | |
| size_t sendbuf_payload; /* number of payload bytes in sendbuf */ | |
| }; | |
| + | #ifdef CURLVERBOSE |
| static const char *ws_frame_name_of_op(uint8_t firstbyte) | |
| { | |
| switch(firstbyte & WSBIT_OPCODE_MASK) { | |
| @@ -148,6 +149,7 @@ static const char *ws_frame_name_of_op(uint8_t firstbyte) | |
| return "???"; | |
| } | |
| } | |
| + | #endif |
| static int ws_frame_firstbyte2flags(struct Curl_easy *data, | |
| 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, | |
| const char *msg) | |
| { | |
| + | NOVERBOSE((void)msg); |
| switch(dec->head_len) { | |
| case 0: | |
| 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, | |
| const char *msg) | |
| { | |
| + | NOVERBOSE((void)enc); |
| + | NOVERBOSE((void)msg); |
| CURL_TRC_WS(data, "WS-ENC: %s [%s%s payload=%" | |
| FMT_OFF_T "/%" FMT_OFF_T "]", | |
| msg, ws_frame_name_of_op(enc->firstbyte), | |
| @@ -119,12 +119,8 @@ struct cf_test_ctx { | |
| static void cf_test_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) | |
| { | |
| struct cf_test_ctx *ctx = cf->ctx; | |
| - | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
| infof(data, "%04dms: cf[%s] destroyed", | |
| (int)curlx_timediff_ms(curlx_now(), current_tr->started), ctx->id); | |
| - | #else |
| - | (void)data; |
| - | #endif |
| curlx_free(ctx); | |
| cf->ctx = NULL; | |
| } | |