Annotation of libwww/Library/src/HTInit.c, revision 2.97
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.97 ! frystyk 6: ** @(#) $Id: HTInit.c,v 2.96 1999/02/27 01:28:40 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.86 frystyk 192: #if 0
193: /* Often handled better by the application */
2.74 frystyk 194: HTNet_addBefore(HTMemoryCacheFilter, NULL, NULL, HT_FILTER_MIDDLE);
2.86 frystyk 195: #endif
2.94 frystyk 196:
197: #if 0
198: /* This is now done by HTCacheInit */
2.74 frystyk 199: HTNet_addBefore(HTCacheFilter, "http://*", NULL, HT_FILTER_MIDDLE);
2.94 frystyk 200: #endif
201:
2.74 frystyk 202: HTNet_addBefore(HTCredentialsFilter, "http://*", NULL, HT_FILTER_LATE);
203: HTNet_addBefore(HTPEP_beforeFilter, "http://*", NULL, HT_FILTER_LATE);
204: HTNet_addBefore(HTRuleFilter, NULL, NULL, HT_FILTER_LATE);
205: HTNet_addBefore(HTProxyFilter, NULL, NULL, HT_FILTER_LATE);
2.64 frystyk 206: }
207:
208: /* REGISTER AFTER FILTERS
209: ** ----------------------
210: ** The AFTER filters handle error messages, logging, redirection,
211: ** authentication etc.
212: ** The filters are called in the order by which the are registered
213: ** Not done automaticly - may be done by application!
214: */
215: PUBLIC void HTAfterInit (void)
216: {
2.74 frystyk 217: HTNet_addAfter(HTAuthFilter, "http://*", NULL, HT_NO_ACCESS, HT_FILTER_MIDDLE);
2.81 frystyk 218: HTNet_addAfter(HTAuthFilter, "http://*", NULL, HT_REAUTH, HT_FILTER_MIDDLE);
2.74 frystyk 219: HTNet_addAfter(HTPEP_afterFilter, "http://*", NULL, HT_ALL, HT_FILTER_MIDDLE);
2.81 frystyk 220: HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_PERM_REDIRECT, HT_FILTER_MIDDLE);
221: HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_FOUND, HT_FILTER_MIDDLE);
222: HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_SEE_OTHER, HT_FILTER_MIDDLE);
2.74 frystyk 223: HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_TEMP_REDIRECT, HT_FILTER_MIDDLE);
2.93 kahan 224: HTNet_addAfter(HTAuthInfoFilter, "http://*", NULL, HT_ALL, HT_FILTER_MIDDLE);
2.74 frystyk 225: HTNet_addAfter(HTUseProxyFilter, "http://*", NULL, HT_USE_PROXY, HT_FILTER_MIDDLE);
2.94 frystyk 226:
227: #if 0
228: /* This is now done by HTCacheInit */
2.74 frystyk 229: HTNet_addAfter(HTCacheUpdateFilter, "http://*", NULL, HT_NOT_MODIFIED, HT_FILTER_MIDDLE);
2.94 frystyk 230: #endif
231:
2.74 frystyk 232: HTNet_addAfter(HTInfoFilter, NULL, NULL, HT_ALL, HT_FILTER_LATE);
2.64 frystyk 233: }
234:
235: /* REGISTER DEFAULT AUTHENTICATION SCHEMES
236: ** ---------------------------------------
237: ** This function registers the BASIC access authentication
238: */
239: PUBLIC void HTAAInit (void)
240: {
2.93 kahan 241: HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, NULL,
242: HTBasic_delete);
2.91 kahan 243: HTAA_newModule ("digest", HTDigest_generate, HTDigest_parse,
2.93 kahan 244: HTDigest_updateInfo, HTDigest_delete);
2.64 frystyk 245: }
246:
247: /* REGISTER BEFORE AND AFTER FILTERS
248: ** ---------------------------------
249: ** We register a commonly used set of BEFORE and AFTER filters.
2.47 frystyk 250: ** Not done automaticly - may be done by application!
251: */
252: PUBLIC void HTNetInit (void)
253: {
2.64 frystyk 254: HTBeforeInit();
255: HTAfterInit();
2.47 frystyk 256: }
257:
258:
259: /* REGISTER CALLBACKS FOR THE ALERT MANAGER
260: ** ----------------------------------------
261: ** We register a set of alert messages
262: ** Not done automaticly - may be done by application!
263: */
264: PUBLIC void HTAlertInit (void)
265: {
266: HTAlert_add(HTProgress, HT_A_PROGRESS);
267: HTAlert_add(HTError_print, HT_A_MESSAGE);
268: HTAlert_add(HTConfirm, HT_A_CONFIRM);
269: HTAlert_add(HTPrompt, HT_A_PROMPT);
270: HTAlert_add(HTPromptPassword, HT_A_SECRET);
271: HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
272: }
273:
2.53 frystyk 274: /* REGISTER ALL KNOWN TRANSPORTS IN THE LIBRARY
275: ** --------------------------------------------
276: ** Not done automaticly - may be done by application!
277: */
278: PUBLIC void HTTransportInit (void)
279: {
2.69 frystyk 280: HTTransport_add("tcp", HT_TP_SINGLE, HTReader_new, HTWriter_new);
281: HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, HTBufferWriter_new);
2.75 frystyk 282: #ifdef HT_MUX
2.76 frystyk 283: HTTransport_add("mux", HT_TP_INTERLEAVE, HTReader_new, HTBufferWriter_new);
2.75 frystyk 284: #endif /* HT_MUX */
2.54 frystyk 285: #ifndef NO_UNIX_IO
2.69 frystyk 286: HTTransport_add("local", HT_TP_SINGLE, HTReader_new, HTWriter_new);
2.54 frystyk 287: #else
2.69 frystyk 288: HTTransport_add("local", HT_TP_SINGLE, HTANSIReader_new, HTANSIWriter_new);
2.54 frystyk 289: #endif
2.53 frystyk 290: }
2.47 frystyk 291:
2.24 frystyk 292: /* REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY
293: ** -------------------------------------------
2.47 frystyk 294: ** Not done automaticly - may be done by application!
2.24 frystyk 295: */
2.63 frystyk 296: PUBLIC void HTProtocolInit (void)
2.24 frystyk 297: {
298: #ifndef DECNET
2.75 frystyk 299: HTProtocol_add("ftp", "tcp", FTP_PORT, NO, HTLoadFTP, NULL);
300: HTProtocol_add("nntp", "tcp", NEWS_PORT, NO, HTLoadNews, NULL);
301: HTProtocol_add("news", "tcp", NEWS_PORT, NO, HTLoadNews, NULL);
302: HTProtocol_add("gopher", "tcp", GOPHER_PORT, NO, HTLoadGopher, NULL);
2.24 frystyk 303: #ifdef HT_DIRECT_WAIS
2.88 frystyk 304: HTProtocol_add("wais", "tcp", WAIS_PORT, YES, HTLoadWAIS, NULL);
2.24 frystyk 305: #endif
306: #endif /* DECNET */
2.75 frystyk 307: #ifdef HT_MUX
308: HTProtocol_add("http", "mux", HTTP_PORT, NO, HTLoadHTTP, NULL);
309: #else
310: HTProtocol_add("http", "buffered_tcp", HTTP_PORT, NO, HTLoadHTTP, NULL);
311: #endif /* !HT_MUX */
2.84 frystyk 312: #ifndef NO_UNIX_IO
313: HTProtocol_add("file", "local", 0, NO, HTLoadFile, NULL);
314: HTProtocol_add("cache", "local", 0, NO, HTLoadCache, NULL);
315: #else
316: HTProtocol_add("file", "local", 0, YES, HTLoadFile, NULL);
317: HTProtocol_add("cache", "local", 0, YES, HTLoadCache, NULL);
318: #endif
2.75 frystyk 319: HTProtocol_add("telnet", "", 0, YES, HTLoadTelnet, NULL);
320: HTProtocol_add("tn3270", "", 0, YES, HTLoadTelnet, NULL);
321: HTProtocol_add("rlogin", "", 0, YES, HTLoadTelnet, NULL);
2.24 frystyk 322: }
2.1 timbl 323:
2.65 frystyk 324: /* REGISTER ALL KNOWN PROTOCOLS IN THE LIBRARY PREEMPTIVELY
325: ** --------------------------------------------------------
326: ** Not done automaticly - may be done by application!
327: */
328: PUBLIC void HTProtocolPreemptiveInit (void)
329: {
330: #ifndef DECNET
2.75 frystyk 331: HTProtocol_add("ftp", "tcp", FTP_PORT, YES, HTLoadFTP, NULL);
332: HTProtocol_add("nntp", "tcp", NEWS_PORT, YES, HTLoadNews, NULL);
333: HTProtocol_add("news", "tcp", NEWS_PORT, YES, HTLoadNews, NULL);
334: HTProtocol_add("gopher", "tcp", GOPHER_PORT, YES, HTLoadGopher, NULL);
2.65 frystyk 335: #ifdef HT_DIRECT_WAIS
2.75 frystyk 336: HTProtocol_add("wais", "", WAIS_PORT, YES, HTLoadWAIS, NULL);
2.65 frystyk 337: #endif
338: #endif /* DECNET */
339:
2.75 frystyk 340: HTProtocol_add("http", "buffered_tcp", HTTP_PORT, YES, HTLoadHTTP, NULL);
341: HTProtocol_add("file", "local", 0, YES, HTLoadFile, NULL);
342: HTProtocol_add("telnet", "", 0, YES, HTLoadTelnet, NULL);
343: HTProtocol_add("tn3270", "", 0, YES, HTLoadTelnet, NULL);
344: HTProtocol_add("rlogin", "", 0, YES, HTLoadTelnet, NULL);
345: HTProtocol_add("cache","local",0,YES,HTLoadCache, NULL);
2.61 frystyk 346: }
347:
2.48 frystyk 348: /* BINDINGS BETWEEN ICONS AND MEDIA TYPES
349: ** --------------------------------------
350: ** Not done automaticly - may be done by application!
351: ** For directory listings etc. you can bind a set of icons to a set of
352: ** media types and special icons for directories and other objects that
353: ** do not have a media type.
354: */
2.61 frystyk 355: PUBLIC void HTIconInit (const char * url_prefix)
2.58 eric 356: {
2.65 frystyk 357: const char * prefix = url_prefix ? url_prefix : ICON_LOCATION;
2.58 eric 358:
2.61 frystyk 359: HTIcon_addBlank("blank.xbm", prefix, NULL);
360: HTIcon_addDir("directory.xbm", prefix, "DIR");
361: HTIcon_addParent("back.xbm", prefix, "UP");
362: HTIcon_addUnknown("unknown.xbm", prefix, NULL);
363:
364: HTIcon_add("unknown.xbm", prefix, NULL, "*/*");
365: HTIcon_add("binary.xbm", prefix, "BIN", "binary");
366: HTIcon_add("unknown.xbm", prefix, NULL, "www/unknown");
367: HTIcon_add("text.xbm", prefix, "TXT", "text/*");
368: HTIcon_add("image.xbm", prefix, "IMG", "image/*");
369: HTIcon_add("movie.xbm", prefix, "MOV", "video/*");
370: HTIcon_add("sound.xbm", prefix, "AU", "audio/*");
371: HTIcon_add("tar.xbm", prefix, "TAR", "multipart/x-tar");
372: HTIcon_add("tar.xbm", prefix, "TAR", "multipart/x-gtar");
373: HTIcon_add("compressed.xbm",prefix, "CMP", "x-compress");
374: HTIcon_add("compressed.xbm",prefix, "GZP", "x-gzip");
375: HTIcon_add("index.xbm", prefix, "IDX", "application/x-gopher-index");
376: HTIcon_add("index2.xbm", prefix, "CSO", "application/x-gopher-cso");
377: HTIcon_add("telnet.xbm", prefix, "TEL", "application/x-gopher-telnet");
378: HTIcon_add("unknown.xbm", prefix, "DUP", "application/x-gopher-duplicate");
379: HTIcon_add("unknown.xbm", prefix, "TN", "application/x-gopher-tn3270");
2.65 frystyk 380:
381: /* Add global mapping to where to find the internal icons */
2.87 frystyk 382: {
383: char * curdir = HTGetCurrentDirectoryURL();
384: char * virtual = HTParse(ICON_LOCATION, curdir,
385: PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
386: char * physical = NULL;
387: StrAllocCat(virtual, "*");
388:
389: {
390: char * str = NULL;
391: if ((str = (char *) HT_MALLOC(strlen(W3C_ICONS) + 4)) == NULL)
392: HT_OUTOFMEM("HTIconInit");
393: strcpy(str, W3C_ICONS);
394: if (*(str + strlen(str) - 1) != '/') strcat(str, "/");
395: strcat(str, "*");
396: physical = HTParse(str, curdir,
397: PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
398: HT_FREE(str);
399: }
400: HTRule_addGlobal(HT_Pass, virtual, physical);
401: HT_FREE(virtual);
402: HT_FREE(physical);
403: HT_FREE(curdir);
404: }
2.58 eric 405: }
406:
2.57 eric 407: /* REGISTER ALL HTTP/1.1 MIME HEADERS
408: ** --------------------------------------------
409: ** Not done automaticly - may be done by application!
410: */
2.64 frystyk 411: PUBLIC void HTMIMEInit (void)
2.57 eric 412: {
413: struct {
414: char * string;
415: HTParserCallback * pHandler;
416: } fixedHandlers[] = {
2.61 frystyk 417: {"accept", &HTMIME_accept},
418: {"accept-charset", &HTMIME_acceptCharset},
419: {"accept-encoding", &HTMIME_acceptEncoding},
420: {"accept-language", &HTMIME_acceptLanguage},
421: {"accept-ranges", &HTMIME_acceptRanges},
422: {"authorization", NULL},
2.72 frystyk 423: {"cache-control", &HTMIME_cacheControl},
2.61 frystyk 424: {"connection", &HTMIME_connection},
425: {"content-encoding", &HTMIME_contentEncoding},
426: {"content-length", &HTMIME_contentLength},
427: {"content-range", &HTMIME_contentRange},
428: {"content-transfer-encoding", &HTMIME_contentTransferEncoding},
429: {"content-type", &HTMIME_contentType},
430: {"digest-MessageDigest", &HTMIME_messageDigest},
2.77 eric 431: {"keep-alive", &HTMIME_keepAlive},
2.61 frystyk 432: {"link", &HTMIME_link},
433: {"location", &HTMIME_location},
434: {"max-forwards", &HTMIME_maxForwards},
2.57 eric 435: {"mime-version", NULL},
2.61 frystyk 436: {"pragma", &HTMIME_pragma},
2.73 frystyk 437: {"protocol", &HTMIME_protocol},
438: {"protocol-info", &HTMIME_protocolInfo},
439: {"protocol-request", &HTMIME_protocolRequest},
2.66 frystyk 440: {"proxy-authenticate", &HTMIME_authenticate},
2.61 frystyk 441: {"proxy-authorization", &HTMIME_proxyAuthorization},
442: {"public", &HTMIME_public},
443: {"range", &HTMIME_range},
444: {"referer", &HTMIME_referer},
445: {"retry-after", &HTMIME_retryAfter},
2.62 frystyk 446: {"server", &HTMIME_server},
2.81 frystyk 447: {"trailer", &HTMIME_trailer},
2.85 frystyk 448: {"transfer-encoding", &HTMIME_transferEncoding},
2.61 frystyk 449: {"upgrade", &HTMIME_upgrade},
450: {"user-agent", &HTMIME_userAgent},
451: {"vary", &HTMIME_vary},
452: {"via", &HTMIME_via},
453: {"warning", &HTMIME_warning},
454: {"www-authenticate", &HTMIME_authenticate},
2.91 kahan 455: {"authentication-info", &HTMIME_authenticationInfo},
456: {"proxy-authentication-info", &HTMIME_proxyAuthenticationInfo}
2.57 eric 457: };
458: int i;
459:
460: for (i = 0; i < sizeof(fixedHandlers)/sizeof(fixedHandlers[0]); i++)
461: HTHeader_addParser(fixedHandlers[i].string, NO,
462: fixedHandlers[i].pHandler);
463: }
464:
Webmaster