mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-25 02:12:39 +00:00
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
The assertion in `WebSocketImplCurl::did_connect()` keeps failing for
multiple websockets when loading `https://www.speedtest.net/` since
commit 14ebcd4
. This fixes that by checking and returning false if
something went wrong and letting the caller function handle it.
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2025, Andrew Kaster <andrew@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/MemoryStream.h>
|
|
#include <LibCore/Forward.h>
|
|
#include <LibWebSocket/Impl/WebSocketImpl.h>
|
|
#include <curl/curl.h>
|
|
|
|
namespace RequestServer {
|
|
|
|
class WebSocketImplCurl final : public WebSocket::WebSocketImpl {
|
|
public:
|
|
virtual ~WebSocketImplCurl() override;
|
|
|
|
static NonnullRefPtr<WebSocketImplCurl> create(CURLM*);
|
|
|
|
virtual void connect(WebSocket::ConnectionInfo const&) override;
|
|
virtual bool can_read_line() override;
|
|
virtual ErrorOr<ByteString> read_line(size_t) override;
|
|
virtual ErrorOr<ByteBuffer> read(int max_size) override;
|
|
virtual bool send(ReadonlyBytes) override;
|
|
virtual bool eof() override;
|
|
virtual void discard_connection() override;
|
|
|
|
virtual bool handshake_complete_when_connected() const override { return true; }
|
|
|
|
bool did_connect();
|
|
|
|
private:
|
|
explicit WebSocketImplCurl(CURLM*);
|
|
|
|
CURLM* m_multi_handle { nullptr };
|
|
CURL* m_easy_handle { nullptr };
|
|
RefPtr<Core::Notifier> m_read_notifier;
|
|
RefPtr<Core::Notifier> m_error_notifier;
|
|
Vector<curl_slist*> m_curl_string_lists;
|
|
AllocatingMemoryStream m_read_buffer;
|
|
};
|
|
|
|
}
|