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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 54233002: Make net::DataURL's MIME string check stricter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "content/child/web_url_loader_impl.h" 7 #include "content/child/web_url_loader_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 std::string mime_type; 130 std::string mime_type;
131 std::string charset; 131 std::string charset;
132 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { 132 if (net::DataURL::Parse(url, &mime_type, &charset, data)) {
133 *error_code = net::OK; 133 *error_code = net::OK;
134 // Assure same time for all time fields of data: URLs. 134 // Assure same time for all time fields of data: URLs.
135 Time now = Time::Now(); 135 Time now = Time::Now();
136 info->load_timing.request_start = TimeTicks::Now(); 136 info->load_timing.request_start = TimeTicks::Now();
137 info->load_timing.request_start_time = now; 137 info->load_timing.request_start_time = now;
138 info->request_time = now; 138 info->request_time = now;
139 info->response_time = now; 139 info->response_time = now;
140 info->headers = NULL; 140
141 scoped_refptr<net::HttpResponseHeaders> headers(
142 new net::HttpResponseHeaders(std::string()));
143 headers->ReplaceStatusLine("HTTP/1.1 200 OK");
144 DCHECK(!mime_type.empty());
145 DCHECK(!charset.empty());
146 std::string content_type_header =
147 "Content-Type: " + mime_type + ";charset=" + charset;
abarth-chromium 2014/03/24 16:40:30 Do we know that mime_type and charset are such tha
tyoshino (SeeGerritForStatus) 2014/03/26 17:34:07 Added mime_type grammar check in net::DataURL::Par
148 headers->AddHeader(content_type_header);
149 headers->AddHeader("Access-Control-Allow-Origin: *");
150 headers->AddHeader("Access-Control-Allow-Credentials: true");
abarth-chromium 2014/03/24 16:40:30 I don't think you can combine Access-Control-Allow
tyoshino (SeeGerritForStatus) 2014/03/24 19:36:58 robwu@ suggested this change in #21. With https://
151 info->headers = headers;
152
141 info->mime_type.swap(mime_type); 153 info->mime_type.swap(mime_type);
142 info->charset.swap(charset); 154 info->charset.swap(charset);
143 info->security_info.clear(); 155 info->security_info.clear();
144 info->content_length = data->length(); 156 info->content_length = data->length();
145 info->encoded_data_length = 0; 157 info->encoded_data_length = 0;
146 158
147 return true; 159 return true;
148 } 160 }
149 161
150 *error_code = net::ERR_INVALID_URL; 162 *error_code = net::ERR_INVALID_URL;
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 878
867 void WebURLLoaderImpl::setDefersLoading(bool value) { 879 void WebURLLoaderImpl::setDefersLoading(bool value) {
868 context_->SetDefersLoading(value); 880 context_->SetDefersLoading(value);
869 } 881 }
870 882
871 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 883 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
872 context_->DidChangePriority(new_priority); 884 context_->DidChangePriority(new_priority);
873 } 885 }
874 886
875 } // namespace content 887 } // namespace content
OLDNEW
« 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