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

Side by Side Diff: net/http/transport_security_state.cc

Issue 2648713002: Add response code to the success callback of ReportSender (Closed)
Patch Set: Remove response code from error callback Created 3 years, 8 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 #include "net/http/transport_security_state.h" 5 #include "net/http/transport_security_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 return; 832 return;
833 } 833 }
834 834
835 std::string serialized_report; 835 std::string serialized_report;
836 if (!SerializeExpectStapleReport(host_port_pair, ssl_info, ocsp_response, 836 if (!SerializeExpectStapleReport(host_port_pair, ssl_info, ocsp_response,
837 &serialized_report)) { 837 &serialized_report)) {
838 return; 838 return;
839 } 839 }
840 report_sender_->Send(expect_staple_state.report_uri, 840 report_sender_->Send(expect_staple_state.report_uri,
841 "application/json; charset=utf-8", serialized_report, 841 "application/json; charset=utf-8", serialized_report,
842 base::Closure(), 842 base::Callback<void(int)>(),
843 base::Bind(RecordUMAForHPKPReportFailure)); 843 base::Bind(RecordUMAForHPKPReportFailure));
844 } 844 }
845 845
846 bool TransportSecurityState::HasPublicKeyPins(const std::string& host) { 846 bool TransportSecurityState::HasPublicKeyPins(const std::string& host) {
847 PKPState dynamic_state; 847 PKPState dynamic_state;
848 if (GetDynamicPKPState(host, &dynamic_state)) 848 if (GetDynamicPKPState(host, &dynamic_state))
849 return dynamic_state.HasPublicKeyPins(); 849 return dynamic_state.HasPublicKeyPins();
850 850
851 STSState unused; 851 STSState unused;
852 PKPState static_pkp_state; 852 PKPState static_pkp_state;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 // also prevents accidental loops (a.com triggers a report to b.com 1134 // also prevents accidental loops (a.com triggers a report to b.com
1135 // which triggers a report to a.com). See section 2.1.4 of RFC 7469. 1135 // which triggers a report to a.com). See section 2.1.4 of RFC 7469.
1136 if (sent_reports_cache_.Get(report_cache_key, base::TimeTicks::Now())) 1136 if (sent_reports_cache_.Get(report_cache_key, base::TimeTicks::Now()))
1137 return PKPStatus::VIOLATED; 1137 return PKPStatus::VIOLATED;
1138 sent_reports_cache_.Put( 1138 sent_reports_cache_.Put(
1139 report_cache_key, true, base::TimeTicks::Now(), 1139 report_cache_key, true, base::TimeTicks::Now(),
1140 base::TimeTicks::Now() + 1140 base::TimeTicks::Now() +
1141 base::TimeDelta::FromMinutes(kTimeToRememberHPKPReportsMins)); 1141 base::TimeDelta::FromMinutes(kTimeToRememberHPKPReportsMins));
1142 1142
1143 report_sender_->Send(pkp_state.report_uri, "application/json; charset=utf-8", 1143 report_sender_->Send(pkp_state.report_uri, "application/json; charset=utf-8",
1144 serialized_report, base::Closure(), 1144 serialized_report, base::Callback<void(int)>(),
1145 base::Bind(RecordUMAForHPKPReportFailure)); 1145 base::Bind(RecordUMAForHPKPReportFailure));
1146 return PKPStatus::VIOLATED; 1146 return PKPStatus::VIOLATED;
1147 } 1147 }
1148 1148
1149 bool TransportSecurityState::GetStaticExpectCTState( 1149 bool TransportSecurityState::GetStaticExpectCTState(
1150 const std::string& host, 1150 const std::string& host,
1151 ExpectCTState* expect_ct_state) const { 1151 ExpectCTState* expect_ct_state) const {
1152 DCHECK(CalledOnValidThread()); 1152 DCHECK(CalledOnValidThread());
1153 1153
1154 if (!IsBuildTimely()) 1154 if (!IsBuildTimely())
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 TransportSecurityState::PKPStateIterator::PKPStateIterator( 1783 TransportSecurityState::PKPStateIterator::PKPStateIterator(
1784 const TransportSecurityState& state) 1784 const TransportSecurityState& state)
1785 : iterator_(state.enabled_pkp_hosts_.begin()), 1785 : iterator_(state.enabled_pkp_hosts_.begin()),
1786 end_(state.enabled_pkp_hosts_.end()) { 1786 end_(state.enabled_pkp_hosts_.end()) {
1787 } 1787 }
1788 1788
1789 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { 1789 TransportSecurityState::PKPStateIterator::~PKPStateIterator() {
1790 } 1790 }
1791 1791
1792 } // namespace 1792 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698