Annotation of libwww/Library/src/HTReqMan.html, revision 2.48

2.47      kirschpi    1: <HTML>
                      2: <HEAD>
2.32      frystyk     3:   <!-- Changed by: Henrik Frystyk Nielsen, 15-Jul-1996 -->
2.47      kirschpi    4:   <TITLE>W3C Sample Code Library libwww Private Request Definition</TITLE>
                      5: </HEAD>
                      6: <BODY>
                      7: <H1>
                      8:   Private Request Definition
                      9: </H1>
                     10: <PRE>
                     11: /*
2.1       frystyk    12: **     (c) COPYRIGHT MIT 1995.
                     13: **     Please first read the full copyright statement in the file COPYRIGH.
2.47      kirschpi   14: */
                     15: </PRE>
                     16: <P>
                     17: This module is the private part of the request object. It has the functions
                     18: declarations that are private to the Library and that shouldn't be used by
                     19: applications. The module has been separated from the old HTAccess module.
                     20: See also the public part of the declarition in the <A HREF="HTReq.html">HTReq
                     21: Module</A>.
                     22: <P>
                     23: This module is implemented by <A HREF="HTReqMan.c">HTReqMan.c</A>, and it
                     24: is a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
                     25: Library</A>.
                     26: <PRE>
                     27: #ifndef HTREQMAN_H
2.1       frystyk    28: #define HTREQMAN_H
                     29: 
2.47      kirschpi   30: #include "<A HREF="HTReq.html">HTReq.h</A>"
                     31: #include "<A HREF="HTList.html">HTList.h</A>"
                     32: #include "<A HREF="HTFormat.html">HTFormat.h</A>"
                     33: #include "<A HREF="HTAnchor.html">HTAnchor.h</A>"
                     34: #include "<A HREF="HTMethod.html">HTMethod.h</A>"
                     35: #include "<A HREF="HTAABrow.html">HTAABrow.h</A>"
                     36: #include "<A HREF="HTStream.html">HTStream.h</A>"
                     37: #include "<A HREF="HTNet.html">HTNet.h</A>"
                     38: #include "<A HREF="HTMIMPrs.html">HTMIMPrs.h</A>"
2.48    ! vbancrof   39: 
        !            40: #ifdef __cplusplus
        !            41: extern "C" { 
        !            42: #endif 
2.47      kirschpi   43: </PRE>
                     44: <P>
                     45: When a request is handled, all kinds of things about it need to be passed
2.23      frystyk    46: along together with a request. It is intended to live as long as the request
                     47: is still active, but can be deleted as soon as it has terminated. Only the
2.47      kirschpi   48: anchor object stays around after the request itself is terminated.
                     49: <PRE>
                     50: struct _HTRequest {
2.14      frystyk    51: 
                     52:     BOOL               internal;      /* Does the app knows about this one? */
                     53: 
2.33      frystyk    54:     time_t             date;      /* Time stamp when the request was issued */
                     55: 
2.1       frystyk    56:     HTMethod           method;
                     57: 
2.36      frystyk    58:     BOOL                flush;                /* Should we flush immediately */
                     59: 
2.47      kirschpi   60:     HTPriority         priority;               /* Priority for this request */
                     61: </PRE>
                     62: <H3>
                     63: Message body
                     64: </H3>
                     65: <P>
                     66: A request message body indicated for XML bodies. It is used for extension
                     67: methods. See <A HREF="HTReq.html">HTReq.html</A> for details.
                     68: <PRE>
                     69: #ifdef HT_EXT
2.46      kirschpi   70:     char *             messageBody;
                     71:     long int           messageBodyLength;
                     72:     HTFormat           messageBodyFormat;
2.47      kirschpi   73: #endif
                     74: </PRE>
                     75: <H3>
                     76:   User Profile
                     77: </H3>
                     78: <P>
                     79: Each request can be assigned a <A HREF="HTUser.html">user profile</A> containing
                     80: information about this host and the user issuing the request.
                     81: <PRE>
                     82:     HTUserProfile *    userprofile;
                     83: </PRE>
                     84: <H3>
                     85:   Net Object
                     86: </H3>
                     87: <P>
                     88: Each request is assigned a Net object which contains pointers to other objects
                     89: handling the request.
                     90: <PRE>
                     91:     HTNet *            net;                /* Information about socket etc. */
                     92: </PRE>
                     93: <H3>
                     94:   Response Object
                     95: </H3>
                     96: <P>
                     97: When we start getting MIME headers in as a response we keep it in this object
                     98: until we know what to do with it.
                     99: <PRE>
                    100:     HTResponse *        response;
                    101: </PRE>
                    102: <H3>
                    103:   Error Manager
                    104: </H3>
                    105: <PRE>
                    106:     HTList *           error_stack;                       /* List of errors */
                    107: </PRE>
                    108: <H3>
                    109:   Have many times do We Want to Try?
                    110: </H3>
                    111: <PRE>
                    112:     int                        retrys;               /* Number of automatic reloads */
2.35      frystyk   113:     int                 max_forwards;
2.41      kahan     114:     int                        AAretrys;             /* Number of authentication
2.47      kirschpi  115:                                                  retries */
                    116: </PRE>
                    117: <H3>
                    118:   Preemptive or Non-Preemptive load?
                    119: </H3>
                    120: <P>
                    121: Each protocol module is registered with a default behavior but if you have
                    122: registered a protocol module for non-preemtive load you can override this
                    123: by using the following flag.
                    124: <PRE>
                    125:     BOOL               preemptive;
                    126: </PRE>
                    127: <H3>
                    128:   Content Negotiation
                    129: </H3>
                    130: <P>
                    131: Normally, when we access the local file system we do content negotiation
2.42      frystyk   132: in order to find the most suited representation. However, you can turn this
2.47      kirschpi  133: off by using the following flag.
                    134: <PRE>
                    135:     BOOL               ContentNegotiation;
                    136: </PRE>
                    137: <H3>
                    138:   Should we use preconditions?
                    139: </H3>
                    140: <PRE>
                    141:     HTPreconditions     preconditions;
                    142: </PRE>
                    143: <H3>
                    144:   Headers and header information
                    145: </H3>
                    146: <P>
                    147: These are the masks that decides what headers to send.
                    148: <PRE>
                    149:     HTGnHd             GenMask;
2.35      frystyk   150:     HTRsHd             ResponseMask;
                    151:     HTRqHd             RequestMask;
2.47      kirschpi  152:     HTEnHd             EntityMask;
                    153: </PRE>
                    154: <H3>
                    155:   Local MIME Header Parsers
                    156: </H3>
                    157: <P>
                    158: Each request can be assigned its own MIME header parsers.
                    159: <PRE>
                    160:     HTMIMEParseSet *   parseSet;
                    161:     BOOL               pars_local;
                    162: </PRE>
                    163: <H3>
                    164:   Accept headers
                    165: </H3>
                    166: <P>
                    167: These are the accept headers that we want to send out.
                    168: <PRE>
                    169:     HTList *           conversions;
2.1       frystyk   170:     BOOL               conv_local;
                    171: 
                    172:     HTList *           encodings;
                    173:     BOOL               enc_local;
                    174: 
2.38      frystyk   175:     HTList *           tes;
                    176:     BOOL               te_local;
2.21      frystyk   177: 
2.1       frystyk   178:     HTList *           languages;
                    179:     BOOL               lang_local;
                    180: 
                    181:     HTList *           charsets;
                    182:     BOOL               char_local;
2.20      hallam    183: 
                    184:     HTList *           befores;
                    185:     BOOL               befores_local;
                    186: 
                    187:     HTList *           afters;
2.47      kirschpi  188:     BOOL               afters_local;
                    189: </PRE>
                    190: <H3>
                    191:   Are we using a Proxy?
                    192: </H3>
                    193: <P>
                    194: If so then we keep the name in this variable
                    195: <PRE>
                    196:     char *             proxy;
                    197:     BOOL                full_uri;
                    198: </PRE>
                    199: <H3>
                    200:   Cache Control Directives
                    201: </H3>
                    202: <P>
                    203: This association list is a list of the cache control directives that are
                    204: to be sent as part of the <CODE>Cache-Control</CODE> header.
                    205: <PRE>
                    206:     HTReload           reload;
                    207:     HTAssocList *       cache_control;
                    208: </PRE>
                    209: <H3>
                    210:   Default PUT name
                    211: </H3>
                    212: <P>
                    213: Stores the default name when publishing to a "/" URL.
                    214: <PRE>
                    215:    char *               default_put_name;
                    216: </PRE>
                    217: <H3>
                    218:   Byte Ranges
                    219: </H3>
                    220: <P>
                    221: This association list is a list of the cache control directives that are
                    222: to be sent as part of the <CODE>Range</CODE> header.
                    223: <PRE>
                    224:     HTAssocList *       byte_ranges;
                    225: </PRE>
                    226: <H3>
                    227:   Connection Control Directives
                    228: </H3>
                    229: <P>
                    230: This association list is a list of the connection control directives that
                    231: are to be sent as part of the <CODE>Connection</CODE> header.
                    232: <PRE>
                    233:     HTAssocList *       connection;
                    234: </PRE>
                    235: <H3>
                    236:   Expect Directives
                    237: </H3>
                    238: <P>
                    239: The Expect request-header field is used to indicate that particular server
                    240: behaviors are required by the client. A server that does not understand or
                    241: is unable to comply with any of the expectation values in the Expect field
                    242: of a request MUST respond with appropriate error status.
                    243: <PRE>
                    244:     HTAssocList *       expect;
                    245: </PRE>
                    246: <H3>
                    247:   Access Authentication Information
                    248: </H3>
                    249: <P>
                    250: The <CODE>credentials</CODE> list contains the information that we are to
                    251: send as part of the <CODE>Authorization</CODE> header. The realm is if we
                    252: already know that we need to generate credentials for a specific realm.
                    253: <PRE>
                    254:     char *             realm;                              /* Current realm */
                    255:     HTAssocList *      credentials;       /* Credentials received by server */
                    256: </PRE>
                    257: <H3>
                    258:   Request Header Extensibility
                    259: </H3>
                    260: <P>
                    261:   <HR>
                    262: <H4>
                    263:   1) Simple Association List
                    264: </H4>
                    265: <P>
                    266: Add the (name, value) and it will be converted into MIME header format as
                    267: <CODE>name: value</CODE>. DO NOT ADD CRLF line termination - this is done
                    268: by the <A HREF="HTTPReq.html">HTTP header generator stream</A>
                    269: <PRE>
                    270:     HTAssocList        *       extra_headers;
                    271: </PRE>
                    272: <H4>
                    273:   2) Stream Oriented Header Generators
                    274: </H4>
                    275: <P>
                    276: A generator is a stream with direct access to the output stream
                    277: <PRE>
                    278:     HTList *           generators;
                    279:     BOOL               gens_local;
                    280: </PRE>
                    281: <H4>
                    282:   4) HTTP Extension Framework
                    283: </H4>
                    284: <P>
                    285: These association lists contain the information that we are to send as
                    286: <A HREF="/Protocols/HTTP/ietf-http-ext/">HTTP Extension Framework</A>.
                    287: <PRE>
                    288:     HTAssocList *      mandatory;
                    289:     HTAssocList *      optional;
                    290: </PRE>
                    291: <H3>
                    292:   Anchors
                    293: </H3>
                    294: <PRE>
                    295:     HTParentAnchor *   anchor;        /* The Client anchor for this request */
2.10      frystyk   296: 
2.1       frystyk   297:     HTChildAnchor *    childAnchor;        /* For element within the object */
2.47      kirschpi  298:     HTParentAnchor *   parentAnchor;                   /* For referer field */
                    299: </PRE>
                    300: <H3>
                    301:   Streams From Network to Application
                    302: </H3>
                    303: <PRE>
                    304:     HTStream *         output_stream; 
2.43      frystyk   305:     HTStream *         orig_output_stream; 
2.1       frystyk   306:     HTFormat           output_format;
2.26      frystyk   307:     BOOL               connected;
2.1       frystyk   308: 
2.43      frystyk   309:     HTStream *         debug_stream;
                    310:     HTStream *         orig_debug_stream;
2.47      kirschpi  311:     HTFormat           debug_format;
                    312: </PRE>
                    313: <H3>
                    314:   Streams From Application to Network
                    315: </H3>
                    316: <PRE>
                    317:     HTStream *         input_stream; 
                    318:     HTFormat           input_format;
                    319: </PRE>
                    320: <H3>
                    321:   Callback Function for getting data down the Input Stream
                    322: </H3>
                    323: <PRE>
                    324:     HTPostCallback *   PostCallback;
                    325: </PRE>
                    326: <H3>
                    327:   Context Swapping
                    328: </H3>
                    329: <PRE>
                    330:     HTRequestCallback *        callback;
                    331:     void *             context;
                    332: </PRE>
                    333: <H3>
                    334:   PostWeb Information (Not used anymore - don't use!)
                    335: </H3>
                    336: <PRE>
                    337:     HTRequest *                source;              /* Source for request or itself */
2.16      frystyk   338:     HTParentAnchor *   source_anchor;            /* Source anchor or itself */
                    339: 
2.1       frystyk   340:     HTRequest *                mainDestination;             /* For the typical case */
                    341:     HTList *           destinations;            /* List of related requests */
                    342:     int                        destRequests;      /* Number of destination requests */
2.47      kirschpi  343:     int                        destStreams;        /* Number of destination streams */
                    344: </PRE>
                    345: <PRE>
                    346: };
                    347: </PRE>
                    348: <H2>
                    349:   Post Web Management
                    350: </H2>
                    351: <P>
                    352: These functions are mainly used internally in the Library but there is no
                    353: reason for them not to be public.
                    354: <PRE>
                    355: extern BOOL HTRequest_addDestination (HTRequest * src, HTRequest * dest);
2.1       frystyk   356: extern BOOL HTRequest_removeDestination        (HTRequest * dest);
2.14      frystyk   357: extern BOOL HTRequest_destinationsReady (HTRequest * me);
2.1       frystyk   358: 
                    359: extern BOOL HTRequest_linkDestination (HTRequest * dest);
                    360: extern BOOL HTRequest_unlinkDestination (HTRequest * dest);
                    361: 
                    362: extern BOOL HTRequest_removePostWeb (HTRequest * me);
                    363: extern BOOL HTRequest_killPostWeb (HTRequest * me);
                    364: 
                    365: #define        HTRequest_mainDestination(me) \
2.23      frystyk   366:        ((me) &amp;&amp; (me)-&gt;source ? (me)-&gt;source-&gt;mainDestination : NULL)
2.1       frystyk   367: #define HTRequest_isDestination(me) \
2.23      frystyk   368:        ((me) &amp;&amp; (me)-&gt;source &amp;&amp; (me) != (me)-&gt;source)
2.1       frystyk   369: #define HTRequest_isMainDestination(me) \
2.23      frystyk   370:        ((me) &amp;&amp; (me)-&gt;source &amp;&amp; \
                    371:        (me) == (me)-&gt;source-&gt;mainDestination)
2.1       frystyk   372: #define HTRequest_isSource(me) \
2.47      kirschpi  373:        ((me) &amp;&amp; (me)-&gt;source &amp;&amp; (me) == (me)-&gt;source)
                    374: </PRE>
                    375: <P>
                    376: End of Declaration
                    377: <PRE>
2.48    ! vbancrof  378: #ifdef __cplusplus
        !           379: }
        !           380: #endif
        !           381: 
2.47      kirschpi  382: #endif /* HTREQMAN_H */
                    383: </PRE>
                    384: <P>
                    385:   <HR>
                    386: <ADDRESS>
2.48    ! vbancrof  387:   @(#) $Id: HTReqMan.html,v 2.47 2002/06/04 15:14:11 kirschpi Exp $
2.47      kirschpi  388: </ADDRESS>
                    389: </BODY></HTML>

Webmaster