#include "net/http/bidirectional_stream.h"
#include <string>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/http/bidirectional_stream_request_info.h"
#include "net/http/http_network_session.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_stream.h"
#include "net/log/net_log.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_values.h"
#include "net/spdy/spdy_http_utils.h"
#include "net/spdy/spdy_log_util.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "url/gurl.h"
namespace net {
namespace {
base::Value::Dict NetLogHeadersParams(const quiche::HttpHeaderBlock* headers,
NetLogCaptureMode capture_mode) { … }
base::Value::Dict NetLogParams(const GURL& url,
const std::string& method,
const HttpRequestHeaders* headers,
NetLogCaptureMode capture_mode) { … }
}
BidirectionalStream::Delegate::Delegate() = default;
BidirectionalStream::Delegate::~Delegate() = default;
BidirectionalStream::BidirectionalStream(
std::unique_ptr<BidirectionalStreamRequestInfo> request_info,
HttpNetworkSession* session,
bool send_request_headers_automatically,
Delegate* delegate)
: … { … }
BidirectionalStream::BidirectionalStream(
std::unique_ptr<BidirectionalStreamRequestInfo> request_info,
HttpNetworkSession* session,
bool send_request_headers_automatically,
Delegate* delegate,
std::unique_ptr<base::OneShotTimer> timer)
: … { … }
BidirectionalStream::~BidirectionalStream() { … }
void BidirectionalStream::SendRequestHeaders() { … }
int BidirectionalStream::ReadData(IOBuffer* buf, int buf_len) { … }
void BidirectionalStream::SendvData(
const std::vector<scoped_refptr<IOBuffer>>& buffers,
const std::vector<int>& lengths,
bool end_stream) { … }
NextProto BidirectionalStream::GetProtocol() const { … }
int64_t BidirectionalStream::GetTotalReceivedBytes() const { … }
int64_t BidirectionalStream::GetTotalSentBytes() const { … }
void BidirectionalStream::GetLoadTimingInfo(
LoadTimingInfo* load_timing_info) const { … }
void BidirectionalStream::PopulateNetErrorDetails(NetErrorDetails* details) { … }
void BidirectionalStream::StartRequest() { … }
void BidirectionalStream::OnStreamReady(bool request_headers_sent) { … }
void BidirectionalStream::OnHeadersReceived(
const quiche::HttpHeaderBlock& response_headers) { … }
void BidirectionalStream::OnDataRead(int bytes_read) { … }
void BidirectionalStream::OnDataSent() { … }
void BidirectionalStream::OnTrailersReceived(
const quiche::HttpHeaderBlock& trailers) { … }
void BidirectionalStream::OnFailed(int status) { … }
void BidirectionalStream::OnStreamReady(const ProxyInfo& used_proxy_info,
std::unique_ptr<HttpStream> stream) { … }
void BidirectionalStream::OnBidirectionalStreamImplReady(
const ProxyInfo& used_proxy_info,
std::unique_ptr<BidirectionalStreamImpl> stream) { … }
void BidirectionalStream::OnWebSocketHandshakeStreamReady(
const ProxyInfo& used_proxy_info,
std::unique_ptr<WebSocketHandshakeStreamBase> stream) { … }
void BidirectionalStream::OnStreamFailed(
int result,
const NetErrorDetails& net_error_details,
const ProxyInfo& used_proxy_info,
ResolveErrorInfo resolve_error_info) { … }
void BidirectionalStream::OnCertificateError(int result,
const SSLInfo& ssl_info) { … }
void BidirectionalStream::OnNeedsProxyAuth(
const HttpResponseInfo& proxy_response,
const ProxyInfo& used_proxy_info,
HttpAuthController* auth_controller) { … }
void BidirectionalStream::OnNeedsClientAuth(SSLCertRequestInfo* cert_info) { … }
void BidirectionalStream::OnQuicBroken() { … }
void BidirectionalStream::OnSwitchesToHttpStreamPool(
HttpStreamKey stream_key,
const AlternativeServiceInfo& alternative_service_info,
quic::ParsedQuicVersion quic_version) { … }
void BidirectionalStream::NotifyFailed(int error) { … }
}