Index: content/renderer/media/buffered_resource_loader.cc |
diff --git a/content/renderer/media/buffered_resource_loader.cc b/content/renderer/media/buffered_resource_loader.cc |
index 5429c3268e1ed64bf2417d28617dcf082d5fb669..91528d07dfb1f0d8d0e1c1651a38a664878c4bd9 100644 |
--- a/content/renderer/media/buffered_resource_loader.cc |
+++ b/content/renderer/media/buffered_resource_loader.cc |
@@ -13,6 +13,7 @@ |
#include "base/strings/stringprintf.h" |
#include "content/renderer/media/cache_util.h" |
#include "media/base/media_log.h" |
+#include "net/http/http_byte_range.h" |
#include "net/http/http_request_headers.h" |
#include "third_party/WebKit/public/platform/WebString.h" |
#include "third_party/WebKit/public/platform/WebURLError.h" |
@@ -165,8 +166,8 @@ void BufferedResourceLoader::Start( |
if (IsRangeRequest()) { |
request.setHTTPHeaderField( |
WebString::fromUTF8(net::HttpRequestHeaders::kRange), |
- WebString::fromUTF8(GenerateHeaders(first_byte_position_, |
- last_byte_position_))); |
+ WebString::fromUTF8(net::HttpByteRange::Bounded( |
+ first_byte_position_, last_byte_position_).PrintHeader())); |
} |
frame->setReferrerForRequest(request, blink::WebURL()); |
@@ -750,27 +751,6 @@ bool BufferedResourceLoader::VerifyPartialResponse( |
return true; |
} |
-std::string BufferedResourceLoader::GenerateHeaders( |
- int64 first_byte_position, |
- int64 last_byte_position) { |
- // Construct the value for the range header. |
- std::string header; |
- if (first_byte_position > kPositionNotSpecified && |
- last_byte_position > kPositionNotSpecified) { |
- if (first_byte_position <= last_byte_position) { |
- header = base::StringPrintf("bytes=%" PRId64 "-%" PRId64, |
- first_byte_position, |
- last_byte_position); |
- } |
- } else if (first_byte_position > kPositionNotSpecified) { |
- header = base::StringPrintf("bytes=%" PRId64 "-", |
- first_byte_position); |
- } else if (last_byte_position > kPositionNotSpecified) { |
- NOTIMPLEMENTED() << "Suffix range not implemented"; |
- } |
- return header; |
-} |
- |
void BufferedResourceLoader::DoneRead(Status status, int bytes_read) { |
if (saved_forward_capacity_) { |
buffer_.set_forward_capacity(saved_forward_capacity_); |