| OLD | NEW |
| 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 "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" | 5 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 net::URLRequestContext* context) { | 63 net::URLRequestContext* context) { |
| 64 scoped_ptr<net::URLRequest> request = | 64 scoped_ptr<net::URLRequest> request = |
| 65 context->CreateRequest(upload_url_, net::DEFAULT_PRIORITY, this, NULL); | 65 context->CreateRequest(upload_url_, net::DEFAULT_PRIORITY, this, NULL); |
| 66 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 66 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 67 net::LOAD_DO_NOT_SAVE_COOKIES); | 67 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 68 return request.Pass(); | 68 return request.Pass(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void ChromeFraudulentCertificateReporter::SendReport( | 71 void ChromeFraudulentCertificateReporter::SendReport( |
| 72 const std::string& hostname, | 72 const std::string& hostname, |
| 73 const net::SSLInfo& ssl_info, | 73 const net::SSLInfo& ssl_info) { |
| 74 bool sni_available) { | |
| 75 // We do silent/automatic reporting ONLY for Google properties. For other | 74 // We do silent/automatic reporting ONLY for Google properties. For other |
| 76 // domains (when we start supporting that), we will ask for user permission. | 75 // domains (when we start supporting that), we will ask for user permission. |
| 77 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname, | 76 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname)) { |
| 78 sni_available)) { | |
| 79 return; | 77 return; |
| 80 } | 78 } |
| 81 | 79 |
| 82 std::string report = BuildReport(hostname, ssl_info); | 80 std::string report = BuildReport(hostname, ssl_info); |
| 83 | 81 |
| 84 scoped_ptr<net::URLRequest> url_request = CreateURLRequest(request_context_); | 82 scoped_ptr<net::URLRequest> url_request = CreateURLRequest(request_context_); |
| 85 url_request->set_method("POST"); | 83 url_request->set_method("POST"); |
| 86 | 84 |
| 87 scoped_ptr<net::UploadElementReader> reader( | 85 scoped_ptr<net::UploadElementReader> reader( |
| 88 net::UploadOwnedBytesElementReader::CreateWithString(report)); | 86 net::UploadOwnedBytesElementReader::CreateWithString(report)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 LOG(WARNING) << "Certificate upload HTTP status: " | 119 LOG(WARNING) << "Certificate upload HTTP status: " |
| 122 << request->GetResponseCode(); | 120 << request->GetResponseCode(); |
| 123 } | 121 } |
| 124 RequestComplete(request); | 122 RequestComplete(request); |
| 125 } | 123 } |
| 126 | 124 |
| 127 void ChromeFraudulentCertificateReporter::OnReadCompleted( | 125 void ChromeFraudulentCertificateReporter::OnReadCompleted( |
| 128 net::URLRequest* request, int bytes_read) {} | 126 net::URLRequest* request, int bytes_read) {} |
| 129 | 127 |
| 130 } // namespace chrome_browser_net | 128 } // namespace chrome_browser_net |
| OLD | NEW |