Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: content/browser/appcache/appcache_url_request_job.cc

Issue 2934953003: Add support for HTTP range requests in the AppCacheURLLoaderImpl class. (Closed)
Patch Set: Fix SetupRangeResponse definition Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/appcache/appcache_url_request_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/appcache_url_request_job.cc
diff --git a/content/browser/appcache/appcache_url_request_job.cc b/content/browser/appcache/appcache_url_request_job.cc
index b17d3d779612a01d65d6cb0c80db0b89988df84f..17438b87540c7bea93e3f5739ee10d9487c6797c 100644
--- a/content/browser/appcache/appcache_url_request_job.cc
+++ b/content/browser/appcache/appcache_url_request_job.cc
@@ -24,7 +24,6 @@
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
-#include "net/http/http_util.h"
#include "net/log/net_log_event_type.h"
#include "net/log/net_log_with_source.h"
#include "net/url_request/url_request.h"
@@ -339,32 +338,6 @@ const net::HttpResponseInfo* AppCacheURLRequestJob::http_info() const {
return info_->http_response_info();
}
-void AppCacheURLRequestJob::SetupRangeResponse() {
- DCHECK(is_range_request() && info_.get() && reader_.get() &&
- IsDeliveringAppCacheResponse());
- int resource_size = static_cast<int>(info_->response_data_size());
- if (resource_size < 0 || !range_requested_.ComputeBounds(resource_size)) {
- range_requested_ = net::HttpByteRange();
- return;
- }
-
- DCHECK(range_requested_.IsValid());
- int offset = static_cast<int>(range_requested_.first_byte_position());
- int length = static_cast<int>(range_requested_.last_byte_position() -
- range_requested_.first_byte_position() + 1);
-
- // Tell the reader about the range to read.
- reader_->SetReadRange(offset, length);
-
- // Make a copy of the full response headers and fix them up
- // for the range we'll be returning.
- range_response_info_.reset(
- new net::HttpResponseInfo(*info_->http_response_info()));
- net::HttpResponseHeaders* headers = range_response_info_->headers.get();
- headers->UpdateWithNewRange(
- range_requested_, resource_size, true /* replace status line */);
-}
-
void AppCacheURLRequestJob::OnReadComplete(int result) {
DCHECK(IsDeliveringAppCacheResponse());
if (result == 0) {
@@ -440,17 +413,7 @@ net::HostPortPair AppCacheURLRequestJob::GetSocketAddress() const {
void AppCacheURLRequestJob::SetExtraRequestHeaders(
const net::HttpRequestHeaders& headers) {
- std::string value;
- std::vector<net::HttpByteRange> ranges;
- if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &value) ||
- !net::HttpUtil::ParseRangeHeader(value, &ranges)) {
- return;
- }
-
- // If multiple ranges are requested, we play dumb and
- // return the entire response with 200 OK.
- if (ranges.size() == 1U)
- range_requested_ = ranges[0];
+ InitializeRangeRequestInfo(headers);
}
void AppCacheURLRequestJob::NotifyRestartRequired() {
« no previous file with comments | « content/browser/appcache/appcache_url_request_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698