urldata: import port types and conn destination format

Convert more `int port` to `uint16_t` port types. Reshuffle ports in
connectdata to save some bytes. Change `conn->destination` format to

- make it more readable and thus usable in tracing
- add the IPv6 scope_id only when not default (global)
  and make it resemble more the textual format for IPv6
  (e.g. suffix '%<scope_id>')

Closes #20918
This commit is contained in:
Stefan Eissing 2026-03-13 13:34:46 +01:00 committed by Daniel Stenberg
parent dfadec7ec3
commit 9325eb5fc4
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 54 additions and 66 deletions

View file

@ -600,22 +600,6 @@ static void multi_done_locked(struct connectdata *conn,
void *userdata)
{
struct multi_done_ctx *mdctx = userdata;
#ifdef CURLVERBOSE
const char *host =
#ifndef CURL_DISABLE_PROXY
conn->bits.socksproxy ?
conn->socks_proxy.host.dispname :
conn->bits.httpproxy ? conn->http_proxy.host.dispname :
#endif
conn->bits.conn_to_host ? conn->conn_to_host.dispname :
conn->host.dispname;
int port =
#ifndef CURL_DISABLE_PROXY
conn->bits.httpproxy ? conn->http_proxy.port :
#endif
conn->bits.conn_to_port ? conn->conn_to_port :
conn->remote_port;
#endif /* CURLVERBOSE */
Curl_detach_connection(data);
@ -635,17 +619,18 @@ static void multi_done_locked(struct connectdata *conn,
Curl_dnscache_prune(data);
if(multi_conn_should_close(conn, data, (bool)mdctx->premature)) {
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, "
"forbid=%d, close=%d, premature=%d, conn_multiplex=%d",
conn->connection_id, host, port, data->set.reuse_forbid,
conn->bits.close, mdctx->premature,
conn->connection_id, conn->destination,
data->set.reuse_forbid, conn->bits.close, mdctx->premature,
Curl_conn_is_multiplex(conn, FIRSTSOCKET));
connclose(conn, "disconnecting");
Curl_conn_terminate(data, conn, (bool)mdctx->premature);
}
else if(!Curl_conn_get_max_concurrent(data, conn, FIRSTSOCKET)) {
CURL_TRC_M(data, "multi_done, conn #%" FMT_OFF_T " to %s:%d was shutdown"
" by server, not reusing", conn->connection_id, host, port);
CURL_TRC_M(data, "multi_done, conn #%" FMT_OFF_T " to %s was shutdown"
" by server, not reusing", conn->connection_id,
conn->destination);
connclose(conn, "server shutdown");
Curl_conn_terminate(data, conn, (bool)mdctx->premature);
}
@ -654,8 +639,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;
infof(data, "Connection #%" FMT_OFF_T " to host %s:%d left intact",
conn->connection_id, host, port);
infof(data, "Connection #%" FMT_OFF_T " to host %s left intact",
conn->connection_id, conn->destination);
}
else {
/* connection was removed from the cpool and destroyed. */