connection: clarify transport

The `transport` to use for a transfer, e.g. TCP/QUIC/UNIX/UDP, is
initially selected by options and protocol used. This is set at the
`struct connectdata` as `transport` member.

During connection establishment, this transport may change due to
Alt-Svc or Happy-Eyeballing. Most common is the switch from TCP to QUIC.

Rename the connection member to `transport_wanted` and add a way to
query the connection for the transport in use via a new connection
filter query.

The filter query can also be used in the happy eyeballing attempts when
code needs to know which transport is used by the "filter below". This
happens in wolfssl initialization, as one example.

Closes #17923
This commit is contained in:
Stefan Eissing 2025-07-14 11:41:59 +02:00 committed by Daniel Stenberg
parent 674ad27f77
commit e9ae1bd404
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
16 changed files with 84 additions and 30 deletions

View file

@ -1683,6 +1683,10 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
DEBUGASSERT(pres2);
*((curl_socket_t *)pres2) = ctx->sock;
return CURLE_OK;
case CF_QUERY_TRANSPORT:
DEBUGASSERT(pres1);
*pres1 = ctx->transport;
return CURLE_OK;
case CF_QUERY_REMOTE_ADDR:
DEBUGASSERT(pres2);
*((const struct Curl_sockaddr_ex **)pres2) = cf->connected ?
@ -2193,7 +2197,7 @@ CURLcode Curl_conn_tcp_listen_set(struct Curl_easy *data,
result = CURLE_OUT_OF_MEMORY;
goto out;
}
ctx->transport = conn->transport;
ctx->transport = TRNSPRT_TCP;
ctx->sock = *s;
ctx->listening = TRUE;
ctx->accepted = FALSE;