Chromium Code Reviews| Index: net/url_request/url_request_http_job.cc |
| diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc |
| index 6204faa4d2abc55ccade5d7314c87c8baac2dcb2..4705ef261c63f3144b7246dd1d30153bcc5f731d 100644 |
| --- a/net/url_request/url_request_http_job.cc |
| +++ b/net/url_request/url_request_http_job.cc |
| @@ -350,6 +350,7 @@ void URLRequestHttpJob::NotifyHeadersComplete() { |
| // The ordering of these calls is not important. |
| ProcessStrictTransportSecurityHeader(); |
| ProcessPublicKeyPinsHeader(); |
| + ProcessExpectCTHeader(); |
| // Handle the server notification of a new SDCH dictionary. |
| SdchManager* sdch_manager(request()->context()->sdch_manager()); |
| @@ -850,6 +851,27 @@ void URLRequestHttpJob::ProcessPublicKeyPinsHeader() { |
| } |
| } |
| +void URLRequestHttpJob::ProcessExpectCTHeader() { |
| + DCHECK(response_info_); |
| + TransportSecurityState* security_state = |
| + request_->context()->transport_security_state(); |
| + const SSLInfo& ssl_info = response_info_->ssl_info; |
| + |
| + // Only accept Expect CT headers on HTTPS connections that have no |
| + // certificate errors. |
| + if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status) || |
| + !security_state) |
| + return; |
|
mmenke
2016/03/07 18:28:08
nit: Use braces if an if condition takes up multi
|
| + |
| + // Only process the first Expect-CT header value. |
| + HttpResponseHeaders* headers = GetResponseHeaders(); |
| + std::string value; |
| + if (headers->EnumerateHeader(nullptr, "Expect-CT", &value)) { |
| + security_state->ProcessExpectCTHeader( |
| + value, HostPortPair::FromURL(request_info_.url), ssl_info); |
| + } |
| +} |
| + |
| void URLRequestHttpJob::OnStartCompleted(int result) { |
| RecordTimer(); |