Moving client stuff into client.
git-svn-id: svn://10.0.0.236/branches/scullin_BRANCH@3572 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8bba0a259f
commit
0cd7b6fe38
@ -30,6 +30,6 @@ endif
|
||||
EXPORTS= cnetinit.h
|
||||
|
||||
REQUIRES = netcache network img layer fileurl httpurl ftpurl abouturl \
|
||||
gophurl jsurl remoturl dataurl util
|
||||
gophurl jsurl remoturl dataurl util java jtools
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
@ -1,10 +1,29 @@
|
||||
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "xp.h"
|
||||
#include "mkutils.h"
|
||||
#include "netutils.h"
|
||||
#include "mkselect.h"
|
||||
#include "mktcp.h"
|
||||
#include "mkgeturl.h"
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "fileurl.h"
|
||||
#include "httpurl.h"
|
||||
@ -17,26 +36,258 @@
|
||||
#include "dataurl.h"
|
||||
#include "netcache.h"
|
||||
|
||||
#if defined(JAVA) && defined(XP_MAC)
|
||||
#if defined(JAVA)
|
||||
#include "marimurl.h"
|
||||
#endif
|
||||
|
||||
/* For random protocols */
|
||||
#include "htmldlgs.h"
|
||||
#include "libevent.h"
|
||||
#include "libi18n.h"
|
||||
#include "secnav.h"
|
||||
extern int MK_MALFORMED_URL_ERROR;
|
||||
|
||||
/* For about handlers */
|
||||
#include "il_strm.h"
|
||||
#include "glhist.h"
|
||||
|
||||
PRIVATE void net_InitTotallyRandomStuffPeopleAddedProtocols(void);
|
||||
PRIVATE void net_InitAboutURLs();
|
||||
|
||||
PUBLIC void
|
||||
NET_ClientProtocolInitialize(void)
|
||||
{
|
||||
|
||||
NET_InitFileProtocol();
|
||||
NET_InitHTTPProtocol();
|
||||
NET_InitMemCacProtocol();
|
||||
NET_InitFTPProtocol();
|
||||
NET_InitAboutProtocol();
|
||||
NET_InitGopherProtocol();
|
||||
NET_InitMochaProtocol();
|
||||
NET_InitRemoteProtocol();
|
||||
NET_InitDataURLProtocol();
|
||||
NET_InitFileProtocol();
|
||||
NET_InitHTTPProtocol();
|
||||
NET_InitMemCacProtocol();
|
||||
NET_InitFTPProtocol();
|
||||
NET_InitAboutProtocol();
|
||||
NET_InitGopherProtocol();
|
||||
NET_InitMochaProtocol();
|
||||
NET_InitRemoteProtocol();
|
||||
NET_InitDataURLProtocol();
|
||||
|
||||
#ifdef JAVA
|
||||
NET_InitMarimbaProtocol();
|
||||
NET_InitMarimbaProtocol();
|
||||
#endif
|
||||
|
||||
net_InitTotallyRandomStuffPeopleAddedProtocols();
|
||||
|
||||
net_InitAboutURLs();
|
||||
}
|
||||
|
||||
/* print out security URL
|
||||
*/
|
||||
PRIVATE int net_output_security_url(ActiveEntry * cur_entry, MWContext *cx)
|
||||
{
|
||||
NET_StreamClass * stream;
|
||||
char * content_type;
|
||||
char * which = cur_entry->URL_s->address;
|
||||
char * colon = PL_strchr (which, ':');
|
||||
|
||||
if (colon)
|
||||
{
|
||||
/* found the first colon; now find the question mark
|
||||
(as in "about:security?certs"). */
|
||||
which = colon + 1;
|
||||
colon = PL_strchr (which, '?');
|
||||
if (colon)
|
||||
which = colon + 1;
|
||||
else
|
||||
which = which + PL_strlen (which); /* give it "" */
|
||||
}
|
||||
|
||||
content_type = SECNAV_SecURLContentType(which);
|
||||
if (!content_type) {
|
||||
cur_entry->status = MK_MALFORMED_URL_ERROR;
|
||||
|
||||
} else if (!PL_strcasecmp(content_type, "advisor")) {
|
||||
cur_entry->status = SECNAV_SecHandleSecurityAdvisorURL(cx, which);
|
||||
|
||||
} else {
|
||||
int status;
|
||||
|
||||
StrAllocCopy(cur_entry->URL_s->content_type, content_type);
|
||||
|
||||
cur_entry->format_out = CLEAR_CACHE_BIT(cur_entry->format_out);
|
||||
|
||||
stream = NET_StreamBuilder(cur_entry->format_out,
|
||||
cur_entry->URL_s, cur_entry->window_id);
|
||||
|
||||
if (!stream)
|
||||
return(MK_UNABLE_TO_CONVERT);
|
||||
|
||||
status = SECNAV_SecURLData(which, stream, cx);
|
||||
|
||||
if (status >= 0) {
|
||||
(*stream->complete) (stream);
|
||||
} else {
|
||||
(*stream->abort) (stream, status);
|
||||
}
|
||||
|
||||
cur_entry->status = status;
|
||||
|
||||
FREE(stream);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_SecurityURLLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
return net_output_security_url(ce, ce->window_id);
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_SeclibURLLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
SECNAV_HandleInternalSecURL(ce->URL_s, ce->window_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_HTMLPanelLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
XP_HandleHTMLPanel(ce->URL_s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_HTMLDialogLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
XP_HandleHTMLDialog(ce->URL_s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_WysiwygLoad(ActiveEntry *ce)
|
||||
{
|
||||
const char *real_url = LM_SkipWysiwygURLPrefix(ce->URL_s->address);
|
||||
char *new_address;
|
||||
|
||||
/* XXX can't use StrAllocCopy because it frees dest first */
|
||||
if (real_url && (new_address = PL_strdup(real_url)) != NULL)
|
||||
{
|
||||
PR_Free(ce->URL_s->address);
|
||||
ce->URL_s->address = new_address;
|
||||
FREE_AND_CLEAR(ce->URL_s->wysiwyg_url);
|
||||
}
|
||||
|
||||
/* no need to free real_url */
|
||||
|
||||
ce->status = MK_DO_REDIRECT;
|
||||
return MK_DO_REDIRECT;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_ProtoMainStub(ActiveEntry *ce)
|
||||
{
|
||||
#ifdef DO_ANNOYING_ASSERTS_IN_STUBS
|
||||
PR_ASSERT(0);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
net_ProtoCleanupStub(void)
|
||||
{
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
net_reg_random_protocol(NET_ProtoInitFunc *LoadRoutine, int type)
|
||||
{
|
||||
NET_ProtoImpl *random_proto_impl;
|
||||
|
||||
random_proto_impl = PR_NEW(NET_ProtoImpl);
|
||||
|
||||
if(!random_proto_impl)
|
||||
return;
|
||||
|
||||
random_proto_impl->init = LoadRoutine;
|
||||
random_proto_impl->process = net_ProtoMainStub;
|
||||
random_proto_impl->interrupt = net_ProtoMainStub;
|
||||
random_proto_impl->cleanup = net_ProtoCleanupStub;
|
||||
|
||||
NET_RegisterProtocolImplementation(random_proto_impl, type);
|
||||
}
|
||||
|
||||
/* don't you just hate it when people come along and hack this
|
||||
* kind of stuff into your code.
|
||||
*
|
||||
* @@@ clean this up some time
|
||||
*/
|
||||
PRIVATE void
|
||||
net_InitTotallyRandomStuffPeopleAddedProtocols(void)
|
||||
{
|
||||
net_reg_random_protocol(net_SecurityURLLoad, SECURITY_TYPE_URL);
|
||||
net_reg_random_protocol(net_SeclibURLLoad, INTERNAL_SECLIB_TYPE_URL);
|
||||
net_reg_random_protocol(net_HTMLPanelLoad, HTML_PANEL_HANDLER_TYPE_URL);
|
||||
net_reg_random_protocol(net_HTMLDialogLoad, HTML_DIALOG_HANDLER_TYPE_URL);
|
||||
net_reg_random_protocol(net_WysiwygLoad, WYSIWYG_TYPE_URL);
|
||||
}
|
||||
|
||||
#ifdef XP_UNIX
|
||||
extern void FE_ShowMinibuffer(MWContext *);
|
||||
|
||||
PRBool net_AboutMinibuffer(const char *token,
|
||||
FO_Present_Types format_out,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id)
|
||||
{
|
||||
FE_ShowMinibuffer(window_id);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WEBFONTS
|
||||
PRBool net_AboutFonts(const char *token,
|
||||
FO_Present_Types format_out,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id)
|
||||
{
|
||||
NF_AboutFonts(window_id, which);
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif /* WEBFONTS */
|
||||
|
||||
PRBool net_AboutImageCache(const char *token,
|
||||
FO_Present_Types format_out,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id)
|
||||
{
|
||||
IL_DisplayMemCacheInfoAsHTML(format_out, URL_s, window_id);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool net_AboutGlobalHistory(const char *token,
|
||||
FO_Present_Types format_out,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id)
|
||||
{
|
||||
NET_DisplayGlobalHistoryInfoAsHTML(window_id, URL_s, format_out);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRIVATE void net_InitAboutURLs()
|
||||
{
|
||||
NET_RegisterAboutProtocol("image-cache*", net_AboutImageCache);
|
||||
NET_RegisterAboutProtocol("global", net_AboutGlobalHistory);
|
||||
#ifdef XP_UNIX
|
||||
NET_RegisterAboutProtocol("minibuffer", net_AboutMinibuffer);
|
||||
#endif
|
||||
#ifdef WEBFONTS
|
||||
NET_RegisterAboutProtocol("fonts*", net_AboutFonts);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -65,18 +65,23 @@ REQUIRES= network
|
||||
# use LINCS on win32 for now since REQUIRES seems to be broken
|
||||
#!if "$(MOZ_BITS)" != "16"
|
||||
LINCS= \
|
||||
-I$(XPDIST)\public\network \
|
||||
-I$(XPDIST)\public\netcache \
|
||||
-I$(XPDIST)\public\abouturl \
|
||||
-I$(XPDIST)\public\dataurl \
|
||||
-I$(XPDIST)\public\fileurl \
|
||||
-I$(XPDIST)\public\ftpurl \
|
||||
-I$(XPDIST)\public\gophurl \
|
||||
-I$(XPDIST)\public\httpurl \
|
||||
-I$(XPDIST)\public\jsurl \
|
||||
-I$(XPDIST)\public\certurl \
|
||||
-I$(XPDIST)\public\remoturl \
|
||||
-I$(XPDIST)\public\marimurl
|
||||
-I$(PUBLIC)\java \
|
||||
-I$(PUBLIC)\jtools \
|
||||
-I$(PUBLIC)\js \
|
||||
-I$(PUBLIC)\htmldlgs \
|
||||
-I$(PUBLIC)\security \
|
||||
-I$(PUBLIC)\network \
|
||||
-I$(PUBLIC)\netcache \
|
||||
-I$(PUBLIC)\abouturl \
|
||||
-I$(PUBLIC)\dataurl \
|
||||
-I$(PUBLIC)\fileurl \
|
||||
-I$(PUBLIC)\ftpurl \
|
||||
-I$(PUBLIC)\gophurl \
|
||||
-I$(PUBLIC)\httpurl \
|
||||
-I$(PUBLIC)\jsurl \
|
||||
-I$(PUBLIC)\certurl \
|
||||
-I$(PUBLIC)\remoturl \
|
||||
-I$(PUBLIC)\marimurl
|
||||
#!endif
|
||||
|
||||
!endif
|
||||
|
||||
Binary file not shown.
@ -128,7 +128,6 @@ LINCS=-I$(PUBLIC)\jtools \
|
||||
-I$(PUBLIC)\lay \
|
||||
-I$(PUBLIC)\style \
|
||||
-I$(PUBLIC)\pref \
|
||||
-I$(PUBLIC)\htmldlgs \
|
||||
-I$(PUBLIC)\java \
|
||||
-I$(PUBLIC)\libfont \
|
||||
-I$(PUBLIC)\netcache \
|
||||
|
||||
@ -84,9 +84,6 @@
|
||||
#endif
|
||||
|
||||
#include "libi18n.h"
|
||||
#ifndef MODULAR_NETLIB
|
||||
#include "htmldlgs.h"
|
||||
#endif
|
||||
|
||||
#include "np.h"
|
||||
#include "prefapi.h"
|
||||
@ -319,8 +316,6 @@ PRIVATE NETExitCallbackNode *NETExitCallbackHead = NULL;
|
||||
|
||||
/* forward decl */
|
||||
PRIVATE void net_cleanup_reg_protocol_impls(void);
|
||||
PRIVATE void NET_InitTotallyRandomStuffPeopleAddedProtocols(void);
|
||||
|
||||
|
||||
|
||||
/* fix Mac warning for missing prototype */
|
||||
@ -738,8 +733,6 @@ NET_InitNetLib(int socket_buffer_size, int max_number_of_connections)
|
||||
NET_InitNFSProtocol();
|
||||
NET_InitURNProtocol();
|
||||
NET_InitWAISProtocol();
|
||||
NET_InitTotallyRandomStuffPeopleAddedProtocols();
|
||||
|
||||
NET_InitMailtoProtocol(); /* has a stub for MOZ_MAIL_NEWS */
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
NET_InitNewsProtocol();
|
||||
@ -4282,164 +4275,6 @@ PRIVATE void add_slash_to_URL (URL_Struct *URL_s)
|
||||
}
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
/* print out security URL
|
||||
*/
|
||||
PRIVATE int net_output_security_url(ActiveEntry * cur_entry, MWContext *cx)
|
||||
{
|
||||
NET_StreamClass * stream;
|
||||
char * content_type;
|
||||
char * which = cur_entry->URL_s->address;
|
||||
char * colon = PL_strchr (which, ':');
|
||||
|
||||
if (colon)
|
||||
{
|
||||
/* found the first colon; now find the question mark
|
||||
(as in "about:security?certs"). */
|
||||
which = colon + 1;
|
||||
colon = PL_strchr (which, '?');
|
||||
if (colon)
|
||||
which = colon + 1;
|
||||
else
|
||||
which = which + PL_strlen (which); /* give it "" */
|
||||
}
|
||||
|
||||
content_type = SECNAV_SecURLContentType(which);
|
||||
if (!content_type) {
|
||||
cur_entry->status = MK_MALFORMED_URL_ERROR;
|
||||
|
||||
} else if (!PL_strcasecmp(content_type, "advisor")) {
|
||||
cur_entry->status = SECNAV_SecHandleSecurityAdvisorURL(cx, which);
|
||||
|
||||
} else {
|
||||
int status;
|
||||
|
||||
StrAllocCopy(cur_entry->URL_s->content_type, content_type);
|
||||
|
||||
cur_entry->format_out = CLEAR_CACHE_BIT(cur_entry->format_out);
|
||||
|
||||
stream = NET_StreamBuilder(cur_entry->format_out,
|
||||
cur_entry->URL_s, cur_entry->window_id);
|
||||
|
||||
if (!stream)
|
||||
return(MK_UNABLE_TO_CONVERT);
|
||||
|
||||
status = SECNAV_SecURLData(which, stream, cx);
|
||||
|
||||
if (status >= 0) {
|
||||
(*stream->complete) (stream);
|
||||
} else {
|
||||
(*stream->abort) (stream, status);
|
||||
}
|
||||
|
||||
cur_entry->status = status;
|
||||
|
||||
FREE(stream);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_SecurityURLLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
return net_output_security_url(ce, ce->window_id);
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_SeclibURLLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
SECNAV_HandleInternalSecURL(ce->URL_s, ce->window_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_HTMLPanelLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
XP_HandleHTMLPanel(ce->URL_s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_HTMLDialogLoad(ActiveEntry *ce)
|
||||
{
|
||||
if(ce->URL_s)
|
||||
StrAllocCopy(ce->URL_s->charset, INTL_ResourceCharSet());
|
||||
XP_HandleHTMLDialog(ce->URL_s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_WysiwygLoad(ActiveEntry *ce)
|
||||
{
|
||||
const char *real_url = LM_SkipWysiwygURLPrefix(ce->URL_s->address);
|
||||
char *new_address;
|
||||
|
||||
/* XXX can't use StrAllocCopy because it frees dest first */
|
||||
if (real_url && (new_address = PL_strdup(real_url)) != NULL)
|
||||
{
|
||||
PR_Free(ce->URL_s->address);
|
||||
ce->URL_s->address = new_address;
|
||||
FREE_AND_CLEAR(ce->URL_s->wysiwyg_url);
|
||||
}
|
||||
|
||||
/* no need to free real_url */
|
||||
|
||||
ce->status = MK_DO_REDIRECT;
|
||||
return MK_DO_REDIRECT;
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_ProtoMainStub(ActiveEntry *ce)
|
||||
{
|
||||
#ifdef DO_ANNOYING_ASSERTS_IN_STUBS
|
||||
PR_ASSERT(0);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
net_ProtoCleanupStub(void)
|
||||
{
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
net_reg_random_protocol(NET_ProtoInitFunc *LoadRoutine, int type)
|
||||
{
|
||||
NET_ProtoImpl *random_proto_impl;
|
||||
|
||||
random_proto_impl = PR_NEW(NET_ProtoImpl);
|
||||
|
||||
if(!random_proto_impl)
|
||||
return;
|
||||
|
||||
random_proto_impl->init = LoadRoutine;
|
||||
random_proto_impl->process = net_ProtoMainStub;
|
||||
random_proto_impl->interrupt = net_ProtoMainStub;
|
||||
random_proto_impl->cleanup = net_ProtoCleanupStub;
|
||||
|
||||
NET_RegisterProtocolImplementation(random_proto_impl, type);
|
||||
}
|
||||
|
||||
/* don't you just hate it when people come along and hack this
|
||||
* kind of stuff into your code.
|
||||
*
|
||||
* @@@ clean this up some time
|
||||
*/
|
||||
PRIVATE void
|
||||
NET_InitTotallyRandomStuffPeopleAddedProtocols(void)
|
||||
{
|
||||
net_reg_random_protocol(net_SecurityURLLoad, SECURITY_TYPE_URL);
|
||||
net_reg_random_protocol(net_SeclibURLLoad, INTERNAL_SECLIB_TYPE_URL);
|
||||
net_reg_random_protocol(net_HTMLPanelLoad, HTML_PANEL_HANDLER_TYPE_URL);
|
||||
net_reg_random_protocol(net_HTMLDialogLoad, HTML_DIALOG_HANDLER_TYPE_URL);
|
||||
net_reg_random_protocol(net_WysiwygLoad, WYSIWYG_TYPE_URL);
|
||||
}
|
||||
|
||||
#endif /* MOZILLA_CLIENT */
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#include "nsNetStubs.h"
|
||||
|
||||
#include "nspr.h"
|
||||
#include "xp_hash.h"
|
||||
#include "xp_file.h"
|
||||
#include "libi18n.h"
|
||||
#include "libevent.h"
|
||||
@ -27,7 +26,6 @@
|
||||
#include "net.h"
|
||||
|
||||
extern "C" {
|
||||
#include "secnav.h"
|
||||
#include "preenc.h"
|
||||
};
|
||||
|
||||
@ -262,29 +260,6 @@ PUBLIC void INTL_CCCReportMetaCharsetTag(MWContext *context, char *charset_tag)
|
||||
MOZ_FUNCTION_STUB;
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/cmd/winfe/authdll.cpp
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
char * WFE_BuildCompuserveAuthString(URL_Struct *URL_s)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WFE_DoCompuserveAuthenticate(MWContext *context,
|
||||
URL_Struct *URL_s,
|
||||
char *authenticate_header_value)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
return NET_AUTH_FAILED_DONT_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/cmd/winfe/regproto.cpp
|
||||
@ -521,19 +496,6 @@ IL_Type(const char *buf, int32 len)
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create an HTML stream and generate HTML describing
|
||||
* the image cache. Use "about:memory-cache" URL to acess.
|
||||
*/
|
||||
int
|
||||
IL_DisplayMemCacheInfoAsHTML(FO_Present_Types format_out, URL_Struct *urls,
|
||||
OPAQUE_CONTEXT *cx)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
IL_HTMLImageInfo(char *url_address)
|
||||
{
|
||||
@ -597,22 +559,6 @@ GH_SaveGlobalHistory(void)
|
||||
MOZ_FUNCTION_STUB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* create an HTML stream and push a bunch of HTML about
|
||||
* the global history
|
||||
*/
|
||||
MODULE_PRIVATE int
|
||||
NET_DisplayGlobalHistoryInfoAsHTML(MWContext *context,
|
||||
URL_Struct *URL_s,
|
||||
int format_out)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
return MK_UNABLE_TO_CONVERT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/lib/libmisc/shist.c
|
||||
@ -653,35 +599,6 @@ LM_SkipWysiwygURLPrefix(const char *url_string)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/lib/htmldlgs/htmldlgs.c
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
XP_HandleHTMLPanel(URL_Struct *url)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
XP_HandleHTMLDialog(URL_Struct *url)
|
||||
{
|
||||
MOZ_FUNCTION_STUB;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/nav-java/netscape/net/netStubs.c
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* From ns/modules/softupdt/src/softupdt.c
|
||||
|
||||
@ -1,8 +1,47 @@
|
||||
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef ABOUTURL_H
|
||||
#define ABOUTURL_H
|
||||
|
||||
PUBLIC void NET_InitAboutProtocol(void);
|
||||
|
||||
/*
|
||||
* About protocol registration stuff
|
||||
*/
|
||||
|
||||
/* Callback for registered about protocols.
|
||||
* Should return PR_TRUE if the token was handled */
|
||||
typedef PRBool (*NET_AboutCB)(const char *token,
|
||||
FO_Present_Types format_out,
|
||||
URL_Struct *URL_s,
|
||||
MWContext *window_id);
|
||||
|
||||
/* Wildcard token for FE about protocol handling
|
||||
* Otherwise unhandled tokens will match on this */
|
||||
#define FE_ABOUT_TOKEN ("FEABOUT")
|
||||
|
||||
/* About protocol registration function.
|
||||
* Returns PR_TRUE if registration succeeds.
|
||||
* Registration will fail if token or callback is null,
|
||||
* or token has already been registered */
|
||||
PUBLIC PRBool NET_RegisterAboutProtocol(const char *token,
|
||||
NET_AboutCB callback);
|
||||
|
||||
|
||||
#endif /* ABOUTURL_H */
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "xp.h"
|
||||
#include "net.h"
|
||||
#include "netutils.h"
|
||||
@ -9,7 +27,7 @@
|
||||
#include "xplocale.h"
|
||||
#include "prefapi.h"
|
||||
#include "secnav.h"
|
||||
#ifndef MODULAR_NETLIB
|
||||
#ifndef STANDALONE_IMAGE_LIB
|
||||
#include "libimg.h"
|
||||
#endif
|
||||
#include "il_strm.h"
|
||||
@ -20,6 +38,7 @@
|
||||
#include "shist.h"
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
#include "plhash.h"
|
||||
|
||||
#include "abouturl.h"
|
||||
|
||||
@ -52,6 +71,27 @@ extern int XP_DOCUMENT_INFO ;
|
||||
extern int XP_THE_WINDOW_IS_NOW_INACTIVE ;
|
||||
extern int MK_MALFORMED_URL_ERROR;
|
||||
|
||||
static PRHashTable *net_AboutTable = NULL;
|
||||
|
||||
PRIVATE PRIntn net_AboutComparator(const void *v1, const void *v2)
|
||||
{
|
||||
char *idx = NULL;
|
||||
if (idx = PL_strchr((char *) v2, '*')) {
|
||||
int len = (int)(idx - v2);
|
||||
return PL_strncasecmp((char *) v1, (char *) v2, len) == 0;
|
||||
} else {
|
||||
return PL_strcasecmp((char *) v1, (char *) v2) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE PRBool net_DoRegisteredAbout(const char *which, ActiveEntry *entry)
|
||||
{
|
||||
NET_AboutCB cb;
|
||||
if (cb = (NET_AboutCB) PL_HashTableLookup(net_AboutTable, which)) {
|
||||
return cb(which, entry->format_out, entry->URL_s, entry->window_id);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRIVATE void
|
||||
net_OutputURLDocInfo(MWContext *ctxt, char *which, char **data, int32 *length)
|
||||
@ -379,17 +419,11 @@ PRIVATE int net_output_about_url(ActiveEntry * cur_entry)
|
||||
NET_RemoveAllAuthorizations();
|
||||
return(-1);
|
||||
}
|
||||
else if(!PL_strcasecmp(which, "image-cache"))
|
||||
{
|
||||
IL_DisplayMemCacheInfoAsHTML(cur_entry->format_out, cur_entry->URL_s,
|
||||
cur_entry->window_id);
|
||||
return(-1);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else if(!PL_strcasecmp(which, "streams"))
|
||||
{
|
||||
NET_DisplayStreamInfoAsHTML(cur_entry);
|
||||
return(-1);
|
||||
NET_DisplayStreamInfoAsHTML(cur_entry);
|
||||
return(-1);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
else if(!PL_strcasecmp(which, "document"))
|
||||
@ -447,18 +481,7 @@ PRIVATE int net_output_about_url(ActiveEntry * cur_entry)
|
||||
if(cur_entry->URL_s->window_chrome)
|
||||
{
|
||||
memset(cur_entry->URL_s->window_chrome, 0, sizeof(Chrome));
|
||||
/* it should be MWContextDialog
|
||||
* but X isn't ready for it yet...
|
||||
*/
|
||||
/* X is ready for MWContextDialog now...
|
||||
*#ifdef XP_UNIX
|
||||
* cur_entry->URL_s->window_chrome->type = MWContextBrowser;
|
||||
*#else
|
||||
*/
|
||||
cur_entry->URL_s->window_chrome->type = MWContextDialog;
|
||||
/*
|
||||
*#endif
|
||||
*/
|
||||
cur_entry->URL_s->window_chrome->show_scrollbar = TRUE;
|
||||
cur_entry->URL_s->window_chrome->allow_resize = TRUE;
|
||||
cur_entry->URL_s->window_chrome->allow_close = TRUE;
|
||||
@ -497,16 +520,6 @@ PRIVATE int net_output_about_url(ActiveEntry * cur_entry)
|
||||
length = PL_strlen(data);
|
||||
StrAllocCopy(content_type, TEXT_HTML);
|
||||
}
|
||||
else if(!PL_strncasecmp(which, "Global", 6))
|
||||
{
|
||||
cur_entry->status = NET_DisplayGlobalHistoryInfoAsHTML(
|
||||
cur_entry->window_id,
|
||||
cur_entry->URL_s,
|
||||
cur_entry->format_out);
|
||||
|
||||
return(-1);
|
||||
|
||||
}
|
||||
else if(!PL_strncmp(which, "FeCoNtExT=", 10))
|
||||
{
|
||||
MWContext *old_ctxt;
|
||||
@ -557,23 +570,11 @@ PRIVATE int net_output_about_url(ActiveEntry * cur_entry)
|
||||
content_type = PL_strdup(TEXT_HTML);
|
||||
}
|
||||
}
|
||||
#if defined(XP_UNIX) && !defined(MODULAR_NETLIB)
|
||||
else if (!PL_strncasecmp(which, "minibuffer", 10))
|
||||
{
|
||||
extern void FE_ShowMinibuffer(MWContext *);
|
||||
|
||||
FE_ShowMinibuffer(cur_entry->window_id);
|
||||
}
|
||||
#endif
|
||||
#ifdef WEBFONTS
|
||||
else if (!PL_strncasecmp(which, "fonts", 5))
|
||||
{
|
||||
NF_AboutFonts(cur_entry->window_id, which);
|
||||
return (-1);
|
||||
}
|
||||
#endif /* WEBFONTS */
|
||||
else
|
||||
{
|
||||
if (net_DoRegisteredAbout(which, cur_entry)) {
|
||||
return -1;
|
||||
}
|
||||
fe_data = FE_AboutData(which, &data, &length, &content_type);
|
||||
uses_fe_data=TRUE;
|
||||
}
|
||||
@ -806,6 +807,18 @@ PRIVATE Bool net_about_kludge(URL_Struct *URL_s)
|
||||
}
|
||||
}
|
||||
|
||||
PRBool NET_RegisterAboutProtocol(const char *token,
|
||||
NET_AboutCB callback)
|
||||
{
|
||||
if (!token || !callback) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (PL_HashTableLookup(net_AboutTable, token) != NULL) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
PL_HashTableAdd(net_AboutTable, token, callback);
|
||||
}
|
||||
|
||||
PRIVATE int32
|
||||
net_AboutLoad(ActiveEntry *ce)
|
||||
{
|
||||
@ -830,17 +843,24 @@ net_AboutStub(ActiveEntry *ce)
|
||||
PRIVATE void
|
||||
net_CleanupAbout(void)
|
||||
{
|
||||
PL_HashTableDestroy(net_AboutTable);
|
||||
}
|
||||
|
||||
PUBLIC void
|
||||
NET_InitAboutProtocol(void)
|
||||
{
|
||||
static NET_ProtoImpl about_proto_impl;
|
||||
static NET_ProtoImpl about_proto_impl;
|
||||
|
||||
about_proto_impl.init = net_AboutLoad;
|
||||
about_proto_impl.process = net_AboutStub;
|
||||
about_proto_impl.interrupt = net_AboutStub;
|
||||
about_proto_impl.cleanup = net_CleanupAbout;
|
||||
about_proto_impl.init = net_AboutLoad;
|
||||
about_proto_impl.process = net_AboutStub;
|
||||
about_proto_impl.interrupt = net_AboutStub;
|
||||
about_proto_impl.cleanup = net_CleanupAbout;
|
||||
|
||||
NET_RegisterProtocolImplementation(&about_proto_impl, ABOUT_TYPE_URL);
|
||||
NET_RegisterProtocolImplementation(&about_proto_impl, ABOUT_TYPE_URL);
|
||||
|
||||
net_AboutTable = PL_NewHashTable(32,
|
||||
PL_HashString,
|
||||
net_AboutComparator,
|
||||
PL_CompareValues,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
@ -230,7 +230,8 @@ NET_BuildAuthString(MWContext * context, URL_Struct *URL_s)
|
||||
net_AuthStruct * auth_s = net_CheckForAuthorization(address, FALSE);
|
||||
|
||||
if(!auth_s)
|
||||
#if defined(XP_WIN) && defined(MOZILLA_CLIENT)
|
||||
/* #if defined(XP_WIN) && defined(MOZILLA_CLIENT) */
|
||||
#if 0
|
||||
return(WFE_BuildCompuserveAuthString(URL_s));
|
||||
#else
|
||||
return(NULL);
|
||||
@ -492,7 +493,8 @@ NET_AskForAuthString(MWContext *context,
|
||||
*/
|
||||
|
||||
PR_FREEIF(host);
|
||||
#if defined(XP_WIN) && defined(MOZILLA_CLIENT)
|
||||
/* #if defined(XP_WIN) && defined(MOZILLA_CLIENT) */
|
||||
#if 0
|
||||
return(WFE_DoCompuserveAuthenticate(context, URL_s, authenticate_header_value));
|
||||
#else
|
||||
return(NET_AUTH_FAILED_DISPLAY_DOCUMENT);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user