Annotation of libwww/Library/src/HTInit.c, revision 2.98

2.20      frystyk     1: /*                                                                    HTInit.c
                      2: **     CONFIGURATION-SPECIFIC INITIALIALIZATION
                      3: **
2.25      frystyk     4: **     (c) COPYRIGHT MIT 1995.
2.20      frystyk     5: **     Please first read the full copyright statement in the file COPYRIGH.
2.98    ! frystyk     6: **     @(#) $Id: HTInit.c,v 2.97 1999/03/31 00:54:32 frystyk Exp $
2.9       duns        7: **
2.97      frystyk     8: **     General initialization functions.
                      9: **
                     10: **      @@@A lot of these should be moved to the various modules instead
                     11: **      of being here
2.1       timbl      12: */
                     13: 
2.22      frystyk    14: /* Library include files */
2.89      frystyk    15: #include "wwwsys.h"
2.59      frystyk    16: #include "WWWUtil.h"
                     17: #include "WWWCore.h"
2.83      frystyk    18: 
                     19: #ifdef HT_MUX
2.75      frystyk    20: #include "WWWMux.h"
2.83      frystyk    21: #endif
2.75      frystyk    22: 
2.22      frystyk    23: #include "HTInit.h"                                     /* Implemented here */
2.1       timbl      24: 
2.65      frystyk    25: #ifndef W3C_ICONS
2.87      frystyk    26: #define W3C_ICONS      "w3c-icons"
2.65      frystyk    27: #endif
                     28: 
2.87      frystyk    29: #define ICON_LOCATION  "/icons/"
2.65      frystyk    30: 
2.29      frystyk    31: /* ------------------------------------------------------------------------- */
                     32: 
2.23      frystyk    33: /*     BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION)
                     34: **     ----------------------------------------------------------------------
2.47      frystyk    35: **     Not done automaticly - may be done by application!
2.23      frystyk    36: */
2.38      frystyk    37: PUBLIC void HTConverterInit (HTList * c)
2.23      frystyk    38: {
2.31      frystyk    39:     /*
2.49      frystyk    40:     ** You can get debug information out through the debug stream if you set
                     41:     ** the debug format appropriately
                     42:     */
                     43:     HTConversion_add(c,"*/*",                  "www/debug",    HTBlackHoleConverter,   1.0, 0.0, 0.0);
                     44: 
                     45:     /*
2.95      frystyk    46:     **  Set our own local file save stream for the MIME parser so that 
                     47:     **  we know how to dump to local disk in case we get content type
                     48:     **  application/octect stream, or an encoding that we don't know.
                     49:     */
                     50:     HTMIME_setSaveStream (HTSaveLocally);
                     51: 
                     52:     /*
2.31      frystyk    53:     ** These are converters that converts to something other than www/present,
                     54:     ** that is not directly outputting someting to the user on the screen
                     55:     */
2.43      frystyk    56:     HTConversion_add(c,"message/rfc822",       "*/*",          HTMIMEConvert,  1.0, 0.0, 0.0);
2.55      frystyk    57:     HTConversion_add(c,"message/x-rfc822-foot",        "*/*",          HTMIMEFooter,   1.0, 0.0, 0.0);
2.72      frystyk    58:     HTConversion_add(c,"message/x-rfc822-head",        "*/*",          HTMIMEHeader,   1.0, 0.0, 0.0);
2.80      frystyk    59:     HTConversion_add(c,"message/x-rfc822-cont",        "*/*",          HTMIMEContinue, 1.0, 0.0, 0.0);
2.96      frystyk    60:     HTConversion_add(c,"message/x-rfc822-upgrade","*/*",       HTMIMEUpgrade,  1.0, 0.0, 0.0);
2.80      frystyk    61:     HTConversion_add(c,"message/x-rfc822-partial","*/*",       HTMIMEPartial,  1.0, 0.0, 0.0);
2.43      frystyk    62:     HTConversion_add(c,"multipart/*",          "*/*",          HTBoundary,     1.0, 0.0, 0.0);
2.38      frystyk    63:     HTConversion_add(c,"text/plain",           "text/html",    HTPlainToHTML,  1.0, 0.0, 0.0);
2.39      frystyk    64: 
                     65:     /*
                     66:     ** The following conversions are converting ASCII output from various
                     67:     ** protocols to HTML objects.
                     68:     */
2.51      frystyk    69:     HTConversion_add(c,"text/x-http",          "*/*",          HTTPStatus_new, 1.0, 0.0, 0.0);
2.68      frystyk    70: 
2.42      frystyk    71: #if 0
                     72:     HTConversion_add(c,"text/x-gopher",                "www/present",  HTGopherMenu,   1.0, 0.0, 0.0);
                     73:     HTConversion_add(c,"text/x-cso",           "www/present",  HTGopherCSO,    1.0, 0.0, 0.0);
2.68      frystyk    74:     HTConversion_add(c,"text/x-wais-source",   "*/*",          HTWSRCConvert,  1.0, 0.0, 0.0);
                     75: #endif
                     76: 
2.48      frystyk    77:     HTConversion_add(c,"text/x-nntp-list",     "*/*",          HTNewsList,     1.0, 0.0, 0.0);
                     78:     HTConversion_add(c,"text/x-nntp-over",     "*/*",          HTNewsGroup,    1.0, 0.0, 0.0);
2.92      frystyk    79: 
                     80:     /*
                     81:     ** If we have the XML expat parser linked in
                     82:     */
                     83: #ifdef HT_EXPAT
                     84:     HTConversion_add(c, "text/xml",            "*/*",          HTXML_new,      1.0, 0.0, 0.0);
                     85:     HTConversion_add(c, "application/xml",     "*/*",          HTXML_new,      1.0, 0.0, 0.0);
                     86: #endif
2.43      frystyk    87: 
2.31      frystyk    88:     /*
2.45      frystyk    89:     ** We also register a special content type guess stream that can figure out
                     90:     ** the content type by reading the first bytes of the stream
                     91:     */
                     92:     HTConversion_add(c,"www/unknown",          "*/*",          HTGuess_new,    1.0, 0.0, 0.0);
2.46      frystyk    93: 
                     94:     /*
2.72      frystyk    95:     ** Register a persistent cache stream which can save an object to local
                     96:     ** file
                     97:     */
                     98:     HTConversion_add(c,"www/cache",            "*/*",          HTCacheWriter,  1.0, 0.0, 0.0);
2.73      frystyk    99:     HTConversion_add(c,"www/cache-append",     "*/*",          HTCacheAppend,  1.0, 0.0, 0.0);
2.72      frystyk   100: 
                    101:     /*
2.46      frystyk   102:     ** Handling Rule files is handled just like any other stream
                    103:     ** This converter reads a rule file and generates the rules
                    104:     */
2.48      frystyk   105:     HTConversion_add(c,"application/x-www-rules","*/*",                HTRules,        1.0, 0.0, 0.0);
2.46      frystyk   106: 
2.45      frystyk   107:     /*
2.34      frystyk   108:     ** This dumps all other formats to local disk without any further
2.31      frystyk   109:     ** action taken
                    110:     */
2.85      frystyk   111:     HTConversion_add(c,"*/*",                  "www/present",  HTSaveConverter, 0.3, 0.0, 0.0);
2.23      frystyk   112: }
                    113: 
                    114: /*     BINDINGS BETWEEN MEDIA TYPES AND EXTERNAL VIEWERS/PRESENTERS
                    115: **     ------------------------------------------------------------
2.47      frystyk   116: **     Not done automaticly - may be done by application!
2.23      frystyk   117: **     The data objects are stored in temporary files before the external
                    118: **     program is called
                    119: */
2.38      frystyk   120: PUBLIC void HTPresenterInit (HTList * c)
2.1       timbl     121: {
2.95      frystyk   122:     /*
                    123:     **  First we set the special "presenter" stream that writes to a
                    124:     **  temporary file before executing the external presenter
                    125:     */
                    126:     HTPresentation_setConverter(HTSaveAndExecute);
                    127: 
2.1       timbl     128: #ifdef NeXT
2.38      frystyk   129:     HTPresentation_add(c,"application/postscript", "open %s",  NULL, 1.0, 2.0, 0.0);
2.10      luotonen  130:     /* The following needs the GIF previewer -- you might not have it. */
2.19      howcome   131: 
2.38      frystyk   132:     HTPresentation_add(c,"image/gif",          "open %s",      NULL, 0.3, 2.0, 0.0);
2.44      frystyk   133:     HTPresentation_add(c,"image/tiff",         "open %s",      NULL, 1.0, 2.0, 0.0);
2.41      frystyk   134:     HTPresentation_add(c,"audio/basic",        "open %s",      NULL, 1.0, 2.0, 0.0);
                    135:     HTPresentation_add(c,"*/*",                "open %s",      NULL, 0.05, 0.0, 0.0); 
2.1       timbl     136: #else
2.10      luotonen  137:     if (getenv("DISPLAY")) {   /* Must have X11 */
2.38      frystyk   138:        HTPresentation_add(c,"application/postscript", "ghostview %s",  NULL, 1.0, 3.0, 0.0);
2.41      frystyk   139:        HTPresentation_add(c,"image/gif",       "xv %s",        NULL, 1.0, 3.0, 0.0);
2.44      frystyk   140:        HTPresentation_add(c,"image/tiff",      "xv %s",        NULL, 1.0, 3.0, 0.0);
2.38      frystyk   141:        HTPresentation_add(c,"image/jpeg",      "xv %s",        NULL, 1.0, 3.0, 0.0);
2.44      frystyk   142:        HTPresentation_add(c,"image/png",       "xv %s",        NULL, 1.0, 3.0, 0.0);
2.10      luotonen  143:     }
2.1       timbl     144: #endif
2.15      frystyk   145: }
                    146: 
                    147: 
2.23      frystyk   148: /*     PRESENTERS AND CONVERTERS AT THE SAME TIME
                    149: **     ------------------------------------------
2.47      frystyk   150: **     Not done automaticly - may be done by application!
2.23      frystyk   151: **     This function is only defined in order to preserve backward
                    152: **     compatibility.
                    153: */
2.38      frystyk   154: PUBLIC void HTFormatInit (HTList * c)
2.15      frystyk   155: {
2.23      frystyk   156:     HTConverterInit(c);
                    157:     HTPresenterInit(c);
                    158: 
2.1       timbl     159: }
                    160: 
2.78      frystyk   161: /*     BINDINGS BETWEEN A TRANSFER ENCODING AND CODERS / DECODERS
                    162: **     ----------------------------------------------------------
2.55      frystyk   163: **     Not done automaticly - may be done by application!
                    164: */
2.78      frystyk   165: PUBLIC void HTTransferEncoderInit (HTList * c)
2.55      frystyk   166: {
2.90      frystyk   167: #ifdef HT_ZLIB
                    168:     HTCoding_add(c, "deflate", NULL, HTZLib_inflate, 1.0);
                    169: #endif
2.63      frystyk   170:     HTCoding_add(c, "chunked", HTChunkedEncoder, HTChunkedDecoder, 1.0);
2.55      frystyk   171: }
2.47      frystyk   172: 
2.78      frystyk   173: /*     BINDINGS BETWEEN A CONTENT ENCODING AND CODERS / DECODERS
                    174: **     ---------------------------------------------------------
                    175: **     Not done automaticly - may be done by application!
                    176: */
                    177: PUBLIC void HTContentEncoderInit (HTList * c)
                    178: {
2.79      frystyk   179: #ifdef HT_ZLIB
2.78      frystyk   180:     HTCoding_add(c, "deflate", NULL, HTZLib_inflate, 1.0);
2.79      frystyk   181: #endif /* HT_ZLIB */
2.78      frystyk   182: }
                    183: 
2.64      frystyk   184: /*     REGISTER BEFORE FILTERS
                    185: **     -----------------------
                    186: **     The BEFORE filters handle proxies, caches, rule files etc.
                    187: **     The filters are called in the order by which the are registered
                    188: **     Not done automaticly - may be done by application!
                    189: */
                    190: PUBLIC void HTBeforeInit (void)
                    191: {
2.74      frystyk   192:     HTNet_addBefore(HTCredentialsFilter,       "http://*",     NULL, HT_FILTER_LATE);
                    193:     HTNet_addBefore(HTPEP_beforeFilter,        "http://*",     NULL, HT_FILTER_LATE);
                    194:     HTNet_addBefore(HTRuleFilter,              NULL,           NULL, HT_FILTER_LATE);
                    195:     HTNet_addBefore(HTProxyFilter,             NULL,           NULL, HT_FILTER_LATE);
2.64      frystyk   196: }
                    197: 
                    198: /*     REGISTER AFTER FILTERS
                    199: **     ----------------------
                    200: **     The AFTER filters handle error messages, logging, redirection,
                    201: **     authentication etc.
                    202: **     The filters are called in the order by which the are registered
                    203: **     Not done automaticly - may be done by application!
                    204: */
                    205: PUBLIC void HTAfterInit (void)
                    206: {
2.74      frystyk   207:     HTNet_addAfter(HTAuthFilter,       "http://*",     NULL, HT_NO_ACCESS,     HT_FILTER_MIDDLE);
2.81      frystyk   208:     HTNet_addAfter(HTAuthFilter,       "http://*",     NULL, HT_REAUTH,        HT_FILTER_MIDDLE);
2.74      frystyk   209:     HTNet_addAfter(HTPEP_afterFilter,  "http://*",     NULL, HT_ALL,           HT_FILTER_MIDDLE);
2.81      frystyk   210:     HTNet_addAfter(HTRedirectFilter,   "http://*",     NULL, HT_PERM_REDIRECT, HT_FILTER_MIDDLE);
                    211:     HTNet_addAfter(HTRedirectFilter,   "http://*",     NULL, HT_FOUND,         HT_FILTER_MIDDLE);
                    212:     HTNet_addAfter(HTRedirectFilter,   "http://*",     NULL, HT_SEE_OTHER,     HT_FILTER_MIDDLE);
2.74      frystyk   213:     HTNet_addAfter(HTRedirectFilter,   "http://*",     NULL, HT_TEMP_REDIRECT, HT_FILTER_MIDDLE);
2.93      kahan     214:     HTNet_addAfter(HTAuthInfoFilter,   "http://*",     NULL, HT_ALL,           HT_FILTER_MIDDLE);
2.74      frystyk   215:     HTNet_addAfter(HTUseProxyFilter,   "http://*",     NULL, HT_USE_PROXY,     HT_FILTER_MIDDLE);
                    216:     HTNet_addAfter(HTInfoFilter,       NULL,           NULL, HT_ALL,           HT_FILTER_LATE);
2.64      frystyk   217: }
                    218: 
                    219: /*     REGISTER DEFAULT AUTHENTICATION SCHEMES
                    220: **     ---------------------------------------
                    221: **     This function registers the BASIC access authentication
                    222: */
                    223: PUBLIC void HTAAInit (void)
                    224: {
2.93      kahan     225:     HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, NULL,
                    226:                     HTBasic_delete);
2.91      kahan     227:     HTAA_newModule ("digest", HTDigest_generate, HTDigest_parse, 
2.93      kahan     228:                     HTDigest_updateInfo,  HTDigest_delete);
2.64      frystyk   229: }
                    230: 
                    231: /*     REGISTER BEFORE AND AFTER FILTERS
                    232: **     ---------------------------------
                    233: **     We register a commonly used set of BEFORE and AFTER filters.
2.47      frystyk   234: **     Not done automaticly - may be done by application!
                    235: */
                    236: PUBLIC void HTNetInit (void)
                    237: {
2.64      frystyk   238:     HTBeforeInit();
                    239:     HTAfterInit();
2.47      frystyk   240: }
                    241: 
                    242: 
                    243: /*     REGISTER CALLBACKS FOR THE ALERT MANAGER
                    244: **     ----------------------------------------
                    245: **     We register a set of alert messages
                    246: **     Not done automaticly - may be done by application!
                    247: */
                    248: PUBLIC void HTAlertInit (void)
                    249: {
                    250:     HTAlert_add(HTProgress, HT_A_PROGRESS);
                    251:     HTAlert_add(HTError_print, HT_A_MESSAGE);
                    252:     HTAlert_add(HTConfirm, HT_A_CONFIRM);
                    253:     HTAlert_add(HTPrompt, HT_A_PROMPT);
                    254:     HTAlert_add(HTPromptPassword, HT_A_SECRET);
                    255:     HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
                    256: }
                    257: 
2.53      frystyk   258: /*     REGISTER ALL KNOWN TRANSPORTS IN THE LIBRARY
                    259: **     --------------------------------------------
                    260: **     Not done automaticly - may be done by application!
                    261: */
                    262: PUBLIC void HTTransportInit (void)
                    263: {
2.69      frystyk   264:     HTTransport_add("tcp", HT_TP_SINGLE, HTReader_new, HTWriter_new);
                    265:     HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, HTBufferWriter_new);
2.75      frystyk   266: #ifdef HT_MUX
2.76      frystyk   267:     HTTransport_add("mux", HT_TP_INTERLEAVE, HTReader_new, HTBufferWriter_new);
2.75      frystyk   268: #endif /* HT_MUX */
2.54      frystyk   269: #ifndef NO_UNIX_IO
2.69      frystyk   270:     HTTransport_add("local", HT_TP_SINGLE, HTReader_new, HTWriter_new);
2.54      frystyk   271: #else
2.69      frystyk   272:     HTTransport_add("local", HT_TP_SINGLE, HTANSIReader_new, HTANSIWriter_new);
2.54      frystyk   273: #endif
2.53      frystyk   274: }
2.47      frystyk   275: 
2.24      frystyk   276: /*     REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY
                    277: **     -------------------------------------------
2.47      frystyk   278: **     Not done automaticly - may be done by application!
2.24      frystyk   279: */
2.63      frystyk   280: PUBLIC void HTProtocolInit (void)
2.24      frystyk   281: {
                    282: #ifndef DECNET
2.75      frystyk   283:     HTProtocol_add("ftp",      "tcp",  FTP_PORT,       NO,     HTLoadFTP,      NULL);
                    284:     HTProtocol_add("nntp",     "tcp",  NEWS_PORT,      NO,     HTLoadNews,     NULL);
                    285:     HTProtocol_add("news",     "tcp",  NEWS_PORT,      NO,     HTLoadNews,     NULL);
                    286:     HTProtocol_add("gopher",   "tcp",  GOPHER_PORT,    NO,     HTLoadGopher,   NULL);
2.24      frystyk   287: #ifdef HT_DIRECT_WAIS
2.88      frystyk   288:     HTProtocol_add("wais",     "tcp",  WAIS_PORT,      YES,    HTLoadWAIS,     NULL);
2.24      frystyk   289: #endif
                    290: #endif /* DECNET */
2.75      frystyk   291: #ifdef HT_MUX
                    292:     HTProtocol_add("http",     "mux",  HTTP_PORT,      NO,     HTLoadHTTP,     NULL);
                    293: #else
                    294:     HTProtocol_add("http",     "buffered_tcp", HTTP_PORT,      NO,     HTLoadHTTP,     NULL);
                    295: #endif /* !HT_MUX */
2.84      frystyk   296: #ifndef NO_UNIX_IO
                    297:     HTProtocol_add("file",     "local",        0,      NO,     HTLoadFile,     NULL);
                    298:     HTProtocol_add("cache",    "local",        0,      NO,     HTLoadCache,    NULL);
                    299: #else
                    300:     HTProtocol_add("file",     "local",        0,      YES,    HTLoadFile,     NULL);
                    301:     HTProtocol_add("cache",    "local",        0,      YES,    HTLoadCache,    NULL);
                    302: #endif
2.75      frystyk   303:     HTProtocol_add("telnet",   "",             0,      YES,    HTLoadTelnet,   NULL);
                    304:     HTProtocol_add("tn3270",   "",             0,      YES,    HTLoadTelnet,   NULL);
                    305:     HTProtocol_add("rlogin",   "",             0,      YES,    HTLoadTelnet,   NULL);
2.24      frystyk   306: }
2.1       timbl     307: 
2.65      frystyk   308: /*     REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY PREEMPTIVELY
                    309: **     --------------------------------------------------------
                    310: **     Not done automaticly - may be done by application!
                    311: */
                    312: PUBLIC void HTProtocolPreemptiveInit (void)
                    313: {
                    314: #ifndef DECNET
2.75      frystyk   315:     HTProtocol_add("ftp", "tcp", FTP_PORT, YES, HTLoadFTP, NULL);
                    316:     HTProtocol_add("nntp", "tcp", NEWS_PORT, YES, HTLoadNews, NULL);
                    317:     HTProtocol_add("news", "tcp", NEWS_PORT, YES, HTLoadNews, NULL);
                    318:     HTProtocol_add("gopher", "tcp", GOPHER_PORT, YES, HTLoadGopher, NULL);
2.65      frystyk   319: #ifdef HT_DIRECT_WAIS
2.75      frystyk   320:     HTProtocol_add("wais", "", WAIS_PORT, YES, HTLoadWAIS, NULL);
2.65      frystyk   321: #endif
                    322: #endif /* DECNET */
                    323: 
2.75      frystyk   324:     HTProtocol_add("http", "buffered_tcp", HTTP_PORT, YES, HTLoadHTTP, NULL);
                    325:     HTProtocol_add("file", "local", 0, YES, HTLoadFile, NULL);
                    326:     HTProtocol_add("telnet", "", 0, YES, HTLoadTelnet, NULL);
                    327:     HTProtocol_add("tn3270", "", 0, YES, HTLoadTelnet, NULL);
                    328:     HTProtocol_add("rlogin", "", 0, YES, HTLoadTelnet, NULL);
                    329:     HTProtocol_add("cache","local",0,YES,HTLoadCache,  NULL);
2.61      frystyk   330: }
                    331: 
2.48      frystyk   332: /*     BINDINGS BETWEEN ICONS AND MEDIA TYPES
                    333: **     --------------------------------------
                    334: **     Not done automaticly - may be done by application!
                    335: **     For directory listings etc. you can bind a set of icons to a set of
                    336: **     media types and special icons for directories and other objects that
                    337: **     do not have a media type.
                    338: */
2.61      frystyk   339: PUBLIC void HTIconInit (const char * url_prefix)
2.58      eric      340: {
2.65      frystyk   341:     const char * prefix = url_prefix ? url_prefix : ICON_LOCATION;
2.58      eric      342: 
2.61      frystyk   343:     HTIcon_addBlank("blank.xbm",       prefix, NULL);
                    344:     HTIcon_addDir("directory.xbm",     prefix, "DIR");
                    345:     HTIcon_addParent("back.xbm",       prefix, "UP");
                    346:     HTIcon_addUnknown("unknown.xbm",   prefix, NULL);
                    347: 
                    348:     HTIcon_add("unknown.xbm",  prefix, NULL,   "*/*");
                    349:     HTIcon_add("binary.xbm",   prefix, "BIN",  "binary");
                    350:     HTIcon_add("unknown.xbm",  prefix, NULL,   "www/unknown");
                    351:     HTIcon_add("text.xbm",     prefix, "TXT",  "text/*");
                    352:     HTIcon_add("image.xbm",    prefix, "IMG",  "image/*");
                    353:     HTIcon_add("movie.xbm",    prefix, "MOV",  "video/*");
                    354:     HTIcon_add("sound.xbm",    prefix, "AU",   "audio/*");
                    355:     HTIcon_add("tar.xbm",      prefix, "TAR",  "multipart/x-tar");
                    356:     HTIcon_add("tar.xbm",      prefix, "TAR",  "multipart/x-gtar");
                    357:     HTIcon_add("compressed.xbm",prefix,        "CMP",  "x-compress");
                    358:     HTIcon_add("compressed.xbm",prefix,        "GZP",  "x-gzip");
                    359:     HTIcon_add("index.xbm",    prefix, "IDX",  "application/x-gopher-index");
                    360:     HTIcon_add("index2.xbm",   prefix, "CSO",  "application/x-gopher-cso");
                    361:     HTIcon_add("telnet.xbm",   prefix, "TEL",  "application/x-gopher-telnet");
                    362:     HTIcon_add("unknown.xbm",  prefix, "DUP",  "application/x-gopher-duplicate");
                    363:     HTIcon_add("unknown.xbm",  prefix, "TN",   "application/x-gopher-tn3270");
2.65      frystyk   364: 
                    365:     /* Add global  mapping to where to find the internal icons */
2.87      frystyk   366:     {
                    367:        char * curdir = HTGetCurrentDirectoryURL();
                    368:        char * virtual = HTParse(ICON_LOCATION, curdir,
                    369:                                 PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
                    370:        char * physical = NULL;
                    371:        StrAllocCat(virtual, "*");
                    372: 
                    373:        {
                    374:            char * str = NULL;
                    375:            if ((str = (char *) HT_MALLOC(strlen(W3C_ICONS) + 4)) == NULL)
                    376:                HT_OUTOFMEM("HTIconInit");
                    377:            strcpy(str, W3C_ICONS);
                    378:            if (*(str + strlen(str) - 1) != '/') strcat(str, "/");
                    379:            strcat(str, "*");
                    380:            physical = HTParse(str, curdir,
                    381:                               PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
                    382:            HT_FREE(str);
                    383:        }
                    384:        HTRule_addGlobal(HT_Pass, virtual, physical);
                    385:        HT_FREE(virtual);
                    386:        HT_FREE(physical);
                    387:        HT_FREE(curdir);
                    388:     }
2.58      eric      389: }
                    390: 
2.57      eric      391: /*     REGISTER ALL HTTP/1.1 MIME HEADERS
                    392: **     --------------------------------------------
                    393: **     Not done automaticly - may be done by application!
                    394: */
2.64      frystyk   395: PUBLIC void HTMIMEInit (void)
2.57      eric      396: {
                    397:     struct {
                    398:         char * string;
                    399:        HTParserCallback * pHandler;
                    400:     } fixedHandlers[] = {
2.61      frystyk   401:        {"accept", &HTMIME_accept}, 
                    402:        {"accept-charset", &HTMIME_acceptCharset}, 
                    403:        {"accept-encoding", &HTMIME_acceptEncoding}, 
                    404:        {"accept-language", &HTMIME_acceptLanguage}, 
                    405:        {"accept-ranges", &HTMIME_acceptRanges}, 
                    406:        {"authorization", NULL},
2.72      frystyk   407:        {"cache-control", &HTMIME_cacheControl},
2.61      frystyk   408:        {"connection", &HTMIME_connection}, 
                    409:        {"content-encoding", &HTMIME_contentEncoding}, 
                    410:        {"content-length", &HTMIME_contentLength}, 
                    411:        {"content-range", &HTMIME_contentRange},
                    412:        {"content-transfer-encoding", &HTMIME_contentTransferEncoding}, 
                    413:        {"content-type", &HTMIME_contentType},
                    414:        {"digest-MessageDigest", &HTMIME_messageDigest}, 
2.77      eric      415:        {"keep-alive", &HTMIME_keepAlive}, 
2.61      frystyk   416:        {"link", &HTMIME_link},
                    417:        {"location", &HTMIME_location},
                    418:        {"max-forwards", &HTMIME_maxForwards}, 
2.57      eric      419:        {"mime-version", NULL}, 
2.61      frystyk   420:        {"pragma", &HTMIME_pragma},
2.73      frystyk   421:         {"protocol", &HTMIME_protocol},
                    422:         {"protocol-info", &HTMIME_protocolInfo},
                    423:         {"protocol-request", &HTMIME_protocolRequest},
2.66      frystyk   424:        {"proxy-authenticate", &HTMIME_authenticate},
2.61      frystyk   425:        {"proxy-authorization", &HTMIME_proxyAuthorization},
                    426:        {"public", &HTMIME_public},
                    427:        {"range", &HTMIME_range},
                    428:        {"referer", &HTMIME_referer},
                    429:        {"retry-after", &HTMIME_retryAfter}, 
2.62      frystyk   430:        {"server", &HTMIME_server}, 
2.81      frystyk   431:        {"trailer", &HTMIME_trailer},
2.85      frystyk   432:        {"transfer-encoding", &HTMIME_transferEncoding}, 
2.61      frystyk   433:        {"upgrade", &HTMIME_upgrade},
                    434:        {"user-agent", &HTMIME_userAgent},
                    435:        {"vary", &HTMIME_vary},
                    436:        {"via", &HTMIME_via},
                    437:        {"warning", &HTMIME_warning},
                    438:        {"www-authenticate", &HTMIME_authenticate}, 
2.91      kahan     439:         {"authentication-info", &HTMIME_authenticationInfo},
                    440:         {"proxy-authentication-info", &HTMIME_proxyAuthenticationInfo}
2.57      eric      441:     };
                    442:     int i;
                    443: 
                    444:     for (i = 0; i < sizeof(fixedHandlers)/sizeof(fixedHandlers[0]); i++)
                    445:         HTHeader_addParser(fixedHandlers[i].string, NO, 
                    446:                           fixedHandlers[i].pHandler);
                    447: }
                    448: 

Webmaster