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

@ -164,7 +164,7 @@ static CURLcode dynhds_add_custom(struct Curl_easy *data,
void Curl_http_proxy_get_destination(struct Curl_cfilter *cf,
const char **phostname,
int *pport, bool *pipv6_ip)
uint16_t *pport, bool *pipv6_ip)
{
DEBUGASSERT(cf);
DEBUGASSERT(cf->conn);
@ -199,14 +199,14 @@ CURLcode Curl_http_proxy_create_CONNECT(struct httpreq **preq,
struct cf_proxy_ctx *ctx = cf->ctx;
const char *hostname = NULL;
char *authority = NULL;
int port;
uint16_t port;
bool ipv6_ip;
CURLcode result;
struct httpreq *req = NULL;
Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip);
authority = curl_maprintf("%s%s%s:%d", ipv6_ip ? "[" : "", hostname,
authority = curl_maprintf("%s%s%s:%u", ipv6_ip ? "[" : "", hostname,
ipv6_ip ? "]" : "", port);
if(!authority) {
result = CURLE_OUT_OF_MEMORY;