Annotation of libwww/Library/src/HTReq.html, revision 2.21

2.1       frystyk     1: <HTML>
                      2: <HEAD>
                      3: <TITLE>Public Declaration of Request Manager</TITLE>
2.21    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  1-Feb-1996 -->
2.1       frystyk     5: <NEXTID N="z11">
                      6: </HEAD>
                      7: <BODY>
                      8: 
                      9: <H1>Public Declaration of Request Manager</H1>
                     10: 
                     11: <PRE>
                     12: /*
                     13: **     (c) COPYRIGHT MIT 1995.
                     14: **     Please first read the full copyright statement in the file COPYRIGH.
                     15: */
                     16: </PRE>
                     17: 
                     18: The request manager consists of two parts: a public part and a private
                     19: part. The public part contains all the information needed to define a
                     20: request the parameters to be used when requesting a resource from the
                     21: network or local file system. When a request is handled, all kinds of
                     22: things about it need to be passed along together with a request.
                     23: <P>
                     24: 
                     25: This module is implemented by <A HREF="HTReqMan.c">HTReqMan.c</A>, and
2.7       frystyk    26: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     27: Reference Library</A>. <P>
2.1       frystyk    28: 
                     29: <PRE>
                     30: #ifndef HTREQ_H
                     31: #define HTREQ_H
                     32: 
2.20      frystyk    33: typedef long HTRequestID;
2.1       frystyk    34: typedef struct _HTRequest HTRequest;
                     35: 
                     36: #include "HTList.h"
                     37: #include "HTFormat.h"
                     38: #include "HTStream.h"
                     39: #include "HTEvntrg.h"
2.10      frystyk    40: #include "HTError.h"
2.1       frystyk    41: #include "HTNet.h"
                     42: </PRE>
                     43: 
                     44: <H2>Request a resource</H2>
                     45: 
                     46: This is an internal routine, which has an address AND a matching
                     47: anchor.  (The public routines are called with one OR the other.)
                     48: 
                     49: <PRE>
2.9       frystyk    50: extern BOOL HTLoad (HTRequest * request, BOOL recursive);
2.1       frystyk    51: </PRE>
                     52: 
                     53: <H2>Creation and Deletion Methods</H2>
                     54: 
                     55: The request object is intended to live as long as the request is still
                     56: active, but can be deleted as soon as it has terminatedk, for example
                     57: in one of the request termination callback functions as described in
                     58: the <A HREF="HTNet.html">Net Manager</A>. Only the anchor object stays
                     59: around after the request itself is terminated.
                     60: 
                     61: <H3>Create new Object</H3>
                     62: 
                     63: Creates a new request object with a default set of options -- in most
                     64: cases it will need some information added which can be done using the
                     65: methods in this module, but it will work as is for a simple request.
                     66: 
                     67: <PRE>
                     68: extern HTRequest * HTRequest_new (void);
                     69: </PRE>
                     70: 
2.14      frystyk    71: <H3>Create a duplicate</H3>
                     72: 
                     73: Creates a new HTRequest object as a duplicate of the src request.
                     74: Returns YES if OK, else NO
                     75: 
                     76: <PRE>
                     77: extern HTRequest * HTRequest_dup (HTRequest * src);
                     78: </PRE>
                     79: 
2.19      frystyk    80: <H4>Create a duplicate for Internal use</H4>
                     81: 
                     82: Creates a new HTRequest object as a duplicate of the src request.  The
                     83: difference to the HTRequest_dup function is that we don't copy the
                     84: error_stack and other information that the application keeps in its
                     85: copy of the request object. Otherwise it will be freed multiple times.
                     86: Returns YES if OK, else NO
                     87: 
                     88: <PRE>
                     89: extern HTRequest * HTRequest_dupInternal (HTRequest * src);
                     90: </PRE>
                     91: 
2.1       frystyk    92: <H3>Delete Object</H3>
                     93: 
                     94: This function deletes the object and cleans up the memory.
                     95: 
                     96: <PRE>
                     97: extern void HTRequest_delete (HTRequest * request);
                     98: </PRE>
                     99: 
                    100: <H2>Bind an Anchor to a Request Object</H2>
                    101: 
                    102: Every request object has an anchor associated with it. The anchor
                    103: normally lives until the application terminates but a request object
                    104: only lives as long as the request is being serviced.
                    105: 
                    106: <PRE>
                    107: extern void HTRequest_setAnchor (HTRequest *request, HTAnchor *anchor);
                    108: extern HTParentAnchor * HTRequest_anchor (HTRequest *request);
                    109: </PRE>
                    110: 
2.14      frystyk   111: <H2>Bind an Access to a request</H2>
                    112: 
                    113: This is done if you are a server. In this case you do not need an anchor
                    114: 
                    115: <PRE>
2.20      frystyk   116: #if 0
2.14      frystyk   117: extern void HTRequest_setAccess (HTRequest * request, char * access);
                    118: extern CONST char * HTRequest_access (HTRequest * request);
2.20      frystyk   119: #endif
2.14      frystyk   120: </PRE>
                    121: 
2.1       frystyk   122: <H2>Set the Method</H2>
                    123: 
                    124: The Method is the operation to be executed on the requested
                    125: object. The default set if the set of operations defined by the HTTP
                    126: protocol, that is "GET", "HEAD", "PUT", "POST", "LINK", "UNLINK", and
                    127: "DELETE" but many of these can be used in other protocols as well. The
                    128: important thing is to think of the requested element as an object on
                    129: which you want to perform an operation. Then it is for the specific
                    130: protocol implementation to try and carry this operation out. However,
                    131: not all operations can be implemented (or make sense) in all
                    132: protocols. <P>
                    133: 
                    134: Methods are handled by the <A HREF="HTMethod.html">Method Module</A>,
                    135: and the default value is "GET".
                    136: 
                    137: <PRE>
                    138: extern void HTRequest_setMethod (HTRequest *request, HTMethod method);
                    139: extern HTMethod HTRequest_method (HTRequest *request);
                    140: </PRE>
                    141: 
                    142: <H2>Update, Reload, or Refresh a Document</H2>
                    143: 
                    144: The Library has two concepts of caching: in memory and on file. When
                    145: loading a document, this flag can be set in order to define who can
                    146: give a response to the request. <EM>IMS</EM> means that a
                    147: "If-Modified-Since" Header is used in a HTTP request.
                    148: 
                    149: <PRE>
                    150: typedef enum _HTReload {
                    151:     HT_ANY_VERSION     = 0x0,          /* Use any version available */
                    152:     HT_MEM_REFRESH     = 0x1,          /* Reload from file cache or network */
                    153:     HT_CACHE_REFRESH   = 0x2,          /* Update from network with IMS */
                    154:     HT_FORCE_RELOAD    = 0x4           /* Update from network with no-cache */
                    155: } HTReload;
                    156: 
                    157: extern void HTRequest_setReloadMode (HTRequest *request, HTReload mode);
                    158: extern HTReload HTRequest_reloadMode (HTRequest *request);
                    159: </PRE>
                    160: 
2.19      frystyk   161: <H2>Redirections</H2>
                    162: 
                    163: When a redirection response is returned to the Library, for example
                    164: from a remote HTTP server, this code is passed back to the
                    165: application. The application can then decide whether a new request
                    166: should be established or not. These two methods return the redirection
                    167: information required to issue a new request, that is the new anchor
                    168: and any list of keywords associated with this anchor.
                    169: 
                    170: <PRE>
                    171: extern HTAnchor * HTRequest_redirection (HTRequest * request);
                    172: </PRE>
                    173: 
2.1       frystyk   174: <H2>Max number of Retrys for a Down Load</H2>
                    175: 
                    176: Automatic reload can happen in two situations:
                    177: 
                    178: <UL>
                    179: <LI>The server sends a redirection response
                    180: <LI>The document has expired
                    181: </UL>
                    182: 
                    183: In order to avoid the Library going into an infinite loop, it is
                    184: necessary to keep track of the number of automatic reloads. Loops can
                    185: occur if the server has a reload to the same document or if the server
                    186: sends back a Expires header which has already expired. The default
                    187: maximum number of automatic reloads is 6.
                    188: 
                    189: <PRE>
                    190: extern BOOL HTRequest_setMaxRetry (int newmax);
                    191: extern int  HTRequest_maxRetry (void);
                    192: extern BOOL HTRequest_retry (HTRequest *request);
                    193: </PRE>
                    194: 
                    195: <H2>Retry Request After</H2>
                    196: 
                    197: Some services, for example HTTP, can in case they are unavailable at
                    198: the time the request is issued send back a time and date stamp to the
                    199: client telling when they are expected to back online. In case a
                    200: request results in a HT_RETRY status, the application can use any time
                    201: indicated in this field to retry the request at a later time. The
                    202: Library does not initiate any request on its own - it's for the
                    203: application to do. The time returned by this function is in calendar
                    204: time or -1 if not available.
                    205: 
                    206: <PRE>
                    207: extern time_t HTRequest_retryTime (HTRequest * request);
                    208: </PRE>
                    209: 
                    210: <H2>Accept Headers</H2>
                    211: 
                    212: The Accept family of headers is an important part of HTTP handling the
                    213: format negotiation. The Library supports both a global set of accept
                    214: headers that are used in <EM>all</EM> HTTP requests and a local set of
                    215: accept headers that are used in specific requests only. The global
                    216: ones are defined in the <A HREF="HTFormat.html">Format
                    217: Manager</A>.  <P>
                    218: 
                    219: Each request can have its local set of accept headers that either are
                    220: added to the global set or replaces the global set of accept
                    221: headers. Non of the headers <EM>have</EM> to be set. If the global set
                    222: is sufficient for all requests then this us perfectly fine. If the
                    223: parameter "override" is set then only local accept headers are used,
                    224: else <EM>both</EM> local and global headers are used.
                    225: 
                    226: <H3>Content Types</H3>
                    227: 
2.8       frystyk   228: The <EM>local</EM> list of specific conversions which the format
2.1       frystyk   229: manager can do in order to fulfill the request.  It typically points
                    230: to a list set up on initialisation time for example by <A
                    231: HREF="HTInit.html">HTInit()</A>. There is also a <A
                    232: HREF="HTFormat.html#z17"><EM>global</EM></A> list of conversions which
                    233: contains a generic set of possible conversions.
                    234: 
                    235: <PRE>
2.8       frystyk   236: extern void HTRequest_setConversion (HTRequest *request, HTList *type, BOOL override);
                    237: extern HTList * HTRequest_conversion (HTRequest *request);
2.1       frystyk   238: </PRE>
                    239: 
                    240: <H3>Content Encodings</H3>
                    241: 
                    242: The list of encodings acceptable in the output stream.
                    243: 
                    244: <PRE>
                    245: extern void HTRequest_setEncoding (HTRequest *request, HTList *enc, BOOL override);
                    246: extern HTList * HTRequest_encoding (HTRequest *request);
                    247: </PRE>
                    248: 
                    249: <H3>Content-Languages</H3>
                    250: 
                    251: The list of (human) language values acceptable in the response. The default
                    252: is all languages.
                    253: 
                    254: <PRE>
                    255: extern void HTRequest_setLanguage (HTRequest *request, HTList *lang, BOOL override);
                    256: extern HTList * HTRequest_language (HTRequest *request);
                    257: </PRE>
                    258: 
                    259: <H3>Charset</H3>
                    260: 
                    261: The list of charsets accepted by the application
                    262: 
                    263: <PRE>
                    264: extern void HTRequest_setCharset (HTRequest *request, HTList *charset, BOOL override);
                    265: extern HTList * HTRequest_charset (HTRequest *request);
                    266: </PRE>
                    267: 
                    268: <H2>Handling Metainformation (RFC822 Headers)</H2>
                    269: 
                    270: The Library supports a large set of headers that can be sent along
                    271: with a request (or a response for that matter). All headers can be
                    272: either disabled or enabled using bit flags that are defined in the
                    273: following.
                    274: 
                    275: <H3><A NAME="gnhd">General HTTP Header Mask</A></H3>
                    276: 
                    277: There are a few header fields which have general applicability for
                    278: both request and response mesages, but which do not apply to the
                    279: communication parties or theentity being transferred. This mask
                    280: enables and disables these headers. If the bit is not turned on they
                    281: are not sent. All headers are optional and the default value is <EM>NO
                    282: GENERAL HEADERS</EM>
                    283: 
                    284: <PRE>
                    285: typedef enum _HTGnHd {
2.16      frystyk   286:     HT_G_DATE          = 0x1,
                    287:     HT_G_FORWARDED     = 0x2,
                    288:     HT_G_MESSAGE_ID    = 0x4,
                    289:     HT_G_MIME          = 0x8,
                    290:     HT_G_CONNECTION    = 0x10,
                    291:     HT_G_NO_CACHE      = 0x20                                     /* Pragma */
2.1       frystyk   292: } HTGnHd;
                    293: 
2.16      frystyk   294: #define DEFAULT_GENERAL_HEADERS                HT_G_CONNECTION
2.1       frystyk   295: 
                    296: extern void HTRequest_setGnHd (HTRequest *request, HTGnHd gnhd);
                    297: extern void HTRequest_addGnHd (HTRequest *request, HTGnHd gnhd);
                    298: extern HTGnHd HTRequest_gnHd (HTRequest *request);
                    299: </PRE>
                    300: 
                    301: <H3><A NAME="rqhd">Request Headers</A></H3>
                    302: 
                    303: The request header fields allow the client to pass additional
                    304: information about the request (and about the client itself) to the
                    305: server. All headers are optional but the default value is all request
                    306: headers if present <EM>except</EM> <CODE>From</CODE> and
                    307: <CODE>Pragma</CODE>.
                    308: 
                    309: <PRE>
                    310: typedef enum _HTRqHd {
2.16      frystyk   311:     HT_C_ACCEPT_TYPE   = 0x1,
                    312:     HT_C_ACCEPT_CHAR   = 0x2,
                    313:     HT_C_ACCEPT_ENC    = 0x4,
                    314:     HT_C_ACCEPT_LAN    = 0x8,
                    315:     HT_C_FROM          = 0x10,
                    316:     HT_C_IMS           = 0x20,
                    317:     HT_C_HOST          = 0x40,
                    318:     HT_C_REFERER       = 0x80,
                    319:     HT_C_USER_AGENT    = 0x200
2.1       frystyk   320: } HTRqHd;
                    321: 
2.16      frystyk   322: #define DEFAULT_REQUEST_HEADERS        \
                    323:        HT_C_ACCEPT_TYPE+HT_C_ACCEPT_CHAR+ \
                    324:        HT_C_ACCEPT_ENC+HT_C_ACCEPT_LAN+HT_C_REFERER+HT_C_USER_AGENT
2.1       frystyk   325: 
                    326: extern void HTRequest_setRqHd (HTRequest *request, HTRqHd rqhd);
                    327: extern void HTRequest_addRqHd (HTRequest *request, HTRqHd rqhd);
                    328: extern HTRqHd HTRequest_rqHd (HTRequest *request);
                    329: </PRE>
                    330: 
2.16      frystyk   331: <H3><A NAME="rshd">Response Headers</A></H3>
                    332: 
                    333: The response header fields allow the server to pass additional
                    334: information about the response (and about the server itself) to the
                    335: client. All headers are optional.
                    336: 
                    337: <PRE>
                    338: typedef enum _HTRsHd {
                    339:     HT_S_LOCATION      = 0x1,
                    340:     HT_S_PROXY_AUTH    = 0x2,
                    341:     HT_S_PUBLIC        = 0x4,
                    342:     HT_S_RETRY_AFTER   = 0x8,
                    343:     HT_S_SERVER                = 0x10,
                    344:     HT_S_WWW_AUTH      = 0x20
                    345: } HTRsHd;
                    346: 
                    347: #define DEFAULT_RESPONSE_HEADERS HT_S_SERVER
                    348: 
                    349: extern void HTRequest_setRsHd (HTRequest * request, HTRsHd rshd);
                    350: extern void HTRequest_addRsHd (HTRequest * request, HTRsHd rshd);
2.17      frystyk   351: extern HTRsHd HTRequest_rsHd (HTRequest * request);
2.16      frystyk   352: </PRE>
                    353: 
2.1       frystyk   354: <H3><A NAME="enhd">Entity Header Mask</A></H3>
                    355: 
                    356: The entity headers contain information about the object sent in the
                    357: HTTP transaction. See the <A HREF="HTAnchor.html">Anchor module</A>,
                    358: for the storage of entity headers. This flag defines which headers are
                    359: to be sent in a request together with an entity body. All headers are
                    360: optional but the default value is <EM>ALL ENTITY HEADERS IF
                    361: PRESENT</EM>
                    362: 
                    363: <PRE>
                    364: typedef enum _HTEnHd {
2.16      frystyk   365:     HT_E_ALLOW         = 0x1,
                    366:     HT_E_CONTENT_ENCODING = 0x2,
                    367:     HT_E_CONTENT_LANGUAGE = 0x4,
                    368:     HT_E_CONTENT_LENGTH        = 0x8,
                    369:     HT_E_CTE           = 0x10,                 /* Content-Transfer-Encoding */
                    370:     HT_E_CONTENT_TYPE  = 0x20,
                    371:     HT_E_DERIVED_FROM  = 0x40,
                    372:     HT_E_EXPIRES       = 0x80,
                    373:     HT_E_LAST_MODIFIED = 0x200,
                    374:     HT_E_LINK          = 0x400,
                    375:     HT_E_TITLE         = 0x800,
                    376:     HT_E_URI           = 0x1000,
                    377:     HT_E_VERSION       = 0x2000
2.1       frystyk   378: } HTEnHd;
                    379: 
                    380: #define DEFAULT_ENTITY_HEADERS         0xFFFF                        /* all */
                    381: 
                    382: extern void HTRequest_setEnHd (HTRequest *request, HTEnHd enhd);
                    383: extern void HTRequest_addEnHd (HTRequest *request, HTEnHd enhd);
                    384: extern HTEnHd HTRequest_enHd (HTRequest *request);
                    385: </PRE>
                    386: 
                    387: <H3>Referer Field</H3>
                    388: 
                    389: If this parameter is set then a `Referer: &lt;parent address&gt; can
                    390: be generated in the request to the server, see <A
2.7       frystyk   391: HREF="http://www.w3.org/pub/WWW/Protocols/">Referer field in a HTTP
                    392: Request</A>
2.1       frystyk   393: 
                    394: <PRE>
                    395: extern void HTRequest_setParent (HTRequest *request, HTParentAnchor *parent);
                    396: extern HTParentAnchor * HTRequest_parent (HTRequest *request);
                    397: </PRE>
                    398: 
2.9       frystyk   399: <H3>Sending data to the Network</H3>
                    400: 
2.20      frystyk   401: The Library supports two ways of posting a data object to a remote
                    402: destination: Input comes from a socket descriptor or from memory. In
                    403: the case where you want to <EM>copy</EM> a URL, for example from local
                    404: file system <EM>or</EM> from a remote HTTP server then you must use
                    405: the <A HREF="../User/Architecture/PostWeb.html">POSTWeb
                    406: design</A>. This model operates by using at least two request objects
                    407: which gets linked to eachother as part of the POSTWeb model. However,
                    408: if you are posting from memory, we only use <EM>one</EM> request
                    409: object to perform the operation. In order to do this, the application
                    410: must register a callback function that can be called when the <A
                    411: HREF="HTTP.c">HTTP client module</A> is ready for accepting data.
                    412: 
2.9       frystyk   413: be included as part of the body and/or as extra metainformation. In
                    414: the latter case you need to register a callback function of the
                    415: following type using the methods provided in the next section.
                    416: 
                    417: <PRE>
2.21    ! frystyk   418: typedef int HTPostCallback (HTRequest * request, HTStream * target);
2.9       frystyk   419: </PRE>
                    420: 
2.1       frystyk   421: <H3>Extra Headers</H3>
                    422: 
                    423: Extra header information can be send along with a request using this
                    424: variable. The text is sent as is so it must be preformatted with
                    425: &lt;CRLF&gt; line terminators. This will get changed at some point so
                    426: that you can register a header together with a handler in the MIME
                    427: parser.
                    428: 
                    429: <PRE>
2.9       frystyk   430: extern void HTRequest_setGenerator (HTRequest *request, HTList *gens, BOOL override);
                    431: extern HTList * HTRequest_generator (HTRequest *request, BOOL *override);
                    432: 
                    433: extern void HTRequest_setParser (HTRequest *request, HTList *pars, BOOL override);
                    434: extern HTList * HTRequest_parser (HTRequest *request, BOOL *override);
2.1       frystyk   435: </PRE>
                    436: 
                    437: <H2>Streams From Network to Application</H2>
                    438: 
                    439: <H3>Default Output Stream</H3>
                    440: 
                    441: The output stream is to be used to put data down to as they come in
                    442: <B>from</B> the network and back to the application. The default value
                    443: is <CODE>NULL</CODE> which means that the stream goes to the user
                    444: (display).
                    445: 
                    446: <PRE>
                    447: extern void HTRequest_setOutputStream (HTRequest *request, HTStream *output);
2.6       frystyk   448: extern HTStream *HTRequest_outputStream (HTRequest *request);
2.1       frystyk   449: </PRE>
                    450: 
                    451: The desired format of the output stream. This can be used to get
                    452: unconverted data etc. from the library. If <CODE>NULL</CODE>, then <A
                    453: HREF="HTFormat.html#FormatTypes">WWW_PRESENT</A> is default value.
                    454: 
                    455: <PRE>
                    456: extern void HTRequest_setOutputFormat (HTRequest *request, HTFormat format);
2.6       frystyk   457: extern HTFormat HTRequest_outputFormat (HTRequest *request);
2.1       frystyk   458: </PRE>
                    459: 
                    460: <H3>Debug Stream</H3>
                    461: 
                    462: All object bodies sent from the server with status codes different
                    463: from <CODE>200 OK</CODE> will be put down this stream. This can be
                    464: used for redirecting body information in status codes different from
                    465: "200 OK" to for example a debug window. If the value is NULL (default)
                    466: then the stream is not set up.
                    467: 
                    468: <PRE>
                    469: extern void HTRequest_setDebugStream (HTRequest *request, HTStream *debug);
2.6       frystyk   470: extern HTStream *HTRequest_debugStream (HTRequest *request);
2.1       frystyk   471: </PRE>
                    472: 
                    473: The desired format of the error stream. This can be used to get
                    474: unconverted data etc. from the library. The default value if
                    475: <CODE>WWW_HTML</CODE> as a character based only has one WWW_PRESENT.
                    476: 
                    477: <PRE>
                    478: extern void HTRequest_setDebugFormat (HTRequest *request, HTFormat format);
2.6       frystyk   479: extern HTFormat HTRequest_debugFormat (HTRequest *request);
2.1       frystyk   480: </PRE>
                    481: 
                    482: <H2><A NAME="context">Context Swapping</A></H2>
                    483: 
                    484: In multi threaded applications it is often required to keep track of
                    485: the context of a request so that when the Library returns a result of
                    486: a request, it can be put into the context it was in before the request
                    487: was first passed to the Library. This call back function allows the
                    488: application to do this.
                    489: 
                    490: <PRE>
                    491: typedef int HTRequestCallback (HTRequest * request, void *param);
                    492: 
                    493: extern void HTRequest_setCallback (HTRequest *request, HTRequestCallback *cb);
                    494: extern HTRequestCallback *HTRequest_callback (HTRequest *request);
                    495: </PRE>
                    496: 
                    497: The callback function can be passed an arbitrary pointer (the void
                    498: part) which can describe the context of the current request
                    499: structure. If such context information is required then it can be set
                    500: using the following methods:
                    501: 
                    502: <PRE>
                    503: extern void HTRequest_setContext (HTRequest *request, void *context);
                    504: extern void *HTRequest_context (HTRequest *request);
2.20      frystyk   505: </PRE>
                    506: 
                    507: <A NAME="proxying"><H2>Using a proxy server</H2></A>
                    508: 
                    509: As a HTTP request looks different when it is directed to a proxy
                    510: server than to a origin server, we need to know whether we are using a
                    511: proxy for this particular request or not. These two methods can be
                    512: used to set and check the current state whether we are going to a
                    513: proxy or not.
                    514: 
                    515: <PRE>
                    516: extern void HTRequest_setProxying (HTRequest * request, BOOL proxying);
                    517: extern BOOL HTRequest_proxying (HTRequest * request);
2.1       frystyk   518: </PRE>
                    519: 
2.18      frystyk   520: <H2>Preemptive or Non-preemptive Access</H2>
2.1       frystyk   521: 
2.18      frystyk   522: A access scheme is defined with a default for using either preemptive
2.1       frystyk   523: (blocking I/O) or non-premitve (non-blocking I/O). This is basically a
                    524: result of the implementation of the protocol module itself. However,
                    525: if non-blocking I/O is the default then some times it is nice to be
                    526: able to set the mode to blocking instead. For example when loading the
                    527: first document (the home page) then blocking can be used instead of
                    528: non-blocking.
                    529: 
                    530: <PRE>
2.18      frystyk   531: extern void HTRequest_setPreemptive (HTRequest *request, BOOL mode);
                    532: extern BOOL HTRequest_preemptive (HTRequest *request);
2.1       frystyk   533: </PRE>
                    534: 
2.9       frystyk   535: <H2>Priority Management</H2>
                    536: 
                    537: The request can be assigned an initial priority which then gets
                    538: inherited by all HTNet objects and other requests objects created as a
                    539: result of this one. You can also assign a separate priority to an
2.14      frystyk   540: indicidual HTNet object by using the methods in the <A
2.9       frystyk   541: HREF="HTNet.html">Net manager</A>.
                    542: 
                    543: <PRE>
                    544: extern HTPriority HTRequest_priority (HTRequest * request);
                    545: extern BOOL HTRequest_setPriority (HTRequest * request, HTPriority priority);
2.14      frystyk   546: </PRE>
                    547: 
                    548: <H2>Get an set the HTNet Object</H2>
                    549: 
                    550: If a request is actually going on the net then the <A
                    551: HREF="HTNet.html">Net MAnager</A> is contacted to handle the
                    552: request. The Net manager creates a HTNEt object and links it to the
                    553: Request object. You can get to the HTNet object using the following
                    554: functions.
                    555: 
                    556: <PRE>
                    557: extern HTNet * HTRequest_net (HTRequest * request);
                    558: extern BOOL HTRequest_setNet (HTRequest * request, HTNet * net);
2.9       frystyk   559: </PRE>
                    560: 
2.1       frystyk   561: <H2>Format Negotiation</H2>
                    562: 
                    563: When accessing the local file system, the Library is capable of
                    564: performing content negotioation as described by the HTTP
                    565: protocol. This is mainly for server applications, but some client
                    566: applications might also want to use content negotiation when accessing
                    567: the local file system. This method enables or disables content
                    568: negotiation - the default value is <EM>ON</EM>.
                    569: 
                    570: <PRE>
                    571: extern void HTRequest_setNegotiation (HTRequest *request, BOOL mode);
                    572: extern BOOL HTRequest_negotiation (HTRequest *request);
                    573: </PRE>
                    574: 
2.10      frystyk   575: <H2>Error Manager</H2>
2.1       frystyk   576: 
2.10      frystyk   577: Errors are like almost anything kept in lists and a error list can be
                    578: associated with a request using the following functions. In order to
                    579: make life easier, there are also some easy mapping functions to the
                    580: real HTError module, so that you can add an error directly to a
                    581: request object.
2.1       frystyk   582: 
                    583: <PRE>
2.10      frystyk   584: extern HTList * HTRequest_error (HTRequest * request);
                    585: extern void HTRequest_setError (HTRequest * request, HTList * list);
                    586: </PRE>
                    587: 
                    588: These are the cover functions that go directly to the <A
                    589: HREF="HTError.html">Error manager</A>
                    590: 
                    591: <PRE>
                    592: extern BOOL HTRequest_addError (HTRequest *    request,
                    593:                                HTSeverity      severity,
                    594:                                BOOL            ignore,
                    595:                                int             element,
                    596:                                void *          par,
                    597:                                unsigned int    length,
                    598:                                char *          where);
                    599: 
                    600: extern BOOL HTRequest_addSystemError (HTRequest *      request,
                    601:                                      HTSeverity        severity,
                    602:                                      int               errornumber,
                    603:                                      BOOL              ignore,
                    604:                                      char *            syscall);
2.1       frystyk   605: </PRE>
                    606: 
2.19      frystyk   607: <H2>Bytes Read or Written in a Request</H2>
2.1       frystyk   608: 
                    609: This function returns the bytes read in the current request. For a
                    610: deeper description of what the current request is, please read the
                    611: user's guide. This function can be used in for example the <A
                    612: HREF="HTAlert.html">HTAlert module</A> to give the number of bytes
2.19      frystyk   613: read or written in a progress message.
2.1       frystyk   614: 
                    615: <PRE>
2.19      frystyk   616: extern long HTRequest_bytesRead (HTRequest * request);
                    617: extern long HTRequest_bytesWritten (HTRequest * request);
2.1       frystyk   618: </PRE>
                    619: 
                    620: <H2>Kill a Request</H2>
                    621: 
2.9       frystyk   622: This function kills this particular request, see <A
                    623: HREF="HTNet.html">HTNet module</A> for a function that kills them all.
2.1       frystyk   624: 
                    625: <PRE>
2.2       frystyk   626: extern BOOL HTRequest_kill(HTRequest * request);
2.1       frystyk   627: </PRE>
                    628: 
                    629: <PRE>
                    630: #endif /* HTREQ_H */
                    631: </PRE>
                    632: End of declaration
                    633: </BODY>
                    634: </HTML>

Webmaster