#include "components/cronet/cronet_url_request.h"
#include <limits>
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "components/cronet/cronet_context.h"
#include "net/base/idempotency.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/load_states.h"
#include "net/base/net_errors.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/request_priority.h"
#include "net/base/upload_data_stream.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "net/ssl/ssl_info.h"
#include "net/ssl/ssl_private_key.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_types.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/redirect_info.h"
#include "net/url_request/url_request_context.h"
namespace cronet {
namespace {
std::string GetProxy(const net::HttpResponseInfo& info) { … }
int CalculateLoadFlags(int load_flags,
bool disable_cache,
bool disable_connection_migration) { … }
}
CronetURLRequest::CronetURLRequest(
CronetContext* context,
std::unique_ptr<Callback> callback,
const GURL& url,
net::RequestPriority priority,
bool disable_cache,
bool disable_connection_migration,
bool traffic_stats_tag_set,
int32_t traffic_stats_tag,
bool traffic_stats_uid_set,
int32_t traffic_stats_uid,
net::Idempotency idempotency,
scoped_refptr<net::SharedDictionary> shared_dictionary,
net::handles::NetworkHandle network)
: … { … }
CronetURLRequest::~CronetURLRequest() { … }
bool CronetURLRequest::SetHttpMethod(const std::string& method) { … }
bool CronetURLRequest::AddRequestHeader(const std::string& name,
const std::string& value) { … }
void CronetURLRequest::SetUpload(
std::unique_ptr<net::UploadDataStream> upload) { … }
void CronetURLRequest::Start() { … }
void CronetURLRequest::GetStatus(OnStatusCallback callback) const { … }
void CronetURLRequest::FollowDeferredRedirect() { … }
bool CronetURLRequest::ReadData(net::IOBuffer* raw_read_buffer, int max_size) { … }
void CronetURLRequest::Destroy(bool send_on_canceled) { … }
void CronetURLRequest::MaybeReportMetricsAndRunCallback(
base::OnceClosure callback) { … }
CronetURLRequest::NetworkTasks::NetworkTasks(
std::unique_ptr<Callback> callback,
const GURL& url,
net::RequestPriority priority,
int load_flags,
bool traffic_stats_tag_set,
int32_t traffic_stats_tag,
bool traffic_stats_uid_set,
int32_t traffic_stats_uid,
net::Idempotency idempotency,
scoped_refptr<net::SharedDictionary> shared_dictionary,
net::handles::NetworkHandle network)
: … { … }
CronetURLRequest::NetworkTasks::~NetworkTasks() { … }
void CronetURLRequest::NetworkTasks::OnReceivedRedirect(
net::URLRequest* request,
const net::RedirectInfo& redirect_info,
bool* defer_redirect) { … }
void CronetURLRequest::NetworkTasks::OnCertificateRequested(
net::URLRequest* request,
net::SSLCertRequestInfo* cert_request_info) { … }
void CronetURLRequest::NetworkTasks::OnSSLCertificateError(
net::URLRequest* request,
int net_error,
const net::SSLInfo& ssl_info,
bool fatal) { … }
void CronetURLRequest::NetworkTasks::OnResponseStarted(net::URLRequest* request,
int net_error) { … }
void CronetURLRequest::NetworkTasks::OnReadCompleted(net::URLRequest* request,
int bytes_read) { … }
void CronetURLRequest::NetworkTasks::Start(
CronetContext* context,
const std::string& method,
std::unique_ptr<net::HttpRequestHeaders> request_headers,
std::unique_ptr<net::UploadDataStream> upload) { … }
void CronetURLRequest::NetworkTasks::GetStatus(
OnStatusCallback callback) const { … }
void CronetURLRequest::NetworkTasks::FollowDeferredRedirect() { … }
void CronetURLRequest::NetworkTasks::ReadData(
scoped_refptr<net::IOBuffer> read_buffer,
int buffer_size) { … }
void CronetURLRequest::NetworkTasks::Destroy(CronetURLRequest* request,
bool send_on_canceled) { … }
void CronetURLRequest::NetworkTasks::ReportError(net::URLRequest* request,
int net_error) { … }
void CronetURLRequest::NetworkTasks::MaybeReportMetrics() { … }
void CronetURLRequest::NetworkTasks::MaybeReportMetricsAndRunCallback(
base::OnceClosure callback) { … }
}