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

Unified Diff: blimp/client/session/blimp_client_session.cc

Issue 1696563002: Blimp: add support for SSL connections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: blimp/client/session/blimp_client_session.cc
diff --git a/blimp/client/session/blimp_client_session.cc b/blimp/client/session/blimp_client_session.cc
index e681a0ab8b9fc7f20da2211afdd133627ef56e9d..d9d11edde463f3fe8edb5d94fac4944e96fd8d67 100644
--- a/blimp/client/session/blimp_client_session.cc
+++ b/blimp/client/session/blimp_client_session.cc
@@ -21,6 +21,7 @@
#include "blimp/net/client_connection_manager.h"
#include "blimp/net/common.h"
#include "blimp/net/null_blimp_message_processor.h"
+#include "blimp/net/ssl_client_transport.h"
#include "blimp/net/tcp_client_transport.h"
#include "net/base/address_list.h"
#include "net/base/ip_address.h"
@@ -28,6 +29,18 @@
namespace blimp {
namespace client {
+namespace {
+
+net::AddressList CreateAddressList(const std::vector<net::IPAddress>& addresses,
+ int16_t port) {
+ net::AddressList output_list;
+ for (const auto& next_address : addresses) {
+ output_list.push_back(net::IPEndPoint(next_address, port));
+ }
+ return output_list;
+}
+
+} // namespace
// This class's functions and destruction are all invoked on the IO thread by
// the BlimpClientSession.
@@ -65,7 +78,6 @@ class ClientNetworkComponents {
// they are used from the UI thread.
std::vector<scoped_ptr<BlimpMessageThreadPipe>> outgoing_pipes_;
std::vector<scoped_ptr<BlimpMessageProcessor>> outgoing_message_processors_;
-
DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents);
};
@@ -80,8 +92,21 @@ void ClientNetworkComponents::ConnectWithAssignment(
DCHECK(connection_manager_);
connection_manager_->set_client_token(assignment.client_token);
- connection_manager_->AddTransport(make_scoped_ptr(new TCPClientTransport(
- net::AddressList(assignment.ip_endpoint), nullptr)));
+ if (assignment.ssl_port > 0) {
+ if (assignment.cert) {
+ connection_manager_->AddTransport(make_scoped_ptr(new SSLClientTransport(
+ CreateAddressList(assignment.ip_addresses, assignment.ssl_port),
+ assignment.cert, nullptr)));
+ } else {
+ DLOG(FATAL) << "SSL port provided but no cert was found.";
Wez 2016/02/12 02:31:14 This check should be at the command-line parsing l
Kevin M 2016/02/13 00:44:18 Done.
+ }
+ }
+
+ if (assignment.tcp_port > 0) {
+ connection_manager_->AddTransport(make_scoped_ptr(new TCPClientTransport(
+ CreateAddressList(assignment.ip_addresses, assignment.tcp_port),
+ nullptr)));
+ }
connection_manager_->Connect();
}

Powered by Google App Engine
This is Rietveld 408576698