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

Unified Diff: content/renderer/media/android/media_info_loader.cc

Issue 485023003: Use range request for CORS access check on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/android/media_info_loader.cc
diff --git a/content/renderer/media/android/media_info_loader.cc b/content/renderer/media/android/media_info_loader.cc
index 3c22389e46e259e06265eb931cd9f29ec40cced1..ce3a299b7193b3bd36e5b23ac7f02175334f0eb7 100644
--- a/content/renderer/media/android/media_info_loader.cc
+++ b/content/renderer/media/android/media_info_loader.cc
@@ -22,6 +22,7 @@ using blink::WebURLResponse;
namespace content {
static const int kHttpOK = 200;
+static const int kHttpPartialContentOK = 206;
MediaInfoLoader::MediaInfoLoader(
const GURL& url,
@@ -50,6 +51,12 @@ void MediaInfoLoader::Start(blink::WebFrame* frame) {
request.setRequestContext(WebURLRequest::RequestContextVideo);
frame->setReferrerForRequest(request, blink::WebURL());
+ // Since we don't actually care about the media data at this time, use a two
+ // byte range request to avoid unnecessarily downloading resources. Not all
+ // servers support HEAD unfortunately, so use a range request; which is no
+ // worse than the previous request+cancel code. See http://crbug.com/400788
+ request.addHTTPHeaderField("Range", "bytes=0-1");
+
scoped_ptr<WebURLLoader> loader;
if (test_loader_) {
loader = test_loader_.Pass();
@@ -123,7 +130,8 @@ void MediaInfoLoader::didReceiveResponse(
DidBecomeReady(kOk);
return;
}
- if (response.httpStatusCode() == kHttpOK) {
+ if (response.httpStatusCode() == kHttpOK ||
+ response.httpStatusCode() == kHttpPartialContentOK) {
DidBecomeReady(kOk);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698