mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibTLS: Disable connect() on windows
Until we implement a proper TCP and UDP connect with WinSock2, this won't be usable. Let's complain at runtime instead of link time.
This commit is contained in:
parent
2be8052f0a
commit
21dbfd9114
Notes:
github-actions[bot]
2025-02-13 02:15:19 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/21dbfd91141 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3551 Reviewed-by: https://github.com/alimpfard ✅ Reviewed-by: https://github.com/shannonbooth
1 changed files with 14 additions and 0 deletions
|
@ -52,6 +52,12 @@ ErrorOr<size_t> TLSv12::write_some(ReadonlyBytes bytes)
|
|||
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(ByteString const& host, u16 port, Options options)
|
||||
{
|
||||
#ifdef AK_OS_WINDOWS
|
||||
(void)host;
|
||||
(void)port;
|
||||
(void)options;
|
||||
return AK::Error::from_string_literal("TODO: Unable to connect via hostname on Windows");
|
||||
#else
|
||||
auto promise = Core::Promise<Empty>::construct();
|
||||
OwnPtr<Core::Socket> tcp_socket = TRY(Core::TCPSocket::connect(host, port));
|
||||
TRY(tcp_socket->set_blocking(false));
|
||||
|
@ -71,10 +77,17 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(ByteString const& host, u16 port,
|
|||
tls_socket->on_connected = nullptr;
|
||||
tls_socket->m_context.should_expect_successful_read = true;
|
||||
return tls_socket;
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(Core::SocketAddress address, ByteString const& host, Options options)
|
||||
{
|
||||
#ifdef AK_OS_WINDOWS
|
||||
(void)address;
|
||||
(void)host;
|
||||
(void)options;
|
||||
return AK::Error::from_string_literal("TODO: Unable to connect via address on Windows");
|
||||
#else
|
||||
auto promise = Core::Promise<Empty>::construct();
|
||||
OwnPtr<Core::Socket> tcp_socket = TRY(Core::TCPSocket::connect(address));
|
||||
TRY(tcp_socket->set_blocking(false));
|
||||
|
@ -94,6 +107,7 @@ ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(Core::SocketAddress address, Byte
|
|||
tls_socket->on_connected = nullptr;
|
||||
tls_socket->m_context.should_expect_successful_read = true;
|
||||
return tls_socket;
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TLSv12>> TLSv12::connect(ByteString const& host, Core::Socket& underlying_stream, Options options)
|
||||
|
|
Loading…
Add table
Reference in a new issue