Re-enable normal netlib stream handling. Caching and chunking should

work now.


git-svn-id: svn://10.0.0.236/trunk@5438 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scullin
1998-07-13 23:43:13 +00:00
parent 350aab065b
commit 20cdc31eeb
7 changed files with 38 additions and 31 deletions

View File

@@ -27,6 +27,7 @@ CPPSRCS = \
nsHttpUrl.cpp \
nsStubContext.cpp \
nsNetStubs.cpp \
nsNetIDs.cpp \
$(NULL)
REQUIRES = raptor js dbm nspr security pref xpcom util img \

View File

@@ -62,6 +62,7 @@ OBJS= \
.\$(OBJDIR)\nsHttpUrl.obj \
.\$(OBJDIR)\nsStubContext.obj \
.\$(OBJDIR)\nsNetStubs.obj \
.\$(OBJDIR)\nsNetIDs.obj \
$(NULL)
#//------------------------------------------------------------------------

View File

@@ -0,0 +1,2 @@
#define NS_IMPL_IDS
#include "nsIPref.h"

View File

@@ -16,10 +16,18 @@
* Reserved.
*/
#include "nsRepository.h"
#include "nsNetService.h"
#include "nsNetStream.h"
#include "net.h"
extern "C" {
#include "mkutils.h"
#include "mkgeturl.h"
#include "mktrace.h"
#include "mkstream.h"
#include "cvchunk.h"
};
#include "netcache.h"
#include "plstr.h"
#include "nsString.h"
@@ -54,6 +62,12 @@ extern const char *XP_AppName;
extern const char *XP_AppLanguage;
extern const char *XP_AppPlatform;
#endif
PUBLIC NET_StreamClass *
NET_NGLayoutConverter(FO_Present_Types format_out,
void *converter_obj,
URL_Struct *URL_s,
MWContext *context);
};
/*
@@ -86,6 +100,17 @@ nsNetlibService::nsNetlibService(nsINetContainerApplication *aContainerApp)
/* Initialize the file extension -> content-type mappings */
NET_InitFileFormatTypes(nsnull, nsnull);
NET_FinishInitNetLib();
NET_RegisterContentTypeConverter("*", FO_CACHE_AND_NGLAYOUT, NULL,
NET_CacheConverter);
NET_RegisterContentTypeConverter("*", FO_NGLAYOUT, NULL,
NET_NGLayoutConverter);
NET_RegisterUniversalEncodingConverter("chunked",
NULL,
NET_ChunkedDecoderStream);
mContainer = aContainerApp;
NS_IF_ADDREF(mContainer);
if (NULL != mContainer) {
@@ -199,7 +224,7 @@ nsresult nsNetlibService::OpenStream(nsIURL *aUrl,
/* Start the URL load... */
NET_GetURL (URL_s, /* URL_Struct */
FO_CACHE_AND_PRESENT, /* FO_Present_type */
FO_CACHE_AND_NGLAYOUT, /* FO_Present_type */
(MWContext *)m_stubContext, /* MWContext */
bam_exit_routine); /* Exit routine... */
@@ -284,7 +309,7 @@ nsresult nsNetlibService::OpenBlockingStream(nsIURL *aUrl,
/* Start the URL load... */
NET_GetURL (URL_s, /* URL_Struct */
FO_CACHE_AND_PRESENT, /* FO_Present_type */
FO_CACHE_AND_NGLAYOUT, /* FO_Present_type */
(MWContext *)m_stubContext, /* MWContext */
bam_exit_routine); /* Exit routine... */

View File

@@ -20,6 +20,7 @@
#define net_serv_h___
#include "nspr.h"
#include "nsIPref.h"
#include "nsINetService.h"
class nsINetContainerApplication;
@@ -47,6 +48,7 @@ private:
/* XXX: This is temporary until bamwrap.cpp is removed... */
void *m_stubContext;
nsINetContainerApplication *mContainer;
nsIPref *mPref;
};

View File

@@ -42,7 +42,7 @@ extern "C" {
extern "C" {
#if defined(XP_PC) || defined(XP_UNIX)
#if defined(XP_UNIX) || defined(XP_WIN)
DB *
dbopen(const char *fname, int flags,int mode, DBTYPE type,
const void *openinfo)
@@ -1308,31 +1308,6 @@ LO_getNextTabableElement( MWContext *context, LO_TabFocusData *pCurrentFocus, in
return FALSE;
}
/*
* Random libnet functions...
*/
NET_StreamClass *
NET_NewStream (char *name,
MKStreamWriteFunc process,
MKStreamCompleteFunc complete,
MKStreamAbortFunc abort,
MKStreamWriteReadyFunc ready,
void *streamData,
MWContext *windowID)
{
return NULL;
}
#ifdef DEBUG
MODULE_PRIVATE void
NET_DisplayStreamInfoAsHTML(ActiveEntry *cur_entry)
{
MOZ_FUNCTION_STUB;
}
#endif /* DEBUG */
PUBLIC int
NET_ParseNetHelpURL(URL_Struct *URL_s)
{

View File

@@ -417,9 +417,10 @@ extern "C" {
*Find a converter routine to create a stream and return the stream struct
*/
PUBLIC NET_StreamClass *
NET_StreamBuilder (FO_Present_Types format_out,
URL_Struct *URL_s,
MWContext *context)
NET_NGLayoutConverter(FO_Present_Types format_out,
void *converter_obj,
URL_Struct *URL_s,
MWContext *context)
{
NET_StreamClass *stream = NULL;
PRBool bSuccess = PR_TRUE;