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

Side by Side Diff: content/child/npapi/plugin_url_fetcher.cc

Issue 345833002: Handle redirects with NULL headers in PluginURLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/child/npapi/plugin_url_fetcher.h" 5 #include "content/child/npapi/plugin_url_fetcher.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/child/child_thread.h" 8 #include "content/child/child_thread.h"
9 #include "content/child/npapi/plugin_host.h" 9 #include "content/child/npapi/plugin_host.h"
10 #include "content/child/npapi/plugin_instance.h" 10 #include "content/child/npapi/plugin_instance.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (is_plugin_src_load_ && 206 if (is_plugin_src_load_ &&
207 !plugin_stream_->instance()->webplugin()->CheckIfRunInsecureContent( 207 !plugin_stream_->instance()->webplugin()->CheckIfRunInsecureContent(
208 new_url)) { 208 new_url)) {
209 plugin_stream_->DidFail(resource_id_); // That will delete |this|. 209 plugin_stream_->DidFail(resource_id_); // That will delete |this|.
210 return false; 210 return false;
211 } 211 }
212 212
213 // It's unfortunate that this logic of when a redirect's method changes is 213 // It's unfortunate that this logic of when a redirect's method changes is
214 // in url_request.cc, but weburlloader_impl.cc and this file have to duplicate 214 // in url_request.cc, but weburlloader_impl.cc and this file have to duplicate
215 // it instead of passing that information. 215 // it instead of passing that information.
216 int response_code = info.headers->response_code(); 216 int response_code;
217 if (info.headers) {
218 response_code = info.headers->response_code();
219 } else {
220 // A redirect may have NULL headers if it came from URLRequestRedirectJob.
221 //
222 // TODO(davidben): Get the actual response code from the browser. Either
223 // fake enough of headers to have a response code or pass it down as part of
224 // https://crbug.com/384609.
225 response_code = 307;
226 }
217 method_ = net::URLRequest::ComputeMethodForRedirect(method_, response_code); 227 method_ = net::URLRequest::ComputeMethodForRedirect(method_, response_code);
218 GURL old_url = url_; 228 GURL old_url = url_;
219 url_ = new_url; 229 url_ = new_url;
220 first_party_for_cookies_ = new_first_party_for_cookies; 230 first_party_for_cookies_ = new_first_party_for_cookies;
221 231
222 // If the plugin does not participate in url redirect notifications then just 232 // If the plugin does not participate in url redirect notifications then just
223 // block cross origin 307 POST redirects. 233 // block cross origin 307 POST redirects.
224 if (!notify_redirects_) { 234 if (!notify_redirects_) {
225 if (response_code == 307 && method_ == "POST" && 235 if (response_code == 307 && method_ == "POST" &&
226 old_url.GetOrigin() != new_url.GetOrigin()) { 236 old_url.GetOrigin() != new_url.GetOrigin()) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 381 }
372 382
373 if (error_code == net::OK) { 383 if (error_code == net::OK) {
374 plugin_stream_->DidFinishLoading(resource_id_); 384 plugin_stream_->DidFinishLoading(resource_id_);
375 } else { 385 } else {
376 plugin_stream_->DidFail(resource_id_); 386 plugin_stream_->DidFail(resource_id_);
377 } 387 }
378 } 388 }
379 389
380 } // namespace content 390 } // 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