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

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: 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 std::string raw_header = "HTTP/1.1 200 OK";
sof 2013/10/31 08:19:32 Possible to bring in the use of net::HttpUtil::Ass
tyoshino (SeeGerritForStatus) 2013/10/31 08:53:20 Thanks for suggestion. But it'll be: std::str
sof 2013/10/31 15:26:59 Yes, that wouldn't avoid the explicit formatting o
137 raw_header += '\0';
138 raw_header += "Content-Type: " + mime_type;
139 if (!charset.empty()) {
140 raw_header += ";charset=";
141 raw_header += charset;
142 }
143 raw_header.append("\0\0", 2);
144
145 info->headers = new net::HttpResponseHeaders(raw_header);
136 info->mime_type.swap(mime_type); 146 info->mime_type.swap(mime_type);
137 info->charset.swap(charset); 147 info->charset.swap(charset);
138 info->security_info.clear(); 148 info->security_info.clear();
139 info->content_length = data->length(); 149 info->content_length = data->length();
140 info->encoded_data_length = 0; 150 info->encoded_data_length = 0;
141 151
142 return true; 152 return true;
143 } 153 }
144 154
145 *error_code = net::ERR_INVALID_URL; 155 *error_code = net::ERR_INVALID_URL;
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 855
846 void WebURLLoaderImpl::setDefersLoading(bool value) { 856 void WebURLLoaderImpl::setDefersLoading(bool value) {
847 context_->SetDefersLoading(value); 857 context_->SetDefersLoading(value);
848 } 858 }
849 859
850 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 860 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
851 context_->DidChangePriority(new_priority); 861 context_->DidChangePriority(new_priority);
852 } 862 }
853 863
854 } // namespace webkit_glue 864 } // 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