#include "net/websockets/websocket_http2_handshake_stream.h"
#include <set>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "net/base/ip_endpoint.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/http/http_status_code.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_stream.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/websockets/websocket_basic_stream.h"
#include "net/websockets/websocket_deflate_predictor_impl.h"
#include "net/websockets/websocket_deflate_stream.h"
#include "net/websockets/websocket_handshake_constants.h"
#include "net/websockets/websocket_handshake_request_info.h"
namespace net {
namespace {
bool ValidateStatus(const HttpResponseHeaders* headers) { … }
}
WebSocketHttp2HandshakeStream::WebSocketHttp2HandshakeStream(
base::WeakPtr<SpdySession> session,
WebSocketStream::ConnectDelegate* connect_delegate,
std::vector<std::string> requested_sub_protocols,
std::vector<std::string> requested_extensions,
WebSocketStreamRequestAPI* request,
std::set<std::string> dns_aliases)
: … { … }
WebSocketHttp2HandshakeStream::~WebSocketHttp2HandshakeStream() { … }
void WebSocketHttp2HandshakeStream::RegisterRequest(
const HttpRequestInfo* request_info) { … }
int WebSocketHttp2HandshakeStream::InitializeStream(
bool can_send_early,
RequestPriority priority,
const NetLogWithSource& net_log,
CompletionOnceCallback callback) { … }
int WebSocketHttp2HandshakeStream::SendRequest(
const HttpRequestHeaders& headers,
HttpResponseInfo* response,
CompletionOnceCallback callback) { … }
int WebSocketHttp2HandshakeStream::ReadResponseHeaders(
CompletionOnceCallback callback) { … }
int WebSocketHttp2HandshakeStream::ReadResponseBody(
IOBuffer* buf,
int buf_len,
CompletionOnceCallback callback) { … }
void WebSocketHttp2HandshakeStream::Close(bool not_reusable) { … }
bool WebSocketHttp2HandshakeStream::IsResponseBodyComplete() const { … }
bool WebSocketHttp2HandshakeStream::IsConnectionReused() const { … }
void WebSocketHttp2HandshakeStream::SetConnectionReused() { … }
bool WebSocketHttp2HandshakeStream::CanReuseConnection() const { … }
int64_t WebSocketHttp2HandshakeStream::GetTotalReceivedBytes() const { … }
int64_t WebSocketHttp2HandshakeStream::GetTotalSentBytes() const { … }
bool WebSocketHttp2HandshakeStream::GetAlternativeService(
AlternativeService* alternative_service) const { … }
bool WebSocketHttp2HandshakeStream::GetLoadTimingInfo(
LoadTimingInfo* load_timing_info) const { … }
void WebSocketHttp2HandshakeStream::GetSSLInfo(SSLInfo* ssl_info) { … }
int WebSocketHttp2HandshakeStream::GetRemoteEndpoint(IPEndPoint* endpoint) { … }
void WebSocketHttp2HandshakeStream::PopulateNetErrorDetails(
NetErrorDetails* ) { … }
void WebSocketHttp2HandshakeStream::Drain(HttpNetworkSession* session) { … }
void WebSocketHttp2HandshakeStream::SetPriority(RequestPriority priority) { … }
std::unique_ptr<HttpStream>
WebSocketHttp2HandshakeStream::RenewStreamForAuth() { … }
const std::set<std::string>& WebSocketHttp2HandshakeStream::GetDnsAliases()
const { … }
std::string_view WebSocketHttp2HandshakeStream::GetAcceptChViaAlps() const { … }
std::unique_ptr<WebSocketStream> WebSocketHttp2HandshakeStream::Upgrade() { … }
bool WebSocketHttp2HandshakeStream::CanReadFromStream() const { … }
base::WeakPtr<WebSocketHandshakeStreamBase>
WebSocketHttp2HandshakeStream::GetWeakPtr() { … }
void WebSocketHttp2HandshakeStream::OnHeadersSent() { … }
void WebSocketHttp2HandshakeStream::OnHeadersReceived(
const quiche::HttpHeaderBlock& response_headers) { … }
void WebSocketHttp2HandshakeStream::OnClose(int status) { … }
void WebSocketHttp2HandshakeStream::StartRequestCallback(int rv) { … }
int WebSocketHttp2HandshakeStream::ValidateResponse() { … }
int WebSocketHttp2HandshakeStream::ValidateUpgradeResponse(
const HttpResponseHeaders* headers) { … }
void WebSocketHttp2HandshakeStream::OnFailure(
const std::string& message,
int net_error,
std::optional<int> response_code) { … }
}