mirror of
https://github.com/curl/curl.git
synced 2026-05-07 17:07:29 +03:00
hostip: convert Curl_resolv_unix to static resolv_unix
It was only used within this file Closes #21508
This commit is contained in:
parent
2cb6ba672d
commit
481c9d46f1
2 changed files with 28 additions and 36 deletions
57
lib/hostip.c
57
lib/hostip.c
|
|
@ -935,6 +935,33 @@ clean_up:
|
|||
|
||||
#endif /* USE_ALARM_TIMEOUT */
|
||||
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
static CURLcode resolv_unix(struct Curl_easy *data,
|
||||
const char *unix_path,
|
||||
bool abstract_path,
|
||||
struct Curl_dns_entry **pdns)
|
||||
{
|
||||
struct Curl_addrinfo *addr;
|
||||
CURLcode result;
|
||||
|
||||
DEBUGASSERT(unix_path);
|
||||
*pdns = NULL;
|
||||
|
||||
result = Curl_unix2addr(unix_path, abstract_path, &addr);
|
||||
if(result) {
|
||||
if(result == CURLE_TOO_LARGE) {
|
||||
/* Long paths are not supported for now */
|
||||
failf(data, "Unix socket path too long: '%s'", unix_path);
|
||||
result = CURLE_COULDNT_RESOLVE_HOST;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
*pdns = Curl_dnscache_mk_entry(data, 0, &addr, NULL, 0);
|
||||
return *pdns ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
#endif /* USE_UNIX_SOCKETS */
|
||||
|
||||
/*
|
||||
* Curl_resolv() is the main name resolve function within libcurl. It resolves
|
||||
* a name and returns a pointer to the entry in the 'entry' argument. This
|
||||
|
|
@ -975,8 +1002,7 @@ CURLcode Curl_resolv(struct Curl_easy *data,
|
|||
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
if(peer->unix_socket)
|
||||
return Curl_resolv_unix(data, peer->hostname, (bool)peer->abstract_uds,
|
||||
pdns);
|
||||
return resolv_unix(data, peer->hostname, (bool)peer->abstract_uds, pdns);
|
||||
#else
|
||||
if(peer->unix_socket)
|
||||
return hostip_resolv_failed(data, peer->hostname, for_proxy);
|
||||
|
|
@ -1110,30 +1136,3 @@ void Curl_resolv_destroy_all(struct Curl_easy *data)
|
|||
}
|
||||
|
||||
#endif /* USE_CURL_ASYNC */
|
||||
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
CURLcode Curl_resolv_unix(struct Curl_easy *data,
|
||||
const char *unix_path,
|
||||
bool abstract_path,
|
||||
struct Curl_dns_entry **pdns)
|
||||
{
|
||||
struct Curl_addrinfo *addr;
|
||||
CURLcode result;
|
||||
|
||||
DEBUGASSERT(unix_path);
|
||||
*pdns = NULL;
|
||||
|
||||
result = Curl_unix2addr(unix_path, abstract_path, &addr);
|
||||
if(result) {
|
||||
if(result == CURLE_TOO_LARGE) {
|
||||
/* Long paths are not supported for now */
|
||||
failf(data, "Unix socket path too long: '%s'", unix_path);
|
||||
result = CURLE_COULDNT_RESOLVE_HOST;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
*pdns = Curl_dnscache_mk_entry(data, 0, &addr, NULL, 0);
|
||||
return *pdns ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
#endif /* USE_UNIX_SOCKETS */
|
||||
|
|
|
|||
|
|
@ -184,11 +184,4 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
|
|||
uint8_t transport);
|
||||
#endif
|
||||
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
CURLcode Curl_resolv_unix(struct Curl_easy *data,
|
||||
const char *unix_path,
|
||||
bool abstract_path,
|
||||
struct Curl_dns_entry **pdns);
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_HOSTIP_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue