📄 htmime.h
字号:
/* W3C Sample Code Library libwww MIME Parsers! Libwww MIME Parsers!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*The MIME parser stream presents a MIME document with a header and possiblya footer. It recursively invokes the format manager to handle embedded formatslike MIME multipart. As well as stripping off and parsing the headers, theMIME parser has to parse any weird MIME encodings it may meet within thebody parts of messages, and must deal with multipartmessages (see HTBound.h).This module is implemented to the level necessary for operation with WWW,but is not currently complete for any arbitrary MIME message.This module is implemented by HTMIME.c, and it isa part of the W3C Sample CodeLibrary.*/#ifndef HTMIME_H#define HTMIME_H#include "HTStream.h"#include "HTFormat.h"/*. How to Deal with Unknown Data.When the MIME parser can't find a target stream, for example because themedia type is unknown, or it has a content encoding or transfer encodingthat it doesn't know about then it has to get rid of the data in some otherfashion, for example by dumping it to local disk (but it could also be dumpingit to a black hole). The following two functions allow you to set and getthe stream to use in this situation. By default, libwww provides animplementation of a save stream as HTSaveLocallywhich you may want to use - this is for example used by thecurrent profiles.*/extern void HTMIME_setSaveStream (HTConverter * save_stream);extern HTConverter * HTMIME_saveStream (void);/*. MIME Parse Stream.This stream parses a complete MIME message and if a media type header isfound then the stream stack is called to create the nest stream instancein the stream pipe. Any piece of the MIME body is pumped right through thestream.*/extern HTConverter HTMIMEConvert;/*. MIME Header ONLY Parse Stream.This stream parses a complete MIME header and then returnesHT_LOADED. It does not set up any streams and resting data staysin the buffer. This can be used if you only want to parse the headers beforeyou decide what to do next. This is for example the case with HTTP HEAD requests.*/extern HTConverter HTMIMEHeader;/*. MIME Footer ONLY Parse Stream.Parse only a footer, for example after a chunked encoding.*/extern HTConverter HTMIMEFooter;/*. HTTP 100 Continue Parse Stream.The 100 continue status codes can come at any time - we take them and putthe data down a temporary stream. When the 100 continue message has beenparsed, the stream returns HT_CONTINUE*/extern HTConverter HTMIMEContinue;/*. HTTP 101 Switching Protocol Parse Stream.The 101 Switching Protocol status code indicates that the rest of the streamis using another format, protocol, what ever. The result is the same - weare done parsing here and must leave the rest to the next stream which hopefullyknows more about how to parse the rest of the stream. The stream stack iscalled to look for a stream registered for handlingWWW_MIME_UPGRADE. This steam shouldreturn HT_LOADED when it is done, HT_ERROR if anerror occurred and HT_OK as long as it just reads more data.*/extern HTConverter HTMIMEUpgrade;/*. HTTP 206 Partial Data MIME Parse Stream.In case we sent a Range conditional GET we may get back a 206 PartialResponse. This response must be appended to the already existing cache entrybefore presented to the user. That is, first we load thecached object and pump it down the pipe and thenthe new data follows. Only the latter part gets appended to the cache, ofcourse.*/extern HTConverter HTMIMEPartial;/*. HTMIME_anchor2response.Copies the anchor HTTP headers into a response object by meansof the generic _dispatchParsers function. Written so that we cancopy the HTTP headers stored in the cache to the response object.*/#ifndef NO_CACHEextern HTConverter HTCacheCopyHeaders;#endif/**/#endif/* @(#) $Id: HTMIME.html,v 2.32 2000/12/18 17:00:56 kahan Exp $*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -