]> git.ipfire.org Git - thirdparty/curl.git/commit
dns_entry: move from conn to data->state
authorStefan Eissing <stefan@eissing.org>
Mon, 19 May 2025 10:25:58 +0000 (12:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 20 May 2025 12:49:17 +0000 (14:49 +0200)
commitbe45e014c6ae82ae7752ca874ecefdc5bbc000fa
tree11d99582c2b280a7fc1244a958ed02417d449e5d
parent3ec6aa5c07407d96ca2b3fc8a95d16cb16826ef6
dns_entry: move from conn to data->state

The `struct Curl_dns_entry *` used to established a connection
do not have the connection's lifetime, but the transfer's lifetime
(of the transfer that initiates the connect).

`Curl_dns_entry *` is reference counted with the "dns cache". That
cache might be owned by the multi or the transfer's share. In the
share, the reference count needs updating under lock.

Therefore, the dns entry can only be kept *and* released using the
same transfer it was initially looked up from. But a connection is
often discarded using another transfer.

So far, the problem of this has been avoided in clearing the connection's
dns entries in the "multi_don()" handling. So, connections had NULL
dns entries after the initial transfers and its connect had been handled.

Keeping the dns entries in data->state seems therefore a better choice.

Also: remove the `struct Curl_dns_entry *` from the connect filters
contexts. Use `data->state.dns` every time instead and fail correctly
when not present and needed.

Closes #17383
14 files changed:
lib/cf-https-connect.c
lib/cf-https-connect.h
lib/connect.c
lib/connect.h
lib/cshutdn.c
lib/easy.c
lib/ftp.c
lib/hostip.c
lib/hostip.h
lib/multi.c
lib/setopt.c
lib/url.c
lib/url.h
lib/urldata.h