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

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

Issue 2365353004: Add Content-Type header to net::ReportSender reports (Closed)
Patch Set: eroman comment Created 4 years, 2 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
« no previous file with comments | « net/http/transport_security_state.h ('k') | net/http/transport_security_state_unittest.cc » ('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/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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 if (ssl_info.ocsp_result.response_status == OCSPVerifyResult::PROVIDED && 806 if (ssl_info.ocsp_result.response_status == OCSPVerifyResult::PROVIDED &&
807 ssl_info.ocsp_result.revocation_status == OCSPRevocationStatus::GOOD) { 807 ssl_info.ocsp_result.revocation_status == OCSPRevocationStatus::GOOD) {
808 return; 808 return;
809 } 809 }
810 810
811 std::string serialized_report; 811 std::string serialized_report;
812 if (!SerializeExpectStapleReport(host_port_pair, ssl_info, ocsp_response, 812 if (!SerializeExpectStapleReport(host_port_pair, ssl_info, ocsp_response,
813 &serialized_report)) { 813 &serialized_report)) {
814 return; 814 return;
815 } 815 }
816 report_sender_->Send(expect_staple_state.report_uri, serialized_report); 816 report_sender_->Send(expect_staple_state.report_uri,
817 "application/json; charset=utf-8", serialized_report);
817 } 818 }
818 819
819 bool TransportSecurityState::HasPublicKeyPins(const std::string& host) { 820 bool TransportSecurityState::HasPublicKeyPins(const std::string& host) {
820 PKPState dynamic_state; 821 PKPState dynamic_state;
821 if (GetDynamicPKPState(host, &dynamic_state)) 822 if (GetDynamicPKPState(host, &dynamic_state))
822 return dynamic_state.HasPublicKeyPins(); 823 return dynamic_state.HasPublicKeyPins();
823 824
824 STSState unused; 825 STSState unused;
825 PKPState static_pkp_state; 826 PKPState static_pkp_state;
826 if (GetStaticDomainState(host, &unused, &static_pkp_state)) { 827 if (GetStaticDomainState(host, &unused, &static_pkp_state)) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 // |kTimeToRememberHPKPReportsMins|, which reduces load on servers and 1065 // |kTimeToRememberHPKPReportsMins|, which reduces load on servers and
1065 // also prevents accidental loops (a.com triggers a report to b.com 1066 // also prevents accidental loops (a.com triggers a report to b.com
1066 // which triggers a report to a.com). See section 2.1.4 of RFC 7469. 1067 // which triggers a report to a.com). See section 2.1.4 of RFC 7469.
1067 if (sent_reports_cache_.Get(report_cache_key, base::TimeTicks::Now())) 1068 if (sent_reports_cache_.Get(report_cache_key, base::TimeTicks::Now()))
1068 return PKPStatus::VIOLATED; 1069 return PKPStatus::VIOLATED;
1069 sent_reports_cache_.Put( 1070 sent_reports_cache_.Put(
1070 report_cache_key, true, base::TimeTicks::Now(), 1071 report_cache_key, true, base::TimeTicks::Now(),
1071 base::TimeTicks::Now() + 1072 base::TimeTicks::Now() +
1072 base::TimeDelta::FromMinutes(kTimeToRememberHPKPReportsMins)); 1073 base::TimeDelta::FromMinutes(kTimeToRememberHPKPReportsMins));
1073 1074
1074 report_sender_->Send(pkp_state.report_uri, serialized_report); 1075 report_sender_->Send(pkp_state.report_uri, "application/json; charset=utf-8",
1076 serialized_report);
1075 return PKPStatus::VIOLATED; 1077 return PKPStatus::VIOLATED;
1076 } 1078 }
1077 1079
1078 bool TransportSecurityState::GetStaticExpectCTState( 1080 bool TransportSecurityState::GetStaticExpectCTState(
1079 const std::string& host, 1081 const std::string& host,
1080 ExpectCTState* expect_ct_state) const { 1082 ExpectCTState* expect_ct_state) const {
1081 DCHECK(CalledOnValidThread()); 1083 DCHECK(CalledOnValidThread());
1082 1084
1083 if (!IsBuildTimely()) 1085 if (!IsBuildTimely())
1084 return false; 1086 return false;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 TransportSecurityState::PKPStateIterator::PKPStateIterator( 1657 TransportSecurityState::PKPStateIterator::PKPStateIterator(
1656 const TransportSecurityState& state) 1658 const TransportSecurityState& state)
1657 : iterator_(state.enabled_pkp_hosts_.begin()), 1659 : iterator_(state.enabled_pkp_hosts_.begin()),
1658 end_(state.enabled_pkp_hosts_.end()) { 1660 end_(state.enabled_pkp_hosts_.end()) {
1659 } 1661 }
1660 1662
1661 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { 1663 TransportSecurityState::PKPStateIterator::~PKPStateIterator() {
1662 } 1664 }
1663 1665
1664 } // namespace 1666 } // namespace
OLDNEW
« no previous file with comments | « net/http/transport_security_state.h ('k') | net/http/transport_security_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698