diff --git a/mozilla/network/module/nsNetService.cpp b/mozilla/network/module/nsNetService.cpp index 857731cfd51..e7813f16e64 100644 --- a/mozilla/network/module/nsNetService.cpp +++ b/mozilla/network/module/nsNetService.cpp @@ -48,6 +48,7 @@ extern "C" { #include "nsIEventQueueService.h" #include "nsXPComCIID.h" #include "nsCRT.h" +#include "nsSocketTransport.h" #ifdef XP_PC #include @@ -1034,7 +1035,21 @@ nsNetlibService::CreateURL(nsIURL* *aURL, return protocolURLFactory->CreateURL(aURL, aSpec, aContextURL, aContainer, aGroup); } +NS_IMETHODIMP nsNetlibService::CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName) +{ + nsSocketTransport *pNSSocketTransport = NULL; + NS_DEFINE_IID(kITransportIID, NS_ITRANSPORT_IID); + + pNSSocketTransport = new nsSocketTransport(aPortToUse, aHostName); + if (pNSSocketTransport->QueryInterface(kITransportIID, (void**)aTransport) != NS_OK) { + // then we're trying get a interface other than nsISupports and + // nsITransport + return NS_ERROR_FAILURE; + } + + return NS_OK; +} NS_IMETHODIMP diff --git a/mozilla/network/module/nsNetService.h b/mozilla/network/module/nsNetService.h index 568268b39a7..b877f0af396 100644 --- a/mozilla/network/module/nsNetService.h +++ b/mozilla/network/module/nsNetService.h @@ -22,6 +22,7 @@ #include "nspr.h" #include "nsIPref.h" +#include "nsITransport.h" #include "nsIEventQueueService.h" #include "nsINetService.h" #include "nsNetThread.h" @@ -97,6 +98,8 @@ public: nsIURLGroup* aGroup = nsnull); NS_IMETHOD AreThereActiveConnections(void); + NS_IMETHOD CreateSocketTransport(nsITransport **aTransport, PRUint32 aPortToUse, const char * aHostName); + protected: virtual ~nsNetlibService();