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

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: Rebase Created 4 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
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 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 AbortRequestBeforeItStarts(filter_, sync_result, request_id); 1441 AbortRequestBeforeItStarts(filter_, sync_result, request_id);
1442 return; 1442 return;
1443 } 1443 }
1444 1444
1445 // Construct the request. 1445 // Construct the request.
1446 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest( 1446 scoped_ptr<net::URLRequest> new_request = request_context->CreateRequest(
1447 is_navigation_stream_request ? request_data.resource_body_stream_url 1447 is_navigation_stream_request ? request_data.resource_body_stream_url
1448 : request_data.url, 1448 : request_data.url,
1449 request_data.priority, nullptr); 1449 request_data.priority, nullptr);
1450 1450
1451 new_request->set_method(request_data.method); 1451 // PlzNavigate: Always set the method to GET when gaining access to the
1452 // stream that contains the response body of a navigation. Otherwise the data
1453 // that was already fetched by the browser will not be transmitted to the
1454 // renderer.
1455 if (is_navigation_stream_request)
1456 new_request->set_method("GET");
1457 else
1458 new_request->set_method(request_data.method);
1459
1452 new_request->set_first_party_for_cookies( 1460 new_request->set_first_party_for_cookies(
1453 request_data.first_party_for_cookies); 1461 request_data.first_party_for_cookies);
1454 new_request->set_initiator(request_data.request_initiator); 1462 new_request->set_initiator(request_data.request_initiator);
1455 1463
1456 if (request_data.originated_from_service_worker) { 1464 if (request_data.originated_from_service_worker) {
1457 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey, 1465 new_request->SetUserData(URLRequestServiceWorkerData::kUserDataKey,
1458 new URLRequestServiceWorkerData()); 1466 new URLRequestServiceWorkerData());
1459 } 1467 }
1460 1468
1461 // If the request is a MAIN_FRAME request, the first-party URL gets updated on 1469 // If the request is a MAIN_FRAME request, the first-party URL gets updated on
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 CHECK(IsBrowserSideNavigationEnabled()); 2180 CHECK(IsBrowserSideNavigationEnabled());
2173 2181
2174 ResourceType resource_type = info.is_main_frame ? 2182 ResourceType resource_type = info.is_main_frame ?
2175 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; 2183 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME;
2176 2184
2177 if (is_shutdown_ || 2185 if (is_shutdown_ ||
2178 // TODO(davidben): Check ShouldServiceRequest here. This is important; it 2186 // TODO(davidben): Check ShouldServiceRequest here. This is important; it
2179 // needs to be checked relative to the child that /requested/ the 2187 // needs to be checked relative to the child that /requested/ the
2180 // navigation. It's where file upload checks, etc., come in. 2188 // navigation. It's where file upload checks, etc., come in.
2181 (delegate_ && !delegate_->ShouldBeginRequest( 2189 (delegate_ && !delegate_->ShouldBeginRequest(
2182 info.begin_params.method, 2190 info.common_params.method,
2183 info.common_params.url, 2191 info.common_params.url,
2184 resource_type, 2192 resource_type,
2185 resource_context))) { 2193 resource_context))) {
2186 loader->NotifyRequestFailed(false, net::ERR_ABORTED); 2194 loader->NotifyRequestFailed(false, net::ERR_ABORTED);
2187 return; 2195 return;
2188 } 2196 }
2189 2197
2190 // Save the URL on the stack to help catch URLRequests which outlive their 2198 // Save the URL on the stack to help catch URLRequests which outlive their
2191 // URLRequestContexts. See https://crbug.com/90971 2199 // URLRequestContexts. See https://crbug.com/90971
2192 char url_buf[128]; 2200 char url_buf[128];
(...skipping 14 matching lines...) Expand all
2207 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? 2215 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here?
2208 2216
2209 // Sync loads should have maximum priority and should be the only 2217 // Sync loads should have maximum priority and should be the only
2210 // requests that have the ignore limits flag set. 2218 // requests that have the ignore limits flag set.
2211 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); 2219 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS));
2212 2220
2213 scoped_ptr<net::URLRequest> new_request; 2221 scoped_ptr<net::URLRequest> new_request;
2214 new_request = request_context->CreateRequest( 2222 new_request = request_context->CreateRequest(
2215 info.common_params.url, net::HIGHEST, nullptr); 2223 info.common_params.url, net::HIGHEST, nullptr);
2216 2224
2217 new_request->set_method(info.begin_params.method); 2225 new_request->set_method(info.common_params.method);
2218 new_request->set_first_party_for_cookies( 2226 new_request->set_first_party_for_cookies(
2219 info.first_party_for_cookies); 2227 info.first_party_for_cookies);
2220 new_request->set_initiator(info.request_initiator); 2228 new_request->set_initiator(info.request_initiator);
2221 if (info.is_main_frame) { 2229 if (info.is_main_frame) {
2222 new_request->set_first_party_url_policy( 2230 new_request->set_first_party_url_policy(
2223 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 2231 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
2224 } 2232 }
2225 2233
2226 SetReferrerForRequest(new_request.get(), info.common_params.referrer); 2234 SetReferrerForRequest(new_request.get(), info.common_params.referrer);
2227 2235
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 load_flags |= net::LOAD_PREFETCH; 2655 load_flags |= net::LOAD_PREFETCH;
2648 } 2656 }
2649 2657
2650 if (is_sync_load) 2658 if (is_sync_load)
2651 load_flags |= net::LOAD_IGNORE_LIMITS; 2659 load_flags |= net::LOAD_IGNORE_LIMITS;
2652 2660
2653 return load_flags; 2661 return load_flags;
2654 } 2662 }
2655 2663
2656 } // namespace content 2664 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_unittest.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698