build: fix disable-verbose

Fix compile error when building with `--disable-verbose`.

Adjust pytest to skip when curl is not a debug build but needs
traces.

Follow-up to b453a447ce

Closes #18053
This commit is contained in:
Stefan Eissing 2025-07-28 10:45:18 +02:00 committed by Daniel Stenberg
parent 44f5307891
commit 8e1d817cb3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 34 additions and 2 deletions

View file

@ -987,6 +987,7 @@ static CURLcode cf_he_connect(struct Curl_cfilter *cf,
if(cf->conn->handler->protocol & PROTO_FAMILY_SSH)
Curl_pgrsTime(data, TIMER_APPCONNECT); /* we are connected already */
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(Curl_trc_cf_is_verbose(cf, data)) {
struct ip_quadruple ipquad;
int is_ipv6;
@ -998,6 +999,7 @@ static CURLcode cf_he_connect(struct Curl_cfilter *cf,
host, ipquad.remote_ip, ipquad.remote_port);
}
}
#endif
data->info.numconnects++; /* to track the # of connections made */
}
break;

View file

@ -161,10 +161,12 @@ void Curl_debug(struct Curl_easy *data, curl_infotype type,
case CURLINFO_TEXT:
case CURLINFO_HEADER_OUT:
case CURLINFO_HEADER_IN:
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(CURL_TRC_IDS(data)) {
len = trc_print_ids(data, buf, TRC_LINE_MAX);
fwrite(buf, len, 1, data->set.err);
}
#endif
fwrite(s_infotype[type], 2, 1, data->set.err);
fwrite(ptr, size, 1, data->set.err);
break;

View file

@ -2220,7 +2220,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream,
struct dynhds h2_headers;
nghttp2_nv *nva = NULL;
const void *body = NULL;
size_t nheader, bodylen, i;
size_t nheader, bodylen;
nghttp2_data_provider data_prd;
int32_t stream_id;
nghttp2_priority_spec pri_spec;
@ -2282,9 +2282,10 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream,
goto out;
}
#ifndef CURL_DISABLE_VERBOSE_STRINGS
#define MAX_ACC 60000 /* <64KB to account for some overhead */
if(Curl_trc_is_verbose(data)) {
size_t acc = 0;
size_t acc = 0, i;
infof(data, "[HTTP/2] [%d] OPENED stream for %s",
stream_id, data->state.url);
@ -2302,6 +2303,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream,
"stream to be rejected.", MAX_ACC);
}
}
#endif
stream->id = stream_id;

View file

@ -596,17 +596,21 @@ static void multi_done_locked(struct connectdata *conn,
#endif
) || conn->bits.close
|| (mdctx->premature && !Curl_conn_is_multiplex(conn, FIRSTSOCKET))) {
#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, 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, mdctx->premature);
}
@ -615,8 +619,10 @@ 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. */