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

Side by Side Diff: webkit/child/weburlloader_impl.cc

Issue 54233002: Make net::DataURL's MIME string check stricter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sof and abarth's comment Created 7 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/child/weburlloader_impl.h" 7 #include "webkit/child/weburlloader_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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 std::string mime_type; 125 std::string mime_type;
126 std::string charset; 126 std::string charset;
127 if (net::DataURL::Parse(url, &mime_type, &charset, data)) { 127 if (net::DataURL::Parse(url, &mime_type, &charset, data)) {
128 *error_code = net::OK; 128 *error_code = net::OK;
129 // Assure same time for all time fields of data: URLs. 129 // Assure same time for all time fields of data: URLs.
130 Time now = Time::Now(); 130 Time now = Time::Now();
131 info->load_timing.request_start = TimeTicks::Now(); 131 info->load_timing.request_start = TimeTicks::Now();
132 info->load_timing.request_start_time = now; 132 info->load_timing.request_start_time = now;
133 info->request_time = now; 133 info->request_time = now;
134 info->response_time = now; 134 info->response_time = now;
135 info->headers = NULL; 135
136 scoped_refptr<net::HttpResponseHeaders> headers(
137 new net::HttpResponseHeaders(std::string()));
138 headers->ReplaceStatusLine("HTTP/1.1 200 OK");
139 std::string content_type_header = "Content-Type: " + mime_type;
sof 2013/11/08 13:34:34 Slight inconsistency in assumptions here; you don'
tyoshino (SeeGerritForStatus) 2013/11/12 05:47:26 Thanks. I see. It's well documented in the comment
140 if (!charset.empty()) {
141 content_type_header += ";charset=";
142 content_type_header += charset;
143 }
144 headers->AddHeader(content_type_header);
145 headers->AddHeader("Access-Control-Allow-Origin: *");
146 info->headers = headers;
147
136 info->mime_type.swap(mime_type); 148 info->mime_type.swap(mime_type);
137 info->charset.swap(charset); 149 info->charset.swap(charset);
138 info->security_info.clear(); 150 info->security_info.clear();
139 info->content_length = data->length(); 151 info->content_length = data->length();
140 info->encoded_data_length = 0; 152 info->encoded_data_length = 0;
141 153
142 return true; 154 return true;
143 } 155 }
144 156
145 *error_code = net::ERR_INVALID_URL; 157 *error_code = net::ERR_INVALID_URL;
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 857
846 void WebURLLoaderImpl::setDefersLoading(bool value) { 858 void WebURLLoaderImpl::setDefersLoading(bool value) {
847 context_->SetDefersLoading(value); 859 context_->SetDefersLoading(value);
848 } 860 }
849 861
850 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 862 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
851 context_->DidChangePriority(new_priority); 863 context_->DidChangePriority(new_priority);
852 } 864 }
853 865
854 } // namespace webkit_glue 866 } // namespace webkit_glue
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