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

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: DCHECK. 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
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() ||
mmenke 2016/12/15 19:24:22 We allow insecure_request_policy == UPGRADE_SAME_H
477 (insecure_request_policy == UPGRADE_SAME_HOST_INSECURE_REQUESTS &&
478 initiator() && initiator()->host() == url().host()));
479 insecure_request_policy_ = insecure_request_policy;
480 }
481
472 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) { 482 void URLRequest::set_initiator(const base::Optional<url::Origin>& initiator) {
473 DCHECK(!is_pending_); 483 DCHECK(!is_pending_);
474 DCHECK(!initiator.has_value() || initiator.value().unique() || 484 DCHECK(!initiator.has_value() || initiator.value().unique() ||
475 initiator.value().GetURL().is_valid()); 485 initiator.value().GetURL().is_valid());
476 initiator_ = initiator; 486 initiator_ = initiator;
477 } 487 }
478 488
479 void URLRequest::set_method(const std::string& method) { 489 void URLRequest::set_method(const std::string& method) {
480 DCHECK(!is_pending_); 490 DCHECK(!is_pending_);
481 method_ = method; 491 method_ = method;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 NetworkDelegate* network_delegate) 568 NetworkDelegate* network_delegate)
559 : context_(context), 569 : context_(context),
560 network_delegate_(network_delegate ? network_delegate 570 network_delegate_(network_delegate ? network_delegate
561 : context->network_delegate()), 571 : context->network_delegate()),
562 net_log_(NetLogWithSource::Make(context->net_log(), 572 net_log_(NetLogWithSource::Make(context->net_log(),
563 NetLogSourceType::URL_REQUEST)), 573 NetLogSourceType::URL_REQUEST)),
564 url_chain_(1, url), 574 url_chain_(1, url),
565 method_("GET"), 575 method_("GET"),
566 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 576 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
567 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), 577 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
578 insecure_request_policy_(DO_NOT_UPGRADE_INSECURE_REQUESTS),
568 load_flags_(LOAD_NORMAL), 579 load_flags_(LOAD_NORMAL),
569 delegate_(delegate), 580 delegate_(delegate),
570 status_(URLRequestStatus::FromError(OK)), 581 status_(URLRequestStatus::FromError(OK)),
571 is_pending_(false), 582 is_pending_(false),
572 is_redirecting_(false), 583 is_redirecting_(false),
573 redirect_limit_(kMaxRedirects), 584 redirect_limit_(kMaxRedirects),
574 priority_(priority), 585 priority_(priority),
575 identifier_(GenerateURLRequestIdentifier()), 586 identifier_(GenerateURLRequestIdentifier()),
576 calling_delegate_(false), 587 calling_delegate_(false),
577 use_blocked_by_as_load_param_(false), 588 use_blocked_by_as_load_param_(false),
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 out->clear(); 1225 out->clear();
1215 } 1226 }
1216 1227
1217 void URLRequest::set_status(URLRequestStatus status) { 1228 void URLRequest::set_status(URLRequestStatus status) {
1218 DCHECK(status_.is_io_pending() || status_.is_success() || 1229 DCHECK(status_.is_io_pending() || status_.is_success() ||
1219 (!status.is_success() && !status.is_io_pending())); 1230 (!status.is_success() && !status.is_io_pending()));
1220 status_ = status; 1231 status_ = status;
1221 } 1232 }
1222 1233
1223 } // namespace net 1234 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698