diff options
author | Klaus Crusius <klaus.crusius@web.de> | 2020-11-28 18:17:11 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-12-06 11:18:28 +0100 |
commit | 2c0d7212151bce7f51ffb83a78876c2ed224958a (patch) | |
tree | 216203f81099b6ea08f08e6d99cb56428e93a58e /lib/ftp.c | |
parent | 7a6fdd503db481ce8c3b17520dbafaddffc9200f (diff) | |
download | curl-2c0d7212151bce7f51ffb83a78876c2ed224958a.tar.gz |
ftp: retry getpeername for FTP with TCP_FASTOPEN
In the case of TFO, the remote host name is not resolved at the
connetion time.
For FTP that has lead to missing hostname for the secondary connection.
Therefore the name resolution is done at the time, when FTP requires it.
Fixes #6252
Closes #6265
Closes #6282
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1940,6 +1940,17 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, #endif { /* normal, direct, ftp connection */ + DEBUGASSERT(ftpc->newhost); + + /* postponed address resolution in case of tcp fastopen */ + if(conn->bits.tcp_fastopen && !conn->bits.reuse && !ftpc->newhost[0]) { + Curl_conninfo_remote(conn, conn->sock[FIRSTSOCKET]); + Curl_safefree(ftpc->newhost); + ftpc->newhost = strdup(control_address(conn)); + if(!ftpc->newhost) + return CURLE_OUT_OF_MEMORY; + } + rc = Curl_resolv(conn, ftpc->newhost, ftpc->newport, FALSE, &addr); if(rc == CURLRESOLV_PENDING) /* BLOCKING */ |