#include "net/server/web_socket.h"
#include <string_view>
#include <vector>
#include "base/base64.h"
#include "base/check.h"
#include "base/hash/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/sys_byteorder.h"
#include "net/server/http_connection.h"
#include "net/server/http_server.h"
#include "net/server/http_server_request_info.h"
#include "net/server/http_server_response_info.h"
#include "net/server/web_socket_encoder.h"
#include "net/websockets/websocket_deflate_parameters.h"
#include "net/websockets/websocket_extension.h"
#include "net/websockets/websocket_handshake_constants.h"
namespace net {
namespace {
std::string ExtensionsHeaderString(
const std::vector<WebSocketExtension>& extensions) { … }
std::string ValidResponseString(
const std::string& accept_hash,
const std::vector<WebSocketExtension> extensions) { … }
}
WebSocket::WebSocket(HttpServer* server, HttpConnection* connection)
: … { … }
WebSocket::~WebSocket() = default;
void WebSocket::Accept(const HttpServerRequestInfo& request,
const NetworkTrafficAnnotationTag traffic_annotation) { … }
WebSocketParseResult WebSocket::Read(std::string* message) { … }
void WebSocket::Send(std::string_view message,
WebSocketFrameHeader::OpCodeEnum op_code,
const NetworkTrafficAnnotationTag traffic_annotation) { … }
void WebSocket::Fail() { … }
void WebSocket::SendErrorResponse(
const std::string& message,
const NetworkTrafficAnnotationTag traffic_annotation) { … }
}