#include "net/http/http_stream_factory_job.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
#include "net/base/port_util.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_delegate.h"
#include "net/base/session_usage.h"
#include "net/cert/cert_verifier.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/http/bidirectional_stream_impl.h"
#include "net/http/http_basic_stream.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/http_stream_factory.h"
#include "net/http/proxy_fallback.h"
#include "net/log/net_log.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_source_type.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/quic/bidirectional_stream_quic_impl.h"
#include "net/quic/quic_http_stream.h"
#include "net/quic/quic_session_key.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/socket/connect_job.h"
#include "net/socket/next_proto.h"
#include "net/socket/ssl_client_socket.h"
#include "net/socket/stream_socket.h"
#include "net/spdy/bidirectional_stream_spdy_impl.h"
#include "net/spdy/spdy_http_stream.h"
#include "net/spdy/spdy_session.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
namespace net {
namespace {
BASE_FEATURE(…);
}
const char* NetLogHttpStreamJobType(HttpStreamFactory::JobType job_type) { … }
base::Value::Dict NetLogHttpStreamProtoParams(NextProto negotiated_protocol) { … }
HttpStreamFactory::Job::Job(
Delegate* delegate,
JobType job_type,
HttpNetworkSession* session,
const StreamRequestInfo& request_info,
RequestPriority priority,
const ProxyInfo& proxy_info,
const std::vector<SSLConfig::CertAndStatus>& allowed_bad_certs,
url::SchemeHostPort destination,
GURL origin_url,
NextProto alternative_protocol,
quic::ParsedQuicVersion quic_version,
bool is_websocket,
bool enable_ip_based_pooling,
NetLog* net_log)
: … { … }
HttpStreamFactory::Job::~Job() { … }
void HttpStreamFactory::Job::Start(HttpStreamRequest::StreamType stream_type) { … }
int HttpStreamFactory::Job::Preconnect(int num_streams) { … }
int HttpStreamFactory::Job::RestartTunnelWithProxyAuth() { … }
LoadState HttpStreamFactory::Job::GetLoadState() const { … }
void HttpStreamFactory::Job::Resume() { … }
void HttpStreamFactory::Job::Orphan() { … }
void HttpStreamFactory::Job::SetPriority(RequestPriority priority) { … }
bool HttpStreamFactory::Job::HasAvailableSpdySession() const { … }
bool HttpStreamFactory::Job::HasAvailableQuicSession() const { … }
bool HttpStreamFactory::Job::TargettedSocketGroupHasActiveSocket() const { … }
NextProto HttpStreamFactory::Job::negotiated_protocol() const { … }
bool HttpStreamFactory::Job::using_spdy() const { … }
bool HttpStreamFactory::Job::disable_cert_verification_network_fetches() const { … }
const ProxyInfo& HttpStreamFactory::Job::proxy_info() const { … }
ResolveErrorInfo HttpStreamFactory::Job::resolve_error_info() const { … }
void HttpStreamFactory::Job::GetSSLInfo(SSLInfo* ssl_info) { … }
bool HttpStreamFactory::Job::UsingHttpProxyWithoutTunnel() const { … }
bool HttpStreamFactory::Job::CanUseExistingSpdySession() const { … }
void HttpStreamFactory::Job::OnStreamReadyCallback() { … }
void HttpStreamFactory::Job::OnWebSocketHandshakeStreamReadyCallback() { … }
void HttpStreamFactory::Job::OnBidirectionalStreamImplReadyCallback() { … }
void HttpStreamFactory::Job::OnStreamFailedCallback(int result) { … }
void HttpStreamFactory::Job::OnCertificateErrorCallback(
int result,
const SSLInfo& ssl_info) { … }
void HttpStreamFactory::Job::OnNeedsProxyAuthCallback(
const HttpResponseInfo& response,
HttpAuthController* auth_controller,
base::OnceClosure restart_with_auth_callback) { … }
void HttpStreamFactory::Job::OnNeedsClientAuthCallback(
SSLCertRequestInfo* cert_info) { … }
void HttpStreamFactory::Job::OnPreconnectsComplete(int result) { … }
void HttpStreamFactory::Job::OnIOComplete(int result) { … }
void HttpStreamFactory::Job::RunLoop(int result) { … }
int HttpStreamFactory::Job::DoLoop(int result) { … }
int HttpStreamFactory::Job::StartInternal() { … }
int HttpStreamFactory::Job::DoStart() { … }
int HttpStreamFactory::Job::DoWait() { … }
int HttpStreamFactory::Job::DoWaitComplete(int result) { … }
void HttpStreamFactory::Job::ResumeInitConnection() { … }
int HttpStreamFactory::Job::DoInitConnection() { … }
int HttpStreamFactory::Job::DoInitConnectionImpl() { … }
int HttpStreamFactory::Job::DoInitConnectionImplQuic(
int server_cert_verifier_flags) { … }
void HttpStreamFactory::Job::OnQuicHostResolution(int result) { … }
void HttpStreamFactory::Job::OnQuicSessionCreated(int result) { … }
void HttpStreamFactory::Job::OnFailedOnDefaultNetwork(int result) { … }
int HttpStreamFactory::Job::DoInitConnectionComplete(int result) { … }
int HttpStreamFactory::Job::DoWaitingUserAction(int result) { … }
int HttpStreamFactory::Job::SetSpdyHttpStreamOrBidirectionalStreamImpl(
base::WeakPtr<SpdySession> session) { … }
int HttpStreamFactory::Job::DoCreateStream() { … }
int HttpStreamFactory::Job::DoCreateStreamComplete(int result) { … }
void HttpStreamFactory::Job::OnSpdySessionAvailable(
base::WeakPtr<SpdySession> spdy_session) { … }
int HttpStreamFactory::Job::ReconsiderProxyAfterError(int error) { … }
void HttpStreamFactory::Job::MaybeCopyConnectionAttemptsFromHandle() { … }
HttpStreamFactory::JobFactory::JobFactory() = default;
HttpStreamFactory::JobFactory::~JobFactory() = default;
std::unique_ptr<HttpStreamFactory::Job>
HttpStreamFactory::JobFactory::CreateJob(
HttpStreamFactory::Job::Delegate* delegate,
HttpStreamFactory::JobType job_type,
HttpNetworkSession* session,
const StreamRequestInfo& request_info,
RequestPriority priority,
const ProxyInfo& proxy_info,
const std::vector<SSLConfig::CertAndStatus>& allowed_bad_certs,
url::SchemeHostPort destination,
GURL origin_url,
bool is_websocket,
bool enable_ip_based_pooling,
NetLog* net_log,
NextProto alternative_protocol,
quic::ParsedQuicVersion quic_version) { … }
bool HttpStreamFactory::Job::ShouldThrottleConnectForSpdy() const { … }
}