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

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.58    ! eric        6: **     @(#) $Id: HTInit.c,v 2.57 1996/06/03 19:25:18 eric 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.52      frystyk    12: #include "sysdep.h"
2.22      frystyk    13: #include "HTUtils.h"
2.24      frystyk    14: #include "HTFormat.h"
                     15: #include "HTList.h"
2.28      frystyk    16: #include "HTProt.h"
2.57      eric       17: #include "HTReqMan.h"
2.22      frystyk    18: #include "HTInit.h"                                     /* Implemented here */
2.1       timbl      19: 
2.29      frystyk    20: /* ------------------------------------------------------------------------- */
                     21: 
2.23      frystyk    22: /*     BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION)
                     23: **     ----------------------------------------------------------------------
2.47      frystyk    24: **     Not done automaticly - may be done by application!
2.23      frystyk    25: */
2.38      frystyk    26: PUBLIC void HTConverterInit (HTList * c)
2.23      frystyk    27: {
2.31      frystyk    28:     /*
                     29:     ** This set of converters uses the HTML/HText interface.
2.34      frystyk    30:     ** If you do not want this interface then replace them!
2.31      frystyk    31:     */
2.38      frystyk    32:     HTConversion_add(c,"text/html",            "www/present",  HTMLPresent,    1.0, 0.0, 0.0);
                     33:     HTConversion_add(c,"text/plain",           "www/present",  HTPlainPresent, 1.0, 0.0, 0.0);
                     34:     HTConversion_add(c,"text/html",            "text/x-c",     HTMLToC,        0.5, 0.0, 0.0);
                     35:     HTConversion_add(c,"text/html",            "text/plain",   HTMLToPlain,    0.5, 0.0, 0.0);
                     36:     HTConversion_add(c,"text/html",            "text/latex",   HTMLToTeX,      1.0, 0.0, 0.0);
2.31      frystyk    37: 
                     38:     /*
2.49      frystyk    39:     ** You can get debug information out through the debug stream if you set
                     40:     ** the debug format appropriately
                     41:     */
                     42:     HTConversion_add(c,"*/*",                  "www/debug",    HTBlackHoleConverter,   1.0, 0.0, 0.0);
                     43: 
                     44:     /*
2.31      frystyk    45:     ** These are converters that converts to something other than www/present,
                     46:     ** that is not directly outputting someting to the user on the screen
                     47:     */
2.43      frystyk    48:     HTConversion_add(c,"message/rfc822",       "*/*",          HTMIMEConvert,  1.0, 0.0, 0.0);
2.55      frystyk    49:     HTConversion_add(c,"message/x-rfc822-foot",        "*/*",          HTMIMEFooter,   1.0, 0.0, 0.0);
2.43      frystyk    50:     HTConversion_add(c,"multipart/*",          "*/*",          HTBoundary,     1.0, 0.0, 0.0);
2.38      frystyk    51:     HTConversion_add(c,"text/plain",           "text/html",    HTPlainToHTML,  1.0, 0.0, 0.0);
2.39      frystyk    52: 
                     53:     /*
                     54:     ** The following conversions are converting ASCII output from various
                     55:     ** protocols to HTML objects.
                     56:     */
2.51      frystyk    57:     HTConversion_add(c,"text/x-http",          "*/*",          HTTPStatus_new, 1.0, 0.0, 0.0);
2.42      frystyk    58: #if 0
                     59:     HTConversion_add(c,"text/x-gopher",                "www/present",  HTGopherMenu,   1.0, 0.0, 0.0);
                     60:     HTConversion_add(c,"text/x-cso",           "www/present",  HTGopherCSO,    1.0, 0.0, 0.0);
2.48      frystyk    61:     HTConversion_add(c,"text/x-nntp-list",     "*/*",          HTNewsList,     1.0, 0.0, 0.0);
                     62:     HTConversion_add(c,"text/x-nntp-over",     "*/*",          HTNewsGroup,    1.0, 0.0, 0.0);
                     63:     HTConversion_add(c,"text/x-wais-source",   "*/*",          HTWSRCConvert,  1.0, 0.0, 0.0);
2.53      frystyk    64: #endif
2.43      frystyk    65: 
2.31      frystyk    66:     /*
2.45      frystyk    67:     ** We also register a special content type guess stream that can figure out
                     68:     ** the content type by reading the first bytes of the stream
                     69:     */
                     70:     HTConversion_add(c,"www/unknown",          "*/*",          HTGuess_new,    1.0, 0.0, 0.0);
2.46      frystyk    71: 
                     72:     /*
                     73:     ** Handling Rule files is handled just like any other stream
                     74:     ** This converter reads a rule file and generates the rules
                     75:     */
2.48      frystyk    76:     HTConversion_add(c,"application/x-www-rules","*/*",                HTRules,        1.0, 0.0, 0.0);
2.46      frystyk    77: 
2.45      frystyk    78:     /*
2.34      frystyk    79:     ** This dumps all other formats to local disk without any further
2.31      frystyk    80:     ** action taken
                     81:     */
2.38      frystyk    82:     HTConversion_add(c,"*/*",                  "www/present",  HTSaveLocally,  0.3, 0.0, 0.0);
2.23      frystyk    83: }
                     84: 
                     85: /*     BINDINGS BETWEEN MEDIA TYPES AND EXTERNAL VIEWERS/PRESENTERS
                     86: **     ------------------------------------------------------------
2.47      frystyk    87: **     Not done automaticly - may be done by application!
2.23      frystyk    88: **     The data objects are stored in temporary files before the external
                     89: **     program is called
                     90: */
2.38      frystyk    91: PUBLIC void HTPresenterInit (HTList * c)
2.1       timbl      92: {
                     93: #ifdef NeXT
2.38      frystyk    94:     HTPresentation_add(c,"application/postscript", "open %s",  NULL, 1.0, 2.0, 0.0);
2.10      luotonen   95:     /* The following needs the GIF previewer -- you might not have it. */
2.19      howcome    96: 
2.38      frystyk    97:     HTPresentation_add(c,"image/gif",          "open %s",      NULL, 0.3, 2.0, 0.0);
2.44      frystyk    98:     HTPresentation_add(c,"image/tiff",         "open %s",      NULL, 1.0, 2.0, 0.0);
2.41      frystyk    99:     HTPresentation_add(c,"audio/basic",        "open %s",      NULL, 1.0, 2.0, 0.0);
                    100:     HTPresentation_add(c,"*/*",                "open %s",      NULL, 0.05, 0.0, 0.0); 
2.1       timbl     101: #else
2.10      luotonen  102:     if (getenv("DISPLAY")) {   /* Must have X11 */
2.38      frystyk   103:        HTPresentation_add(c,"application/postscript", "ghostview %s",  NULL, 1.0, 3.0, 0.0);
2.41      frystyk   104:        HTPresentation_add(c,"image/gif",       "xv %s",        NULL, 1.0, 3.0, 0.0);
2.44      frystyk   105:        HTPresentation_add(c,"image/tiff",      "xv %s",        NULL, 1.0, 3.0, 0.0);
2.38      frystyk   106:        HTPresentation_add(c,"image/jpeg",      "xv %s",        NULL, 1.0, 3.0, 0.0);
2.44      frystyk   107:        HTPresentation_add(c,"image/png",       "xv %s",        NULL, 1.0, 3.0, 0.0);
2.10      luotonen  108:     }
2.1       timbl     109: #endif
2.15      frystyk   110: }
                    111: 
                    112: 
2.23      frystyk   113: /*     PRESENTERS AND CONVERTERS AT THE SAME TIME
                    114: **     ------------------------------------------
2.47      frystyk   115: **     Not done automaticly - may be done by application!
2.23      frystyk   116: **     This function is only defined in order to preserve backward
                    117: **     compatibility.
                    118: */
2.38      frystyk   119: PUBLIC void HTFormatInit (HTList * c)
2.15      frystyk   120: {
2.23      frystyk   121:     HTConverterInit(c);
                    122:     HTPresenterInit(c);
                    123: 
2.1       timbl     124: }
                    125: 
2.55      frystyk   126: /*     BINDINGS BETWEEN A ENCODING AND CODERS / DECODERS
                    127: **     --------------------------- ---------------------
                    128: **     Not done automaticly - may be done by application!
                    129: */
                    130: PUBLIC void HTEncoderInit (HTList * c)
                    131: {
                    132:     HTCoding_add(c, "chunked", NULL, HTChunkedDecoder, 1.0);
                    133: }
2.47      frystyk   134: 
                    135: /*     REGISTER CALLBACKS FOR THE NET MANAGER
                    136: **     --------------------------------------
                    137: **     We register two often used callback functions:
                    138: **     a BEFORE and a AFTER callback
                    139: **     Not done automaticly - may be done by application!
                    140: */
                    141: PUBLIC void HTNetInit (void)
                    142: {
2.54      frystyk   143:     HTNetCall_addBefore(HTLoadStart, NULL, 0);
                    144:     HTNetCall_addAfter(HTLoadTerminate, NULL, HT_ALL);
2.47      frystyk   145: }
                    146: 
                    147: 
                    148: /*     REGISTER CALLBACKS FOR THE ALERT MANAGER
                    149: **     ----------------------------------------
                    150: **     We register a set of alert messages
                    151: **     Not done automaticly - may be done by application!
                    152: */
                    153: PUBLIC void HTAlertInit (void)
                    154: {
                    155:     HTAlert_add(HTProgress, HT_A_PROGRESS);
                    156:     HTAlert_add(HTError_print, HT_A_MESSAGE);
                    157:     HTAlert_add(HTConfirm, HT_A_CONFIRM);
                    158:     HTAlert_add(HTPrompt, HT_A_PROMPT);
                    159:     HTAlert_add(HTPromptPassword, HT_A_SECRET);
                    160:     HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
                    161: }
                    162: 
2.53      frystyk   163: /*     REGISTER ALL KNOWN TRANSPORTS IN THE LIBRARY
                    164: **     --------------------------------------------
                    165: **     Not done automaticly - may be done by application!
                    166: */
                    167: PUBLIC void HTTransportInit (void)
                    168: {
2.54      frystyk   169:     HTTransport_add("tcp", HT_CH_SINGLE, HTReader_new, HTWriter_new);
                    170:     HTTransport_add("buffered_tcp", HT_CH_SINGLE, HTReader_new, HTBufferWriter_new);
                    171: #ifndef NO_UNIX_IO
                    172:     HTTransport_add("local", HT_CH_SINGLE, HTReader_new, HTWriter_new);
                    173: #else
                    174:     HTTransport_add("local", HT_CH_SINGLE, HTANSIReader_new, HTANSIWriter_new);
                    175: #endif
2.53      frystyk   176: }
2.47      frystyk   177: 
2.24      frystyk   178: /*     REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY
                    179: **     -------------------------------------------
2.47      frystyk   180: **     Not done automaticly - may be done by application!
2.24      frystyk   181: */
2.33      frystyk   182: PUBLIC void HTAccessInit (void)
2.24      frystyk   183: {
                    184: #ifndef DECNET
2.53      frystyk   185:     HTProtocol_add("ftp", "tcp", NO, HTLoadFTP, NULL);
                    186:     HTProtocol_add("nntp", "tcp", NO, HTLoadNews, NULL);
                    187:     HTProtocol_add("news", "tcp", NO, HTLoadNews, NULL);
                    188:     HTProtocol_add("gopher", "tcp", NO, HTLoadGopher, NULL);
2.24      frystyk   189: #ifdef HT_DIRECT_WAIS
2.53      frystyk   190:     HTProtocol_add("wais", "", YES, HTLoadWAIS, NULL);
2.24      frystyk   191: #endif
                    192: #endif /* DECNET */
                    193: 
2.54      frystyk   194:     HTProtocol_add("http", "buffered_tcp", NO, HTLoadHTTP, NULL);
2.53      frystyk   195:     HTProtocol_add("file", "local", NO, HTLoadFile, NULL);
                    196:     HTProtocol_add("telnet", "", YES, HTLoadTelnet, NULL);
                    197:     HTProtocol_add("tn3270", "", YES, HTLoadTelnet, NULL);
                    198:     HTProtocol_add("rlogin", "", YES, HTLoadTelnet, NULL);
2.56      frystyk   199: }
                    200: 
                    201: /*     REGISTER DEFULT EVENT MANAGER
                    202: **     -----------------------------
                    203: **     Not done automaticly - may be done by application!
                    204: */
                    205: PUBLIC void HTEventInit (void)
                    206: {
                    207:     HTEvent_setRegisterCallback(HTEventrg_register);
                    208:     HTEvent_setUnregisterCallback(HTEventrg_unregister);
2.24      frystyk   209: }
2.1       timbl     210: 
2.48      frystyk   211: #if 0
                    212: /*     BINDINGS BETWEEN ICONS AND MEDIA TYPES
                    213: **     --------------------------------------
                    214: **     Not done automaticly - may be done by application!
                    215: **     For directory listings etc. you can bind a set of icons to a set of
                    216: **     media types and special icons for directories and other objects that
                    217: **     do not have a media type.
                    218: */
2.52      frystyk   219: /* PUBLIC void HTStdIconInit (const char * url_prefix) */
2.48      frystyk   220: {
2.52      frystyk   221:     const char * p = url_prefix ? url_prefix : "/internal-icon/";
2.48      frystyk   222: 
                    223:     HTAddBlankIcon  (prefixed(p,"blank.xbm"),  NULL    );
                    224:     HTAddDirIcon    (prefixed(p,"directory.xbm"),"DIR" );
                    225:     HTAddParentIcon (prefixed(p,"back.xbm"),   "UP"    );
                    226:     HTAddUnknownIcon(prefixed(p,"unknown.xbm"),        NULL    );
                    227:     HTAddIcon(prefixed(p,"unknown.xbm"),       NULL,   "*/*");
                    228:     HTAddIcon(prefixed(p,"binary.xbm"),                "BIN",  "binary");
                    229:     HTAddIcon(prefixed(p,"unknown.xbm"),       NULL,   "www/unknown");
                    230:     HTAddIcon(prefixed(p,"text.xbm"),          "TXT",  "text/*");
                    231:     HTAddIcon(prefixed(p,"image.xbm"),         "IMG",  "image/*");
                    232:     HTAddIcon(prefixed(p,"movie.xbm"),         "MOV",  "video/*");
                    233:     HTAddIcon(prefixed(p,"sound.xbm"),         "AU",   "audio/*");
                    234:     HTAddIcon(prefixed(p,"tar.xbm"),           "TAR",  "multipart/x-tar");
                    235:     HTAddIcon(prefixed(p,"tar.xbm"),           "TAR",  "multipart/x-gtar");
                    236:     HTAddIcon(prefixed(p,"compressed.xbm"),    "CMP",  "x-compress");
                    237:     HTAddIcon(prefixed(p,"compressed.xbm"),    "GZP",  "x-gzip");
                    238:     HTAddIcon(prefixed(p,"index.xbm"),         "IDX",  "application/x-gopher-index");
                    239:     HTAddIcon(prefixed(p,"index2.xbm"),                "CSO",  "application/x-gopher-cso");
                    240:     HTAddIcon(prefixed(p,"telnet.xbm"),                "TEL",  "application/x-gopher-telnet");
                    241:     HTAddIcon(prefixed(p,"unknown.xbm"),               "DUP",  "application/x-gopher-duplicate");
                    242:     HTAddIcon(prefixed(p,"unknown.xbm"),       "TN",   "application/x-gopher-tn3270");
                    243: }
                    244: #endif
2.57      eric      245: 
2.58    ! eric      246: /*     standard MIME parsers
        !           247:  */
        !           248: PRIVATE int allow (HTRequest * request, char * token, char * value)
        !           249: {
        !           250:     char * field;
        !           251:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           252:     while ((field = HTNextField(&value)) != NULL) {
        !           253:         HTMethod new_method;
        !           254:        /* We treat them as case-insensitive! */
        !           255:        if ((new_method = HTMethod_enum(field)) != METHOD_INVALID)
        !           256:            HTAnchor_appendMethods(anchor, new_method);
        !           257:     }
        !           258:     if (STREAM_TRACE)
        !           259:         HTTrace("MIMEParser.. Methods allowed: %d\n",
        !           260:                HTAnchor_methods(anchor));
        !           261:     return HT_OK;
        !           262: }
        !           263: 
        !           264: PRIVATE int authenticate (HTRequest * request, char * token, char * value)
        !           265: {
        !           266:     if (!request->challenge) request->challenge = HTAssocList_new();
        !           267: 
        !           268:     StrAllocCopy(request->scheme, "basic");    /* @@@@@@@@@ */
        !           269: 
        !           270:     HTAssocList_add(request->challenge, "WWW-authenticate", value);
        !           271:     return HT_OK;
        !           272: }
        !           273: 
        !           274: PRIVATE int connection (HTRequest * request, char * token, char * value)
        !           275: {
        !           276:     char * field;
        !           277:     if ((field = HTNextField(&value)) != NULL) {
        !           278:         if (!strcasecomp(field, "keep-alive")) {
        !           279:            HTNet_setPersistent(request->net, YES);
        !           280:            if (STREAM_TRACE) HTTrace("MIMEParser.. Persistent Connection\n");
        !           281:        }
        !           282:     }
        !           283:     return HT_OK;
        !           284: }
        !           285: 
        !           286: PRIVATE int content_encoding (HTRequest * request, char * token, char * value)
        !           287: {
        !           288:     char * field;
        !           289:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           290:     while ((field = HTNextField(&value)) != NULL) {
        !           291:         char * lc = field;
        !           292:        while ((*lc = TOLOWER(*lc))) lc++;
        !           293:        HTAnchor_addEncoding(anchor, HTAtom_for(field));
        !           294:     }
        !           295:     return HT_OK;
        !           296: }
        !           297: 
        !           298: PRIVATE int content_language (HTRequest * request, char * token, char * value)
        !           299: {
        !           300:     char * field;
        !           301:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           302:     while ((field = HTNextField(&value)) != NULL) {
        !           303:         char * lc = field;
        !           304:        while ((*lc = TOLOWER(*lc))) lc++;
        !           305:        HTAnchor_addLanguage(anchor, HTAtom_for(field));
        !           306:     }
        !           307:     return HT_OK;
        !           308: }
        !           309: 
        !           310: PRIVATE int content_length (HTRequest * request, char * token, char * value)
        !           311: {
        !           312:     char * field;
        !           313:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           314:     if ((field = HTNextField(&value)) != NULL)
        !           315:         HTAnchor_setLength(anchor, atol(field));
        !           316:     return HT_OK;
        !           317: }
        !           318: 
        !           319: PRIVATE int content_transfer_encoding (HTRequest * request, char * token, char * value)
        !           320: {
        !           321:     char * field;
        !           322:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           323:     if ((field = HTNextField(&value)) != NULL) {
        !           324:         char *lc = field;
        !           325:        while ((*lc = TOLOWER(*lc))) lc++;
        !           326:        HTAnchor_setTransfer(anchor, HTAtom_for(field));
        !           327:     }
        !           328:     return HT_OK;
        !           329: }
        !           330: 
        !           331: PRIVATE int content_type (HTRequest * request, char * token, char * value)
        !           332: {
        !           333:     char * field;
        !           334:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           335:     if ((field = HTNextField(&value)) != NULL) {
        !           336:         char *lc = field;
        !           337:        while ((*lc = TOLOWER(*lc))) lc++; 
        !           338:        HTAnchor_setFormat(anchor, HTAtom_for(field));
        !           339:        while ((field = HTNextField(&value)) != NULL) {
        !           340:            if (!strcasecomp(field, "charset")) {
        !           341:                if ((field = HTNextField(&value)) != NULL) {
        !           342:                    lc = field;
        !           343:                    while ((*lc = TOLOWER(*lc))) lc++;
        !           344:                    HTAnchor_setCharset(anchor, HTAtom_for(field));
        !           345:                }
        !           346:            } else if (!strcasecomp(field, "level")) {
        !           347:                if ((field = HTNextField(&value)) != NULL) {
        !           348:                    lc = field;
        !           349:                    while ((*lc = TOLOWER(*lc))) lc++;
        !           350:                    HTAnchor_setLevel(anchor, HTAtom_for(field));
        !           351:                }
        !           352:            } else if (!strcasecomp(field, "boundary")) {
        !           353:                if ((field = HTNextField(&value)) != NULL) {
        !           354:                    StrAllocCopy(request->boundary, field);
        !           355:                }
        !           356:            }
        !           357:        }
        !           358:     }
        !           359:     return HT_OK;
        !           360: }
        !           361: 
        !           362: PRIVATE int derived_from (HTRequest * request, char * token, char * value)
        !           363: {
        !           364:     char * field;
        !           365:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           366:     if ((field = HTNextField(&value)) != NULL)
        !           367:         HTAnchor_setDerived(anchor, field);
        !           368:     return HT_OK;
        !           369: }
        !           370: 
        !           371: PRIVATE int expires (HTRequest * request, char * token, char * value)
        !           372: {
        !           373:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           374:     HTAnchor_setExpires(anchor, HTParseTime(value, 
        !           375:                                            HTRequest_userProfile(request)));
        !           376:     return HT_OK;
        !           377: }
        !           378: 
        !           379: PRIVATE int last_modified (HTRequest * request, char * token, char * value)
        !           380: {
        !           381:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           382:     HTAnchor_setLastModified(anchor, HTParseTime(value, 
        !           383:                                            HTRequest_userProfile(request)));
        !           384:     return HT_OK;
        !           385: }
        !           386: 
        !           387: PRIVATE int location (HTRequest * request, char * token, char * value)
        !           388: {
        !           389:     request->redirectionAnchor = HTAnchor_findAddress(HTStrip(value));
        !           390:     return HT_OK;
        !           391: }
        !           392: 
        !           393: PRIVATE int message_digest (HTRequest * request, char * token, char * value)
        !           394: {
        !           395:     if (!request->challenge) request->challenge = HTAssocList_new();
        !           396:     HTAssocList_add(request->challenge, "Digest-MessageDigest", value);
        !           397:     return HT_OK;
        !           398: }
        !           399: 
        !           400: PRIVATE int mime_date (HTRequest * request, char * token, char * value)
        !           401: {
        !           402:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           403:     HTAnchor_setDate(anchor, HTParseTime(value, 
        !           404:                                         HTRequest_userProfile(request)));
        !           405:     return HT_OK;
        !           406: }
        !           407: 
        !           408: PRIVATE int newsgroups (HTRequest * request, char * token, char * value)
        !           409: {
        !           410:     /* HTRequest_net(request)->nntp = YES; */          /* Due to news brain damage */
        !           411:     return HT_OK;
        !           412: }
        !           413: 
        !           414: PRIVATE int retry_after (HTRequest * request, char * token, char * value)
        !           415: {
        !           416:     request->retry_after = HTParseTime(value, 
        !           417:                                       HTRequest_userProfile(request));
        !           418:     return HT_OK;
        !           419: }
        !           420: 
        !           421: PRIVATE int title (HTRequest * request, char * token, char * value)
        !           422: {
        !           423:     char * field;
        !           424:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           425:     if ((field = HTNextField(&value)) != NULL)
        !           426:         HTAnchor_setTitle(anchor, field);
        !           427:     return HT_OK;
        !           428: }
        !           429: 
        !           430: PRIVATE int version (HTRequest * request, char * token, char * value)
        !           431: {
        !           432:     char * field;
        !           433:     HTParentAnchor * anchor = HTRequest_anchor(request);
        !           434:     if ((field = HTNextField(&value)) != NULL)
        !           435:         HTAnchor_setVersion(anchor, field);
        !           436:     return HT_OK;
        !           437: }
        !           438: 
        !           439: 
2.57      eric      440: /*     REGISTER ALL HTTP/1.1 MIME HEADERS
                    441: **     --------------------------------------------
                    442: **     Not done automaticly - may be done by application!
                    443: */
                    444: PUBLIC void HTMIMEInit()
                    445: {
                    446:     struct {
                    447:         char * string;
                    448:        HTParserCallback * pHandler;
                    449:     } fixedHandlers[] = {
                    450:        {"allow", &allow}, 
                    451:        {"accept-language", NULL}, 
                    452:        {"accept-charset", NULL}, 
                    453:        {"accept", NULL}, 
                    454:        {"accept-encoding", NULL}, 
                    455:        {"connection", &connection}, 
                    456:        {"content-encoding", &content_encoding}, 
                    457:        {"content-language", &content_language}, 
                    458:        {"content-length", &content_length}, 
                    459:        {"content-transfer-encoding", &content_transfer_encoding}, 
                    460:        {"content-type", &content_type},
                    461:        {"date", &mime_date}, 
                    462:        {"derived-from", &derived_from}, 
                    463:        {"digest-MessageDigest", &message_digest}, 
                    464:         {"expires", &expires}, 
                    465:        {"keep-alive", NULL}, 
                    466:        {"last-modified", &last_modified}, 
                    467: /*     {"link", &link},  */
                    468:        {"location", &location}, 
                    469:        {"mime-version", NULL}, 
                    470:        {"newsgroups", &newsgroups}, 
                    471:        {"retry-after", &retry_after}, 
                    472:        {"server", NULL}, 
                    473:        {"title", &title}, 
                    474:        {"transfer-encoding", &content_transfer_encoding}, 
                    475: /*     {"uri", &uri_header},  */
                    476:        {"version", &version}, 
                    477:        {"www-authenticate", &authenticate}, 
                    478:     };
                    479:     int i;
                    480: 
                    481:     for (i = 0; i < sizeof(fixedHandlers)/sizeof(fixedHandlers[0]); i++)
                    482:         HTHeader_addParser(fixedHandlers[i].string, NO, 
                    483:                           fixedHandlers[i].pHandler);
                    484: }
                    485: 

Webmaster