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

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

Webmaster