#include "net/http/partial_data.h"
#include <limits>
#include <utility>
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
namespace net {
namespace {
const char kLengthHeader[] = …;
const char kRangeHeader[] = …;
const int kDataStream = …;
}
PartialData::PartialData() = default;
PartialData::~PartialData() = default;
bool PartialData::Init(const HttpRequestHeaders& headers) { … }
void PartialData::SetHeaders(const HttpRequestHeaders& headers) { … }
void PartialData::RestoreHeaders(HttpRequestHeaders* headers) const { … }
int PartialData::ShouldValidateCache(disk_cache::Entry* entry,
CompletionOnceCallback callback) { … }
void PartialData::PrepareCacheValidation(disk_cache::Entry* entry,
HttpRequestHeaders* headers) { … }
bool PartialData::IsCurrentRangeCached() const { … }
bool PartialData::IsLastRange() const { … }
bool PartialData::UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
disk_cache::Entry* entry,
bool truncated,
bool writing_in_progress) { … }
void PartialData::SetRangeToStartDownload() { … }
bool PartialData::IsRequestedRangeOK() { … }
bool PartialData::ResponseHeadersOK(const HttpResponseHeaders* headers) { … }
void PartialData::FixResponseHeaders(HttpResponseHeaders* headers,
bool success) { … }
void PartialData::FixContentLength(HttpResponseHeaders* headers) { … }
int PartialData::CacheRead(disk_cache::Entry* entry,
IOBuffer* data,
int data_len,
CompletionOnceCallback callback) { … }
int PartialData::CacheWrite(disk_cache::Entry* entry,
IOBuffer* data,
int data_len,
CompletionOnceCallback callback) { … }
void PartialData::OnCacheReadCompleted(int result) { … }
void PartialData::OnNetworkReadCompleted(int result) { … }
int PartialData::GetNextRangeLen() { … }
void PartialData::GetAvailableRangeCompleted(
const disk_cache::RangeResult& result) { … }
}