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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1678303004: PlzNavigate: inform the renderer that a navigation is a POST (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 AbortRequestBeforeItStarts(filter_, sync_result, request_id); 1481 AbortRequestBeforeItStarts(filter_, sync_result, request_id);
1482 return; 1482 return;
1483 } 1483 }
1484 1484
1485 // Construct the request. 1485 // Construct the request.
1486 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest( 1486 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest(
1487 is_navigation_stream_request ? request_data.resource_body_stream_url 1487 is_navigation_stream_request ? request_data.resource_body_stream_url
1488 : request_data.url, 1488 : request_data.url,
1489 request_data.priority, nullptr); 1489 request_data.priority, nullptr);
1490 1490
1491 new_request->set_method(request_data.method); 1491 // PlzNavigate: always set the method to GET when gaining access to the
Charlie Reis 2016/02/17 05:55:28 nit: Capitalize Always
1492 // stream that contains the response body of a navigation.
Charlie Reis 2016/02/17 05:55:28 I think this comment needs a bit more elaboration.
clamy 2016/02/17 12:39:38 I've added a sentence that explains what happens i
Charlie Reis 2016/02/17 21:52:06 Yes, thanks.
1493 if (is_navigation_stream_request)
1494 new_request->set_method("GET");
1495 else
1496 new_request->set_method(request_data.method);
1497
1492 new_request->set_first_party_for_cookies( 1498 new_request->set_first_party_for_cookies(
1493 request_data.first_party_for_cookies); 1499 request_data.first_party_for_cookies);
1494 new_request->set_initiator(request_data.request_initiator); 1500 new_request->set_initiator(request_data.request_initiator);
1495 1501
1496 // If the request is a MAIN_FRAME request, the first-party URL gets updated on 1502 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
1497 // redirects. 1503 // redirects.
1498 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { 1504 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) {
1499 new_request->set_first_party_url_policy( 1505 new_request->set_first_party_url_policy(
1500 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 1506 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
1501 } 1507 }
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 CHECK(IsBrowserSideNavigationEnabled()); 2213 CHECK(IsBrowserSideNavigationEnabled());
2208 2214
2209 ResourceType resource_type = info.is_main_frame ? 2215 ResourceType resource_type = info.is_main_frame ?
2210 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; 2216 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME;
2211 2217
2212 if (is_shutdown_ || 2218 if (is_shutdown_ ||
2213 // TODO(davidben): Check ShouldServiceRequest here. This is important; it 2219 // TODO(davidben): Check ShouldServiceRequest here. This is important; it
2214 // needs to be checked relative to the child that /requested/ the 2220 // needs to be checked relative to the child that /requested/ the
2215 // navigation. It's where file upload checks, etc., come in. 2221 // navigation. It's where file upload checks, etc., come in.
2216 (delegate_ && !delegate_->ShouldBeginRequest( 2222 (delegate_ && !delegate_->ShouldBeginRequest(
2217 info.begin_params.method, 2223 info.common_params.is_post ? "POST" : "GET",
Charlie Reis 2016/02/17 05:55:28 There might be some loss of generality here. Was
clamy 2016/02/17 12:39:38 I changed the boolean to a string, this should not
Charlie Reis 2016/02/17 21:52:06 Ok, thanks. (Out of curiosity, was it possible fo
clamy 2016/02/22 12:48:36 Honestly I don't know. I know in some places in th
2218 info.common_params.url, 2224 info.common_params.url,
2219 resource_type, 2225 resource_type,
2220 resource_context))) { 2226 resource_context))) {
2221 loader->NotifyRequestFailed(false, net::ERR_ABORTED); 2227 loader->NotifyRequestFailed(false, net::ERR_ABORTED);
2222 return; 2228 return;
2223 } 2229 }
2224 2230
2225 // Save the URL on the stack to help catch URLRequests which outlive their 2231 // Save the URL on the stack to help catch URLRequests which outlive their
2226 // URLRequestContexts. See https://crbug.com/90971 2232 // URLRequestContexts. See https://crbug.com/90971
2227 char url_buf[128]; 2233 char url_buf[128];
(...skipping 14 matching lines...) Expand all
2242 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? 2248 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here?
2243 2249
2244 // Sync loads should have maximum priority and should be the only 2250 // Sync loads should have maximum priority and should be the only
2245 // requests that have the ignore limits flag set. 2251 // requests that have the ignore limits flag set.
2246 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); 2252 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS));
2247 2253
2248 scoped_ptr<net::URLRequest> new_request; 2254 scoped_ptr<net::URLRequest> new_request;
2249 new_request = request_context->CreateRequest( 2255 new_request = request_context->CreateRequest(
2250 info.common_params.url, net::HIGHEST, nullptr); 2256 info.common_params.url, net::HIGHEST, nullptr);
2251 2257
2252 new_request->set_method(info.begin_params.method); 2258 new_request->set_method(info.common_params.is_post ? "POST" : "GET");
2253 new_request->set_first_party_for_cookies( 2259 new_request->set_first_party_for_cookies(
2254 info.first_party_for_cookies); 2260 info.first_party_for_cookies);
2255 new_request->set_initiator(info.request_initiator); 2261 new_request->set_initiator(info.request_initiator);
2256 if (info.is_main_frame) { 2262 if (info.is_main_frame) {
2257 new_request->set_first_party_url_policy( 2263 new_request->set_first_party_url_policy(
2258 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 2264 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
2259 } 2265 }
2260 2266
2261 SetReferrerForRequest(new_request.get(), info.common_params.referrer); 2267 SetReferrerForRequest(new_request.get(), info.common_params.referrer);
2262 2268
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 load_flags |= net::LOAD_PREFETCH; 2688 load_flags |= net::LOAD_PREFETCH;
2683 } 2689 }
2684 2690
2685 if (is_sync_load) 2691 if (is_sync_load)
2686 load_flags |= net::LOAD_IGNORE_LIMITS; 2692 load_flags |= net::LOAD_IGNORE_LIMITS;
2687 2693
2688 return load_flags; 2694 return load_flags;
2689 } 2695 }
2690 2696
2691 } // namespace content 2697 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698