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

Side by Side Diff: net/url_request/url_request.cc

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: Just redirects. Created 4 years 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
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.h » ('j') | 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 #include "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 DCHECK(!is_pending_); 462 DCHECK(!is_pending_);
463 first_party_for_cookies_ = first_party_for_cookies; 463 first_party_for_cookies_ = first_party_for_cookies;
464 } 464 }
465 465
466 void URLRequest::set_first_party_url_policy( 466 void URLRequest::set_first_party_url_policy(
467 FirstPartyURLPolicy first_party_url_policy) { 467 FirstPartyURLPolicy first_party_url_policy) {
468 DCHECK(!is_pending_); 468 DCHECK(!is_pending_);
469 first_party_url_policy_ = first_party_url_policy; 469 first_party_url_policy_ = first_party_url_policy;
470 } 470 }
471 471
472 void URLRequest::set_insecure_request_policy(
473 InsecureRequestPolicy insecure_request_policy) {
474 DCHECK(!is_pending_);
475 DCHECK(insecure_request_policy == DO_NOT_UPGRADE_INSECURE_REQUESTS ||
476 url().SchemeIsCryptographic() ||
477 (!initiator() ||
mmenke 2016/12/14 19:41:05 The checks seems overly complicated... If !initia
Mike West 2016/12/15 07:41:18 Yes. This was me trying to be clever about doing c
478 (insecure_request_policy == UPGRADE_SAME_HOST_INSECURE_REQUESTS &&
479 initiator()->host() != url().host())));
480 insecure_request_policy_ = insecure_request_policy;
481 }
482
472 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) { 483 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) {
473 DCHECK(!is_pending_); 484 DCHECK(!is_pending_);
474 DCHECK(!initiator.has_value() || initiator.value().unique() || 485 DCHECK(!initiator.has_value() || initiator.value().unique() ||
475 initiator.value().GetURL().is_valid()); 486 initiator.value().GetURL().is_valid());
476 initiator_ = initiator; 487 initiator_ = initiator;
477 } 488 }
478 489
479 void URLRequest::set_method(const std::string& method) { 490 void URLRequest::set_method(const std::string& method) {
480 DCHECK(!is_pending_); 491 DCHECK(!is_pending_);
481 method_ = method; 492 method_ = method;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 NetworkDelegate* network_delegate) 569 NetworkDelegate* network_delegate)
559 : context_(context), 570 : context_(context),
560 network_delegate_(network_delegate ? network_delegate 571 network_delegate_(network_delegate ? network_delegate
561 : context->network_delegate()), 572 : context->network_delegate()),
562 net_log_(NetLogWithSource::Make(context->net_log(), 573 net_log_(NetLogWithSource::Make(context->net_log(),
563 NetLogSourceType::URL_REQUEST)), 574 NetLogSourceType::URL_REQUEST)),
564 url_chain_(1, url), 575 url_chain_(1, url),
565 method_("GET"), 576 method_("GET"),
566 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 577 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
567 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), 578 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
579 insecure_request_policy_(DO_NOT_UPGRADE_INSECURE_REQUESTS),
568 load_flags_(LOAD_NORMAL), 580 load_flags_(LOAD_NORMAL),
569 delegate_(delegate), 581 delegate_(delegate),
570 status_(URLRequestStatus::FromError(OK)), 582 status_(URLRequestStatus::FromError(OK)),
571 is_pending_(false), 583 is_pending_(false),
572 is_redirecting_(false), 584 is_redirecting_(false),
573 redirect_limit_(kMaxRedirects), 585 redirect_limit_(kMaxRedirects),
574 priority_(priority), 586 priority_(priority),
575 identifier_(GenerateURLRequestIdentifier()), 587 identifier_(GenerateURLRequestIdentifier()),
576 calling_delegate_(false), 588 calling_delegate_(false),
577 use_blocked_by_as_load_param_(false), 589 use_blocked_by_as_load_param_(false),
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 out->clear(); 1226 out->clear();
1215 } 1227 }
1216 1228
1217 void URLRequest::set_status(URLRequestStatus status) { 1229 void URLRequest::set_status(URLRequestStatus status) {
1218 DCHECK(status_.is_io_pending() || status_.is_success() || 1230 DCHECK(status_.is_io_pending() || status_.is_success() ||
1219 (!status.is_success() && !status.is_io_pending())); 1231 (!status.is_success() && !status.is_io_pending()));
1220 status_ = status; 1232 status_ = status;
1221 } 1233 }
1222 1234
1223 } // namespace net 1235 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698