From 661376a6c1eb3bd501398f225363c2d021288245 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Wed, 29 Apr 2009 02:04:23 +0000 Subject: Supports single range request with file protocol Added range request support in URLRequestFileJob to respect "Range" HTTP header. Fail with ERR_REQUESTED_RANGE_NOT_SATISFIABLE if range is bad. The following range request modes are supported: 1. Fully specified: bytes=x-y 2. With first byte position only: bytes=x- 3. With suffix length: bytes=-y Multiple ranges in a single request is not supported as we need to multipart encoding.. Last review was here: http://codereview.chromium.org/92149 Review URL: http://codereview.chromium.org/102006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14817 0039d316-1c4b-4281-b951-d872f2087c98 --- net/url_request/url_request_file_job.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'net/url_request/url_request_file_job.h') diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h index 94b65c4..3091d2a 100644 --- a/net/url_request/url_request_file_job.h +++ b/net/url_request/url_request_file_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,6 +11,7 @@ #include "base/file_util.h" #include "net/base/completion_callback.h" #include "net/base/file_stream.h" +#include "net/http/http_byte_range.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" @@ -26,6 +27,7 @@ class URLRequestFileJob : public URLRequestJob { virtual bool IsRedirectResponse(GURL* location, int* http_status_code); virtual bool GetMimeType(std::string* mime_type) const; virtual void GetResponseInfo(net::HttpResponseInfo* info); + virtual void SetExtraRequestHeaders(const std::string& headers); static URLRequest::ProtocolFactory Factory; @@ -41,6 +43,9 @@ class URLRequestFileJob : public URLRequestJob { net::FileStream stream_; bool is_directory_; + net::HttpByteRange byte_range_; + int64 remaining_bytes_; + #if defined(OS_WIN) class AsyncResolver; friend class AsyncResolver; -- cgit v1.1