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

Unified Diff: chrome/browser/cocoa/ssl_client_certificate_selector.mm

Issue 3174004: Pass both hostname and port into SSLClientSocket (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/net/preconnect.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/ssl_client_certificate_selector.mm
diff --git a/chrome/browser/cocoa/ssl_client_certificate_selector.mm b/chrome/browser/cocoa/ssl_client_certificate_selector.mm
index 48cb48a5195a643a40f22ce31e5a30c0a6af19b8..84a906c0bf18cea7bb9dbf92a32f51428be77b90 100644
--- a/chrome/browser/cocoa/ssl_client_certificate_selector.mm
+++ b/chrome/browser/cocoa/ssl_client_certificate_selector.mm
@@ -20,6 +20,7 @@
#include "chrome/browser/ssl/ssl_client_auth_handler.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "grit/generated_resources.h"
+#include "net/base/net_util.h"
#include "net/base/x509_certificate.h"
namespace {
@@ -173,11 +174,18 @@ void ShowSSLClientCertificateSelector(
// Create and set up a system choose-identity panel.
SFChooseIdentityPanel* panel = [[SFChooseIdentityPanel alloc] init];
- NSString* domain = base::SysUTF8ToNSString(
- "https://" + certRequestInfo_->host_and_port);
- // Setting the domain causes the dialog to record the preferred
- // identity in the system keychain.
- [panel setDomain:domain];
+ std::string host;
+ int port;
+ if (net::ParseHostAndPort(certRequestInfo_->host_and_port, &host, &port)) {
+ // Safari does not include the port number in its identity preferences, so
+ // similarly strip it off.
+ NSString* domain = base::SysUTF8ToNSString("https://" + host);
+ // Setting the domain causes the dialog to record the preferred
+ // identity in the system keychain.
+ [panel setDomain:domain];
+ } else {
+ NOTREACHED();
+ }
[panel setInformativeText:message];
[panel setDefaultButtonTitle:l10n_util::GetNSString(IDS_OK)];
[panel setAlternateButtonTitle:l10n_util::GetNSString(IDS_CANCEL)];
« no previous file with comments | « no previous file | chrome/browser/net/preconnect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698