Bug 1056934 - Part 6: Fix bug where TCPSocketParent would not use TLS when requested. r=mcmanus
MozReview-Commit-ID: EQHzJWyzAN9
--- 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);