diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-01-26 14:14:06 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-01-27 09:19:05 +0100 |
commit | d6a37c23a3c4c24ce6ba925253740fae737f153e (patch) | |
tree | 3f1df0aaff66d255860faaa46ed61cfddf5f4d25 /lib/url.c | |
parent | 764c6bd3bf2e7a1f8bc33162ab77b667770f4f73 (diff) | |
download | curl-d6a37c23a3c4c24ce6ba925253740fae737f153e.tar.gz |
urldata: remove 'local_ip' from the connectdata struct
As the info is already stored in the transfer handle anyway, there's no
need to carry around a duplicate buffer for the life-time of the handle.
Closes #6534
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -3366,6 +3366,11 @@ static void reuse_conn(struct Curl_easy *data, struct connectdata *old_conn, struct connectdata *conn) { + /* 'local_ip' and 'local_port' get filled with local's numerical + ip address and port number whenever an outgoing connection is + **established** from the primary socket to a remote address. */ + char local_ip[MAX_IPADR_LEN] = ""; + long local_port = -1; #ifndef CURL_DISABLE_PROXY Curl_free_idnconverted_hostname(&old_conn->http_proxy.host); Curl_free_idnconverted_hostname(&old_conn->socks_proxy.host); @@ -3432,7 +3437,11 @@ static void reuse_conn(struct Curl_easy *data, old_conn->hostname_resolve = NULL; /* persist connection info in session handle */ - Curl_persistconninfo(data, conn); + if(conn->transport == TRNSPRT_TCP) { + Curl_conninfo_local(data, conn->sock[FIRSTSOCKET], + local_ip, &local_port); + } + Curl_persistconninfo(data, conn, local_ip, local_port); conn_reset_all_postponed_data(old_conn); /* free buffers */ @@ -3646,7 +3655,7 @@ static CURLcode create_conn(struct Curl_easy *data, /* this is supposed to be the connect function so we better at least check that the file is present here! */ DEBUGASSERT(conn->handler->connect_it); - Curl_persistconninfo(data, conn); + Curl_persistconninfo(data, conn, NULL, -1); result = conn->handler->connect_it(data, &done); /* Setup a "faked" transfer that'll do nothing */ |