⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htinit.c

📁 www工具包
💻 C
📖 第 1 页 / 共 2 页
字号:
/*								       HTInit.c**	CONFIGURATION-SPECIFIC INITIALIALIZATION****	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.**	@(#) $Id: HTInit.c,v 2.95 1999/02/07 18:29:44 frystyk Exp $****	Define a basic set of suffixes and presentations*//* Library include files */#include "wwwsys.h"#include "WWWUtil.h"#include "WWWCore.h"#ifdef HT_MUX#include "WWWMux.h"#endif#include "HTInit.h"				         /* Implemented here */#ifndef W3C_ICONS#define W3C_ICONS	"w3c-icons"#endif#define ICON_LOCATION	"/icons/"/* ------------------------------------------------------------------------- *//*	BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION)**	----------------------------------------------------------------------**	Not done automaticly - may be done by application!*/PUBLIC void HTConverterInit (HTList * c){    /*    ** You can get debug information out through the debug stream if you set    ** the debug format appropriately    */    HTConversion_add(c,"*/*",			"www/debug",	HTBlackHoleConverter,	1.0, 0.0, 0.0);    /*    **  Set our own local file save stream for the MIME parser so that     **  we know how to dump to local disk in case we get content type    **  application/octect stream, or an encoding that we don't know.    */    HTMIME_setSaveStream (HTSaveLocally);    /*    ** These are converters that converts to something other than www/present,    ** that is not directly outputting someting to the user on the screen    */    HTConversion_add(c,"message/rfc822",	"*/*",		HTMIMEConvert,	1.0, 0.0, 0.0);    HTConversion_add(c,"message/x-rfc822-foot",	"*/*",		HTMIMEFooter,	1.0, 0.0, 0.0);    HTConversion_add(c,"message/x-rfc822-head",	"*/*",		HTMIMEHeader,	1.0, 0.0, 0.0);    HTConversion_add(c,"message/x-rfc822-cont",	"*/*",		HTMIMEContinue,	1.0, 0.0, 0.0);    HTConversion_add(c,"message/x-rfc822-partial","*/*",	HTMIMEPartial,	1.0, 0.0, 0.0);    HTConversion_add(c,"multipart/*",		"*/*",		HTBoundary,	1.0, 0.0, 0.0);    HTConversion_add(c,"text/plain",		"text/html",	HTPlainToHTML,	1.0, 0.0, 0.0);    /*    ** The following conversions are converting ASCII output from various    ** protocols to HTML objects.    */    HTConversion_add(c,"text/x-http",		"*/*",		HTTPStatus_new,	1.0, 0.0, 0.0);#if 0    HTConversion_add(c,"text/x-gopher",		"www/present",	HTGopherMenu,	1.0, 0.0, 0.0);    HTConversion_add(c,"text/x-cso",		"www/present",	HTGopherCSO,	1.0, 0.0, 0.0);    HTConversion_add(c,"text/x-wais-source",	"*/*",		HTWSRCConvert, 	1.0, 0.0, 0.0);#endif    HTConversion_add(c,"text/x-nntp-list",	"*/*",		HTNewsList,	1.0, 0.0, 0.0);    HTConversion_add(c,"text/x-nntp-over",	"*/*",		HTNewsGroup,	1.0, 0.0, 0.0);    /*    ** If we have the XML expat parser linked in    */#ifdef HT_EXPAT    HTConversion_add(c, "text/xml",		"*/*",		HTXML_new,	1.0, 0.0, 0.0);    HTConversion_add(c, "application/xml",	"*/*",		HTXML_new,	1.0, 0.0, 0.0);#endif    /*    ** We also register a special content type guess stream that can figure out    ** the content type by reading the first bytes of the stream    */    HTConversion_add(c,"www/unknown",		"*/*",		HTGuess_new,	1.0, 0.0, 0.0);    /*    ** Register a persistent cache stream which can save an object to local    ** file    */    HTConversion_add(c,"www/cache",		"*/*",		HTCacheWriter,	1.0, 0.0, 0.0);    HTConversion_add(c,"www/cache-append",	"*/*",		HTCacheAppend,	1.0, 0.0, 0.0);    /*    ** Handling Rule files is handled just like any other stream    ** This converter reads a rule file and generates the rules    */    HTConversion_add(c,"application/x-www-rules","*/*",		HTRules,	1.0, 0.0, 0.0);    /*    ** This dumps all other formats to local disk without any further    ** action taken    */    HTConversion_add(c,"*/*",			"www/present",	HTSaveConverter, 0.3, 0.0, 0.0);}/*	BINDINGS BETWEEN MEDIA TYPES AND EXTERNAL VIEWERS/PRESENTERS**	------------------------------------------------------------**	Not done automaticly - may be done by application!**	The data objects are stored in temporary files before the external**	program is called*/PUBLIC void HTPresenterInit (HTList * c){    /*    **  First we set the special "presenter" stream that writes to a    **  temporary file before executing the external presenter    */    HTPresentation_setConverter(HTSaveAndExecute);#ifdef NeXT    HTPresentation_add(c,"application/postscript", "open %s",	NULL, 1.0, 2.0, 0.0);    /* The following needs the GIF previewer -- you might not have it. */    HTPresentation_add(c,"image/gif", 		"open %s", 	NULL, 0.3, 2.0, 0.0);    HTPresentation_add(c,"image/tiff", 	"open %s", 	NULL, 1.0, 2.0, 0.0);    HTPresentation_add(c,"audio/basic", 	"open %s", 	NULL, 1.0, 2.0, 0.0);    HTPresentation_add(c,"*/*", 		"open %s", 	NULL, 0.05, 0.0, 0.0); #else    if (getenv("DISPLAY")) {	/* Must have X11 */	HTPresentation_add(c,"application/postscript", "ghostview %s",	NULL, 1.0, 3.0, 0.0);	HTPresentation_add(c,"image/gif", 	"xv %s",	NULL, 1.0, 3.0, 0.0);	HTPresentation_add(c,"image/tiff", 	"xv %s",	NULL, 1.0, 3.0, 0.0);	HTPresentation_add(c,"image/jpeg", 	"xv %s",	NULL, 1.0, 3.0, 0.0); 	HTPresentation_add(c,"image/png",	"xv %s",	NULL, 1.0, 3.0, 0.0);    }#endif}/*	PRESENTERS AND CONVERTERS AT THE SAME TIME**	------------------------------------------**	Not done automaticly - may be done by application!**	This function is only defined in order to preserve backward**	compatibility.*/PUBLIC void HTFormatInit (HTList * c){    HTConverterInit(c);    HTPresenterInit(c);}/*	BINDINGS BETWEEN A TRANSFER ENCODING AND CODERS / DECODERS**	----------------------------------------------------------**	Not done automaticly - may be done by application!*/PUBLIC void HTTransferEncoderInit (HTList * c){#ifdef HT_ZLIB    HTCoding_add(c, "deflate", NULL, HTZLib_inflate, 1.0);#endif    HTCoding_add(c, "chunked", HTChunkedEncoder, HTChunkedDecoder, 1.0);}/*	BINDINGS BETWEEN A CONTENT ENCODING AND CODERS / DECODERS**	---------------------------------------------------------**	Not done automaticly - may be done by application!*/PUBLIC void HTContentEncoderInit (HTList * c){#ifdef HT_ZLIB    HTCoding_add(c, "deflate", NULL, HTZLib_inflate, 1.0);#endif /* HT_ZLIB */}/*	REGISTER BEFORE FILTERS**	-----------------------**	The BEFORE filters handle proxies, caches, rule files etc.**	The filters are called in the order by which the are registered**	Not done automaticly - may be done by application!*/PUBLIC void HTBeforeInit (void){#if 0    /* Often handled better by the application */    HTNet_addBefore(HTMemoryCacheFilter,	NULL, 		NULL, HT_FILTER_MIDDLE);#endif#if 0    /* This is now done by HTCacheInit */    HTNet_addBefore(HTCacheFilter,		"http://*",	NULL, HT_FILTER_MIDDLE);#endif    HTNet_addBefore(HTCredentialsFilter,	"http://*",	NULL, HT_FILTER_LATE);    HTNet_addBefore(HTPEP_beforeFilter, 	"http://*",	NULL, HT_FILTER_LATE);    HTNet_addBefore(HTRuleFilter,		NULL,		NULL, HT_FILTER_LATE);    HTNet_addBefore(HTProxyFilter,		NULL,		NULL, HT_FILTER_LATE);}/*	REGISTER AFTER FILTERS**	----------------------**	The AFTER filters handle error messages, logging, redirection,**	authentication etc.**	The filters are called in the order by which the are registered**	Not done automaticly - may be done by application!*/PUBLIC void HTAfterInit (void){    HTNet_addAfter(HTAuthFilter, 	"http://*",	NULL, HT_NO_ACCESS, 	HT_FILTER_MIDDLE);    HTNet_addAfter(HTAuthFilter, 	"http://*",	NULL, HT_REAUTH, 	HT_FILTER_MIDDLE);    HTNet_addAfter(HTPEP_afterFilter, 	"http://*",	NULL, HT_ALL, 		HT_FILTER_MIDDLE);    HTNet_addAfter(HTRedirectFilter, 	"http://*",	NULL, HT_PERM_REDIRECT, HT_FILTER_MIDDLE);    HTNet_addAfter(HTRedirectFilter, 	"http://*",	NULL, HT_FOUND, 	HT_FILTER_MIDDLE);    HTNet_addAfter(HTRedirectFilter,	"http://*",	NULL, HT_SEE_OTHER,	HT_FILTER_MIDDLE);    HTNet_addAfter(HTRedirectFilter, 	"http://*",	NULL, HT_TEMP_REDIRECT, HT_FILTER_MIDDLE);    HTNet_addAfter(HTAuthInfoFilter, 	"http://*",	NULL, HT_ALL, 		HT_FILTER_MIDDLE);    HTNet_addAfter(HTUseProxyFilter, 	"http://*",	NULL, HT_USE_PROXY, 	HT_FILTER_MIDDLE);#if 0    /* This is now done by HTCacheInit */    HTNet_addAfter(HTCacheUpdateFilter, "http://*",	NULL, HT_NOT_MODIFIED, 	HT_FILTER_MIDDLE);#endif    HTNet_addAfter(HTInfoFilter, 	NULL,		NULL, HT_ALL,		HT_FILTER_LATE);}/*	REGISTER DEFAULT AUTHENTICATION SCHEMES

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -