Moved the HTTP handler to its own dll. Registration/Auto detection thru

XPCOM now.
This commit is contained in:
gagan%netscape.com 1999-03-27 01:59:13 +00:00
Родитель a8dd8e8500
Коммит b124b8f5c0
6 изменённых файлов: 17 добавлений и 27 удалений

Просмотреть файл

@ -27,13 +27,9 @@ PDBFILE=nunet.pdb
MAPFILE=nunet.map
DEFFILE=nunet.def
#// Currently the HTTP handler is being built together with core.
#// It needs to move to its own dir, once the kinks of dynamic
#// registration are resolved.
OBJS= \
.\$(OBJDIR)\nsURL.obj \
.\$(OBJDIR)\nsHTTPHandler.obj \
.\$(OBJDIR)\nsHTTPInstance.obj \
.\$(OBJDIR)\nsNetManager.obj \
.\$(OBJDIR)\nsURL.obj \
$(NULL)
DLL=.\$(OBJDIR)\$(DLLNAME)
@ -63,4 +59,3 @@ include <$(DEPTH)/config/rules.mak>
libs:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME) $(DIST)\bin
$(MAKE_INSTALL) .\$(OBJDIR)\nunet.lib $(DIST)\lib

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -27,7 +27,7 @@
#include <stdlib.h>
#include "plstr.h"
#include "nsIProtocolHandler.h"
#include "nsIHTTPHandler.h" // This will go away with DPs work.
#include "nsIComponentManager.h"
static const PRInt32 DEFAULT_PORT = -1;
@ -152,31 +152,26 @@ nsresult nsURL::OpenProtocolInstance(nsIProtocolInstance* *o_ProtocolInstance)
const char* scheme =0;
GetScheme(&scheme);
// If the expected behaviour is to have http as the default scheme, a
// caller must check that before calling this function.
// caller must check that before calling this function. We will not
// make any assumptions here.
if (0 == scheme)
return NS_ERROR_BAD_URL;
// Here we should check with the repository for a
// protocol handler that can handle this scheme.
// Then assuming this is class returned
nsISupports* iFoo= 0;
nsIProtocolHandler *pHandler=0;
nsresult rv = nsComponentManager::CreateInstance(
NS_COMPONENT_NETSCAPE_NETWORK_PROTOCOLS "http", // TODO replace!
nsnull,
nsIProtocolHandler::GetIID(),
(void**)&pHandler);
#if 0 //Turned on with DPs code to check from Repository as above.
if (iFoo)
{
nsIProtocolHandler *pHandler=0;
if (NS_OK == iFoo->QueryInterface(nsIProtocolHandler::GetIID(), (void**)&pHandler)))
{
return pHandler->GetProtocolInstance(this, o_ProtocolInstance);
}
}
else
return NS_ERROR_NO_PROTOCOL_FOUND; // ??? This the right error or check with repository for error?
#else // For now hardcode it...
return pHandler ? pHandler->GetProtocolInstance(this, o_ProtocolInstance) : rv;
#if 0 // For now hardcode it...
if (0==PL_strcasecmp(scheme, "http"))
{
nsIHTTPHandler* pHandler= 0;
if (NS_OK == CreateOrGetHTTPHandler(&pHandler))
// TODO This has to change to Factory interface
//if (NS_OK == CreateOrGetHTTPHandler(&pHandler))
{
if (pHandler)
{
@ -184,9 +179,9 @@ nsresult nsURL::OpenProtocolInstance(nsIProtocolInstance* *o_ProtocolInstance)
}
}
}
return NS_ERROR_NOT_IMPLEMENTED;
#endif
return NS_ERROR_NOT_IMPLEMENTED;
}
// This code will need thorough testing. A lot of this has to do with