PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Socket set up\n", (void*)sslSock)); infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info));
nsSSLIOLayerAddToSocket(const char* host,                        PRInt32 port,                        const char* proxyHost,                        PRInt32 proxyPort,                        PRFileDesc* fd,                        nsISupports** info,                        PRBool useTLS){  if (firstTime) {    nsresult rv = InitNSSMethods();    if (NS_FAILED(rv)) return rv;    firstTime = PR_FALSE;  }  PRFileDesc* sslSock = SSL_ImportFD(NULL, fd);  if (!sslSock) {    NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");    return NS_ERROR_FAILURE;  }  SSL_SetPKCS11PinArg(sslSock, NULL);    PRInt32 ret = SSL_SetURL(sslSock, host);  if (ret == -1) {    NS_ASSERTION(PR_FALSE, "NSS: Error setting server name");    return NS_ERROR_FAILURE;  }    nsNSSSocketInfo* infoObject = new nsNSSSocketInfo();  if (!infoObject) return NS_ERROR_FAILURE;    NS_ADDREF(infoObject);    infoObject->SetHostName(host);  infoObject->SetHostPort(port);  infoObject->SetProxyName(proxyHost);  infoObject->SetProxyPort(proxyPort);  infoObject->SetUseTLS(useTLS);  /* Now, layer ourselves on top of the SSL socket... */  PRFileDesc* layer = PR_CreateIOLayerStub(nsSSLIOLayerIdentity,                                           &nsSSLIOLayerMethods);  if (!layer)    return NS_ERROR_FAILURE;    layer->secret = (PRFilePrivate*) infoObject;  nsresult rv = PR_PushIOLayer(sslSock, PR_GetLayersIdentity(sslSock), layer);    if (NS_FAILED(rv)) {    NS_RELEASE(infoObject);    PR_DELETE(layer);    return NS_ERROR_FAILURE;  }#ifdef DEBUG_SSL  printf("NSS: [%p] Socket set up\n", (void*)sslSock);#endif    *info = infoObject;  NS_ADDREF(*info);    return NS_OK;}