mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
RequestServer: Avoid using gethostbyname
Replace gethostbyname with Core::Socket::resolve_host in RequestServer::ConnectionFromClient::ensure_connection. Resolved #22199.
This commit is contained in:
parent
38164411f0
commit
7326d00baa
2 changed files with 18 additions and 14 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibCore/Proxy.h>
|
||||
#include <LibCore/Socket.h>
|
||||
#include <RequestServer/ConnectionFromClient.h>
|
||||
#include <RequestServer/Protocol.h>
|
||||
#include <RequestServer/Request.h>
|
||||
|
@ -159,7 +160,9 @@ void ConnectionFromClient::ensure_connection(URL const& url, ::RequestServer::Ca
|
|||
if (cache_level == CacheLevel::ResolveOnly) {
|
||||
return Core::deferred_invoke([host = url.serialized_host().release_value_but_fixme_should_propagate_errors().to_byte_string()] {
|
||||
dbgln("EnsureConnection: DNS-preload for {}", host);
|
||||
(void)gethostbyname(host.characters());
|
||||
auto resolved_host = Core::Socket::resolve_host(host, Core::Socket::SocketType::Stream);
|
||||
if (resolved_host.is_error())
|
||||
dbgln("EnsureConnection: DNS-preload failed for {}", host);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue