diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 22:12:08 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 22:12:08 +0000 |
commit | 7c917ec090aabc41d35e6a3de51e1eaf07f2e5eb (patch) | |
tree | 36cd8603ec7350e7d508d7a0662f8b678c777627 | |
parent | 4f77cc08dc4abaa02c80118c93d6f02a99bf1218 (diff) | |
download | chromium_src-7c917ec090aabc41d35e6a3de51e1eaf07f2e5eb.zip chromium_src-7c917ec090aabc41d35e6a3de51e1eaf07f2e5eb.tar.gz chromium_src-7c917ec090aabc41d35e6a3de51e1eaf07f2e5eb.tar.bz2 |
We should use SSLInfo or related types for HTTPS
URLs only.
R=eroman,finnur
BUG=53366
TEST=net_unittests --gtest_filter=HTTPSRequestTest.HTTPS*Test
Review URL: http://codereview.chromium.org/4210004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65864 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/page_info_model.cc | 14 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_dispatcher_host.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ssl/ssl_manager.cc | 3 | ||||
-rw-r--r-- | net/http/http_response_info.cc | 16 |
4 files changed, 22 insertions, 14 deletions
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc index 9e821d4..16a8255 100644 --- a/chrome/browser/page_info_model.cc +++ b/chrome/browser/page_info_model.cc @@ -161,12 +161,20 @@ PageInfoModel::PageInfoModel(Profile* profile, icon_id = ICON_STATE_OK; headline.clear(); description.clear(); - if (ssl.security_bits() < 0) { + if (!ssl.cert_id()) { + // Not HTTPS. + DCHECK_EQ(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); + icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? + ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; + description.assign(l10n_util::GetStringFUTF16( + IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, + subject_name)); + } else if (ssl.security_bits() < 0) { // Security strength is unknown. Say nothing. icon_id = ICON_STATE_ERROR; } else if (ssl.security_bits() == 0) { - icon_id = ssl.security_style() == SECURITY_STYLE_UNAUTHENTICATED ? - ICON_STATE_WARNING_MAJOR : ICON_STATE_ERROR; + DCHECK_NE(ssl.security_style(), SECURITY_STYLE_UNAUTHENTICATED); + icon_id = ICON_STATE_ERROR; description.assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, subject_name)); diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 6fd669e..c88e558 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -1141,8 +1141,7 @@ bool ResourceDispatcherHost::CompleteResponseStarted(URLRequest* request) { } else { // We should not have any SSL state. DCHECK(!request->ssl_info().cert_status && - (request->ssl_info().security_bits == -1 || - request->ssl_info().security_bits == 0) && + request->ssl_info().security_bits == -1 && !request->ssl_info().connection_status); } diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index 208a9d2..abb5a1a 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -79,8 +79,9 @@ bool SSLManager::DeserializeSecurityInfo(const std::string& state, if (state.empty()) { // No SSL used. *cert_id = 0; + // The following are not applicable and are set to the default values. *cert_status = 0; - *security_bits = 0; // Not encrypted. + *security_bits = -1; *ssl_connection_status = 0; return false; } diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc index 00bfb92..2c23faa 100644 --- a/net/http/http_response_info.cc +++ b/net/http/http_response_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -176,13 +176,13 @@ void HttpResponseInfo::Persist(Pickle* pickle, bool skip_transient_headers, bool response_truncated) const { int flags = RESPONSE_INFO_VERSION; - if (ssl_info.cert) { + if (ssl_info.is_valid()) { flags |= RESPONSE_INFO_HAS_CERT; flags |= RESPONSE_INFO_HAS_CERT_STATUS; + if (ssl_info.security_bits != -1) + flags |= RESPONSE_INFO_HAS_SECURITY_BITS; + // TODO(wtc): we should persist ssl_info.connection_status. } - if (ssl_info.security_bits != -1) - flags |= RESPONSE_INFO_HAS_SECURITY_BITS; - // TODO(wtc): we should persist ssl_info.connection_status. if (vary_data.is_valid()) flags |= RESPONSE_INFO_HAS_VARY_DATA; if (response_truncated) @@ -214,12 +214,12 @@ void HttpResponseInfo::Persist(Pickle* pickle, headers->Persist(pickle, persist_options); - if (ssl_info.cert) { + if (ssl_info.is_valid()) { ssl_info.cert->Persist(pickle); pickle->WriteInt(ssl_info.cert_status); + if (ssl_info.security_bits != -1) + pickle->WriteInt(ssl_info.security_bits); } - if (ssl_info.security_bits != -1) - pickle->WriteInt(ssl_info.security_bits); if (vary_data.is_valid()) vary_data.Persist(pickle); |