Bug 1056934 - Part 6: Fix bug where TCPSocketParent would not use TLS when requested. r=mcmanus
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 03 Jan 2017 12:34:19 -0600
changeset 374682 a78433dca4bbdba58b232cea94251381b79a7549
parent 374681 c100d0ad4d4a8d6e5d5c1d35d09b853a733784c9
child 374683 d84bef0d3b096a523c979d24fccf25392c9fb231
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1056934
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1056934 - Part 6: Fix bug where TCPSocketParent would not use TLS when requested. r=mcmanus MozReview-Commit-ID: EQHzJWyzAN9
dom/network/TCPSocketParent.cpp
--- a/dom/network/TCPSocketParent.cpp
+++ b/dom/network/TCPSocketParent.cpp
@@ -142,19 +142,28 @@ TCPSocketParent::RecvOpenBind(const nsCS
   nsCOMPtr<nsISocketTransportService> sts =
     do_GetService("@mozilla.org/network/socket-transport-service;1", &rv);
   if (NS_FAILED(rv)) {
     FireInteralError(this, __LINE__);
     return IPC_OK();
   }
 
   nsCOMPtr<nsISocketTransport> socketTransport;
-  rv = sts->CreateTransport(nullptr, 0,
-                            aRemoteHost, aRemotePort,
-                            nullptr, getter_AddRefs(socketTransport));
+  if (aUseSSL) {
+    const char* socketTypes[1];
+    socketTypes[0] = "ssl";
+    rv = sts->CreateTransport(socketTypes, 1,
+                              aRemoteHost, aRemotePort,
+                              nullptr, getter_AddRefs(socketTransport));
+  } else {
+    rv = sts->CreateTransport(nullptr, 0,
+                              aRemoteHost, aRemotePort,
+                              nullptr, getter_AddRefs(socketTransport));
+  }
+
   if (NS_FAILED(rv)) {
     FireInteralError(this, __LINE__);
     return IPC_OK();
   }
 
   // in most cases aReuseAddrPort is false, but ICE TCP needs
   // sockets options set that allow addr/port reuse
   socketTransport->SetReuseAddrPort(aReuseAddrPort);