#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/test/chromedriver/net/websocket.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <memory>
#include <string_view>
#include <utility>
#include <vector>
#include "base/base64.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/hash/sha1.h"
#include "base/json/json_writer.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/sys_addrinfo.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/log/net_log_source.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/websockets/websocket_frame.h"
#if BUILDFLAG(IS_WIN)
#include <Winsock2.h>
#endif
namespace {
bool ResolveHost(const std::string& host,
uint16_t port,
net::AddressList* address_list) { … }
}
WebSocket::WebSocket(const GURL& url,
WebSocketListener* listener,
size_t read_buffer_size)
: … { … }
WebSocket::~WebSocket() { … }
void WebSocket::Connect(net::CompletionOnceCallback callback) { … }
bool WebSocket::Send(const std::string& message) { … }
void WebSocket::OnSocketConnect(int code) { … }
void WebSocket::Write(const std::string& data) { … }
void WebSocket::OnWrite(int code) { … }
void WebSocket::ContinueWritingIfNecessary() { … }
void WebSocket::Read() { … }
void WebSocket::OnRead(bool read_again, int code) { … }
void WebSocket::OnReadDuringHandshake(const char* data, int len) { … }
void WebSocket::OnReadDuringOpen(const char* data, int len) { … }
void WebSocket::InvokeConnectCallback(int code) { … }
void WebSocket::Close(int code) { … }