diff options
author | Lucas Clemente Vella <lvella@gmail.com> | 2021-04-24 20:04:53 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-05-20 16:58:31 +0200 |
commit | 84d2839740ca78041ac7419d9aaeac55c1e1c729 (patch) | |
tree | aee6202a7815b0cce0e1a2b9179c3b4421e7fb9a /lib/url.c | |
parent | ac54b10933749d4c17d9568532ff2f1ed64c119a (diff) | |
download | curl-84d2839740ca78041ac7419d9aaeac55c1e1c729.tar.gz |
CURLOPT_IPRESOLVE: preventing wrong IP version from being used
In some situations, it was possible that a transfer was setup to
use an specific IP version, but due do DNS caching or connection
reuse, it ended up using a different IP version from requested.
This commit changes the effect of CURLOPT_IPRESOLVE from simply
restricting address resolution to preventing the wrong connection
type being used, when choosing a connection from the pool, and
to restricting what addresses could be used when establishing
a new connection.
It is important that all addresses versions are resolved, even if
not used in that transfer in particular, because the result is
cached, and could be useful for a different transfer with a
different CURLOPT_IPRESOLVE setting.
Closes #6853
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1172,6 +1172,12 @@ ConnectionExists(struct Curl_easy *data, continue; } + if(data->set.ipver != CURL_IPRESOLVE_WHATEVER + && data->set.ipver != check->ip_version) { + /* skip because the connection is not via the requested IP version */ + continue; + } + if(bundle->multiuse == BUNDLE_MULTIPLEX) multiplexed = CONN_INUSE(check); |