Annotation of libwww/Library/src/HTAccess.html, revision 2.36

2.9       timbl       1: <HTML>
                      2: <HEAD>
2.6       timbl       3: <TITLE>HTAccess:  Access manager  for libwww</TITLE>
2.19      timbl       4: <NEXTID N="z11">
2.9       timbl       5: </HEAD>
2.5       timbl       6: <BODY>
2.33      frystyk     7: <H1>Access Manager</H1>
                      8: This module keeps a list of valid
2.5       timbl       9: protocol (naming scheme) specifiers
                     10: with associated access code.  It
                     11: allows documents to be loaded given
                     12: various combinations of parameters.
                     13: New access protocols may be registered
                     14: at any time.<P>
2.33      frystyk    15: 
                     16: <B>Note:</B> HTRequest defined and request parameter added to almost all calls
2.9       timbl      17: 18 Nov 1993.<P>
2.33      frystyk    18: 
                     19: This document is a part of the <A NAME="z0" HREF="Overview.html">
                     20: libwww library</A>. The code is implemented in <A NAME="z8" HREF="HTAccess.c">
                     21: HTAcces.c</A>
                     22: 
                     23: <PRE>
                     24: #ifndef HTACCESS_H
1.1       timbl      25: #define HTACCESS_H
2.16      luotonen   26: #include "HTList.h"
2.35      frystyk    27: </PRE>
1.1       timbl      28: 
2.35      frystyk    29: <B>Short Names</B>
                     30: <PRE>
1.1       timbl      31: #ifdef SHORT_NAMES
2.8       timbl      32: #define HTClientHost           HTClHost
                     33: #define HTSearchAbsolute       HTSeAbso
                     34: #define HTOutputStream         HTOuStre
                     35: #define HTOutputFormat         HTOuForm
1.1       timbl      36: #endif
2.33      frystyk    37: </PRE>
1.1       timbl      38: 
2.36    ! frystyk    39: <H2>Flags which may be set to control this module</H2>
        !            40: 
        !            41: <PRE>
        !            42: extern char * HTSaveLocallyDir;                /* Dir home for "save locally" files */
        !            43: extern char * HTCacheDir;              /* Cache dir, default NULL: no cache */
        !            44: extern char * HTClientHost;            /* Name or number of telnetting host */
        !            45: extern FILE * HTlogfile;               /* File to output one-liners to */
        !            46: extern BOOL HTSecure;                  /* Disable security holes? */
        !            47: extern char * HTImServer;              /* If I'm cern_httpd */
        !            48: extern BOOL HTImProxy;                 /* If I'm cern_httpd as a proxy */
        !            49: extern BOOL HTForceReload;             /* Force reload from cache or net */
        !            50: </PRE>
        !            51: 
2.35      frystyk    52: <H2>Method Management</H2>
2.33      frystyk    53: 
                     54: Thesse are the valid methods, see <A HREF="http://info.cern.ch/hypertext/WWW/Protocols/HTTP/Methods.html">HTTP Methods</A>
                     55: 
                     56: <PRE>
2.16      luotonen   57: typedef enum {
                     58:        METHOD_INVALID  = 0,
                     59:        METHOD_GET      = 1,
                     60:        METHOD_HEAD,
                     61:        METHOD_POST,
                     62:        METHOD_PUT,
                     63:        METHOD_DELETE,
                     64:        METHOD_CHECKOUT,
                     65:        METHOD_CHECKIN,
                     66:        METHOD_SHOWMETHOD,
                     67:        METHOD_LINK,
                     68:        METHOD_UNLINK,
                     69:        MAX_METHODS
                     70: } HTMethod;
2.33      frystyk    71: </PRE>
                     72: 
                     73: <H3>Get Method Enumeration</H3>
2.16      luotonen   74: 
2.33      frystyk    75: Gives the enumeration value of the method as a function of the (char *) name.
2.16      luotonen   76: 
2.33      frystyk    77: <PRE>
                     78: PUBLIC HTMethod HTMethod_enum PARAMS((char * name));
2.16      luotonen   79: </PRE>
                     80: 
2.33      frystyk    81: <H3>Get Method String</H3>
2.16      luotonen   82: 
2.33      frystyk    83: The reverse of <I>HTMethod_enum()</I>
2.16      luotonen   84: 
2.33      frystyk    85: <PRE>
2.16      luotonen   86: PUBLIC char * HTMethod_name PARAMS((HTMethod method));
2.33      frystyk    87: </PRE>
                     88: 
                     89: <H3>Valid Methods</H3>
2.16      luotonen   90: 
2.33      frystyk    91: This functions searches the list of valid methods for a given anchor, see
                     92: <A HREF="HTAnchor.html">HTAnchor module</A> If the method is found it returns
                     93: YES else NO.
2.16      luotonen   94: 
2.33      frystyk    95: <PRE>
2.16      luotonen   96: PUBLIC BOOL HTMethod_inList PARAMS((HTMethod   method,
                     97:                                    HTList *    list));
                     98: </PRE>
2.33      frystyk    99: 
2.35      frystyk   100: <HR>
                    101: <EM>This section might be move to the Access Authentication Module</EM>
                    102: 
2.36    ! frystyk   103: <H4>Match Template Against Filename</H4>
2.16      luotonen  104: <PRE>
                    105: /* PUBLIC                                              HTAA_templateMatch()
                    106: **             STRING COMPARISON FUNCTION FOR FILE NAMES
                    107: **                WITH ONE WILDCARD * IN THE TEMPLATE
                    108: ** NOTE:
                    109: **     This is essentially the same code as in HTRules.c, but it
                    110: **     cannot be used because it is embedded in between other code.
                    111: **     (In fact, HTRules.c should use this routine, but then this
                    112: **      routine would have to be more sophisticated... why is life
                    113: **      sometimes so hard...)
                    114: **
                    115: ** ON ENTRY:
                    116: **     template        is a template string to match the file name
                    117: **                     agaist, may contain a single wildcard
                    118: **                     character * which matches zero or more
                    119: **                     arbitrary characters.
                    120: **     filename        is the filename (or pathname) to be matched
                    121: **                     agaist the template.
                    122: **
                    123: ** ON EXIT:
                    124: **     returns         YES, if filename matches the template.
                    125: **                     NO, otherwise.
                    126: */
                    127: PUBLIC BOOL HTAA_templateMatch PARAMS((CONST char * template, 
                    128:                                       CONST char * filename));
2.35      frystyk   129: </PRE>
2.16      luotonen  130: 
2.35      frystyk   131: <HR>
2.16      luotonen  132: 
2.35      frystyk   133: The following have to be defined
2.10      timbl     134: in advance of the other include files
                    135: because of circular references.
2.33      frystyk   136: <PRE>
                    137: typedef struct _HTRequest HTRequest;
2.10      timbl     138: 
2.14      luotonen  139: /*
                    140: ** Callback to call when username and password
                    141: ** have been prompted.
                    142: */
                    143: typedef int (*HTRetryCallbackType) PARAMS((HTRequest * req));
                    144: 
                    145: 
2.10      timbl     146: #include "HTAnchor.h"
                    147: #include <A
                    148: NAME="z3" HREF="HTFormat.html">"HTFormat.h"</A>
2.15      luotonen  149: #include "HTAAUtil.h"          /* HTAAScheme, HTAAFailReason */
2.14      luotonen  150: #include "HTAABrow.h"          /* HTAASetup */
2.33      frystyk   151: </PRE>
2.10      timbl     152: 
2.35      frystyk   153: <H2>Default WWW Addresses</H2>
2.10      timbl     154: 
2.33      frystyk   155: These control the home page selection. To mess with these for normal browses
2.6       timbl     156: is asking for user confusion.
2.33      frystyk   157: <PRE>
                    158: #define LOGICAL_DEFAULT "WWW_HOME"           /* Defined to be the home page */
1.1       timbl     159: 
2.6       timbl     160: #ifndef PERSONAL_DEFAULT
2.33      frystyk   161: #define PERSONAL_DEFAULT "WWW/default.html"            /* in home directory */
2.6       timbl     162: #endif
2.33      frystyk   163: 
2.6       timbl     164: #ifndef LOCAL_DEFAULT_FILE
1.1       timbl     165: #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
2.6       timbl     166: #endif
2.33      frystyk   167: 
                    168: /* If one telnets to an access point it will look in this file for home page */
2.7       timbl     169: #ifndef REMOTE_POINTER
2.33      frystyk   170: #define REMOTE_POINTER  "/etc/www-remote.url"              /* can't be file */
2.7       timbl     171: #endif
2.33      frystyk   172: 
2.7       timbl     173: /* and if that fails it will use this. */
2.6       timbl     174: #ifndef REMOTE_ADDRESS
2.33      frystyk   175: #define REMOTE_ADDRESS  "http://info.cern.ch/remote.html"   /* can't be file */
1.1       timbl     176: #endif
                    177: 
2.33      frystyk   178: /* If run from telnet daemon and no -l specified, use this file: */
1.1       timbl     179: #ifndef DEFAULT_LOGFILE
                    180: #define DEFAULT_LOGFILE        "/usr/adm/www-log/www-log"
                    181: #endif
                    182: 
2.33      frystyk   183: /* If the home page isn't found, use this file: */
1.1       timbl     184: #ifndef LAST_RESORT
2.6       timbl     185: #define LAST_RESORT    "http://info.cern.ch/default.html"
1.1       timbl     186: #endif
                    187: 
2.33      frystyk   188: /* This is the default cache directory: */
2.23      frystyk   189: #ifndef CACHE_HOME_DIR
                    190: #define CACHE_HOME_DIR         "/tmp/"
                    191: #endif
                    192: 
2.33      frystyk   193: /* The default directory for "save locally" and "save and execute" files: */
2.23      frystyk   194: #ifndef SAVE_LOCALLY_HOME_DIR
                    195: #define SAVE_LOCALLY_HOME_DIR  "/tmp/"
                    196: #endif
2.33      frystyk   197: </PRE>
2.10      timbl     198: 
2.34      frystyk   199: <H2><A NAME="HTNetInfo">Protocol Specific Information</A></H2>
                    200: 
                    201: This structure contains information about socket number, input buffer for
                    202: reading from the network etc. The structure is used through out the protocol
                    203: modules and is the refenrence point for introducing multi threaded execution
2.35      frystyk   204: into the library, see specifications on <A HREF="http://info.cern.ch/hypertext/WWW/Library/User/Multithread/multithread.html">Multiple Threads</A>.
2.34      frystyk   205: 
                    206: <PRE>
                    207: typedef struct _HTNetInfo {
2.36    ! frystyk   208:     int                        sockfd;                         /* Socket descriptor */
        !           209:     HTInputSocket *    isoc;                                /* Input buffer */
        !           210:     int                addressCount;        /* Attempts if multi-homed host */
        !           211:     BOOL               CRLFdotCRLF;  /* Does the transmission end like this */
        !           212:     struct _HTRequest *        request;           /* Link back to request structure */
2.34      frystyk   213: } HTNetInfo;
                    214: </PRE>
                    215: 
2.36    ! frystyk   216: <EM><B>Note:</B> The AddressCount varaible is used to count the number
        !           217: of attempt to connect to a multi-homed host so we know when to stop
        !           218: trying new IP-addresses.</EM>
        !           219: 
2.9       timbl     220: <H2><A
                    221: NAME="z1">The Request structure</A></H2>When a request is handled, all kinds
                    222: of things about it need to be passed
                    223: along.  These are all put into a
2.31      frystyk   224: HTRequest structure. <P>
                    225: 
2.35      frystyk   226: <B>Note 1:</B> There is also a <A NAME="z4" HREF="HTFormat.html#z17">global list of converters</A> <P>
                    227: <B>Note 2:</B> If you reuse the request structure for more than one
2.33      frystyk   228: request then make sure that the request is re-initialized, so that no `old'
                    229: data is reused, see <A HREF="#z100">functions to manipulate HTRequest
                    230: Structure</A>. The library handles its own internal information from request
                    231: to request but the information set by the caller is untouched.
2.31      frystyk   232: 
2.10      timbl     233: <PRE>struct _HTRequest {
2.19      timbl     234: 
                    235: </PRE>The elements of the request structure
                    236: are as follows.
                    237: <H3>Set by the caller of HTaccess:</H3>
                    238: <H4>Conditions of the request itself:</H4>
                    239: <PRE>  HTMethod        method;
                    240: 
                    241: </PRE>An atom for the name of the operation
                    242: using HTTP <A
                    243: NAME="z7" HREF="../../Protocols/HTTP/Methods.html">method names</A> .
                    244: <PRE>  HTList *        conversions ;
2.20      frystyk   245: </PRE>NULL, or a list of conversions which
2.19      timbl     246: the format manager can do in order
                    247: to fulfill the request.  This is
                    248: set by the caller of HTAccess. Typically
                    249: points to a list set up an initialisation
                    250: time for example by HTInit.
                    251: <PRE>  HTList *        encodings;      /* allowed content-encodings      */
                    252: 
                    253: </PRE>The list of encodings acceptablein
                    254: the output stream.
                    255: <PRE>  HTList *        languages;      /* accepted content-languages     */
                    256: 
                    257: </PRE>The list of (human) language values
                    258: acceptable in the response
                    259: <PRE>  BOOL (*<A
2.20      frystyk   260: NAME="z9"> callback</A> ) PARAMS((
2.9       timbl     261:                                struct _HTRequest* request,
                    262:                                void *param));
2.19      timbl     263: 
                    264: </PRE>A function to be called back in the
                    265: event that a file has been saved
                    266: to disk by HTSaveAndCallBack for
                    267: example.
                    268: <PRE>  void *          context;        /* caller data -- HTAccess unaware */
                    269: 
                    270: </PRE>An arbitrary pointer passed to HTAccess
                    271: and passed back as a parameter to
                    272: the <A
2.20      frystyk   273: NAME="z10" HREF="#z9">callback</A> .
2.19      timbl     274: <PRE>  HTStream*       output_stream; 
                    275: 
                    276: </PRE>NULL in the case of display to the
                    277: user, or if a specific output stream
                    278: is required, the stream.
                    279: <PRE>  HTAtom *        output_format;
                    280: 
                    281: </PRE>The output format required, or a
                    282: generic format such as www/present
                    283: (present to user). 
                    284: <H4>Information about the requester</H4>
                    285: <PRE>  char *          from;
2.35      frystyk   286: </PRE>
2.19      timbl     287: 
2.35      frystyk   288: Email format address of person responible for request, see <A HREF="http://info.cern.ch/hypertext/WWW/Protocols/HTTP/HTRQ_Headers.html#from">From field in
                    289: HTTP Protocol</A>. The default address used is the current location, but that
                    290: can be changed, see <A HREF="HTTCP.html#HTGetHostName">HTTCP module</A>.
2.33      frystyk   291: 
                    292: <H4>The URI from which this request was obtained</H4>
                    293: <PRE>  HTParentAnchor *parentAnchor;
                    294: </PRE>
                    295: If this parameter is set then a `Referer: &lt;parent address&gt; is generated
                    296: in the request to the server, see <A HREF="http://info.cern.ch/hypertext/WWW/Protocols/HTTP/HTRQ_Headers.html#z14">Referer field in a HTTP Request</A>
                    297: 
2.19      timbl     298: <H3>Set by HTAccess</H3>None of the bits below may be looked
                    299: at by a client application except
                    300: in the callback routine, when the
                    301: anchor may be picked out.
                    302: <PRE>  HTParentAnchor* anchor;
                    303: 
                    304: </PRE>The anchor for the object in question.
2.20      frystyk   305: Set immediately by HTAcesss.  Used
2.19      timbl     306: by the protocol and parsing modules.
                    307: Valid thoughout the access.
                    308: <PRE>  HTChildAnchor * childAnchor;    /* For element within the object  */
                    309: 
2.31      frystyk   310: </PRE>The anchor for the sub object if
2.19      timbl     311: any.  The object builder should ensure
                    312: that htis is selected, highlighted,
                    313: etc when the object is loaded. NOTE:
                    314: Set by HTAccess.
                    315: <PRE>  void *          using_cache;
                    316: 
                    317: </PRE>pointer to cache element if cache
                    318: hit
2.25      luotonen  319: <H3>Error Diagnostics</H3>
                    320: <PRE>
2.30      frystyk   321:        BOOL            error_block;    /* YES if stream has been used    */
2.29      luotonen  322:        HTList *        error_stack;    /* List of errors                 */
2.25      luotonen  323: 
2.34      frystyk   324: </PRE>
                    325: <H3>Library Side</H3>
                    326: <PRE>
                    327:        HTNetInfo *     net_info;       /* Information about socket etc. */
2.36    ! frystyk   328:        int             redirections;   /* Number of redirections */
2.25      luotonen  329: </PRE>
2.21      luotonen  330: <H3>Server Side</H3>
                    331: <PRE>
                    332:        HTAtom *        content_type;   /* Content-Type:                  */
2.18      luotonen  333:        HTAtom *        content_language;/* Language                      */
                    334:        HTAtom *        content_encoding;/* Encoding                      */
2.16      luotonen  335:        int             content_length; /* Content-Length:                */
2.21      luotonen  336:        HTInputSocket * isoc;           /* InputSocket object for reading */
2.14      luotonen  337:        char *          authorization;  /* Authorization: field           */
                    338:        HTAAScheme      scheme;         /* Authentication scheme used     */
2.19      timbl     339: </PRE>
2.21      luotonen  340: <H3>Client Side</H3>
2.19      timbl     341: <PRE>
2.14      luotonen  342:        HTList *        valid_schemes;  /* Valid auth.schemes             */
                    343:        HTAssocList **  scheme_specifics;/* Scheme-specific parameters    */
                    344:        char *          prot_template;  /* WWW-Protection-Template: field */
                    345:        HTAASetup *     setup;          /* Doc protection info            */
                    346:        HTAARealm *     realm;          /* Password realm                 */
                    347:        char *          dialog_msg;     /* Authentication prompt (client) */
                    348:        HTRetryCallbackType
                    349:                        retry_callback; /* Called when password entered   */
2.10      timbl     350: };
2.9       timbl     351: 
2.31      frystyk   352: </PRE>
                    353: 
                    354: <H2><A NAME="z100">Functions to Manipulate a HTRequest Structure</A></H2>
                    355: 
                    356: Just to make things easier especially for clients, here are some functions to
                    357: manipulate the request structure:
                    358: 
                    359: <H3>Create blank request</H3>This request has defaults in -- in
2.9       timbl     360: most cases it will need some information
                    361: added before being passed to HTAccess,
                    362: but it will work as is for a simple
                    363: request.
2.14      luotonen  364: <PRE>
                    365: PUBLIC HTRequest * HTRequest_new NOPARAMS;
2.31      frystyk   366: </PRE>
2.14      luotonen  367: 
2.31      frystyk   368: <H3>Delete request structure</H3>Frees also conversion list hanging
2.19      timbl     369: from req->conversions.
2.14      luotonen  370: <PRE>
                    371: PUBLIC void HTRequest_delete PARAMS((HTRequest * req));
2.31      frystyk   372: </PRE>
1.1       timbl     373: 
2.31      frystyk   374: <H3>Clear a request structure</H3>
                    375: Clears a request structure so that it can be reused. The only thing that differs from using free/new is that the list of conversions is kept.
                    376: <PRE>
                    377: extern void HTRequest_clear PARAMS((HTRequest * req));
                    378: </PRE>
2.9       timbl     379: 
2.5       timbl     380: <H2>Load a document from relative name</H2>
                    381: <H3>On Entry,</H3>
                    382: <DL>
                    383: <DT>relative_name
2.6       timbl     384: <DD> The relative address
2.5       timbl     385: of the file to be accessed.
                    386: <DT>here
2.6       timbl     387: <DD> The anchor of the object being
2.5       timbl     388: searched
2.9       timbl     389: <DT>request->anchor
                    390: <DD> not filled in yet
2.5       timbl     391: </DL>
                    392: 
                    393: <H3>On Exit,</H3>
                    394: <DL>
                    395: <DT>returns    YES
2.6       timbl     396: <DD> Success in opening
2.5       timbl     397: file
                    398: <DT>NO
2.6       timbl     399: <DD> Failure 
2.5       timbl     400: </DL>
1.1       timbl     401: 
2.5       timbl     402: <PRE>extern  BOOL HTLoadRelative PARAMS((
1.1       timbl     403:                CONST char *            relative_name,
2.9       timbl     404:                HTParentAnchor *        here,
                    405:                HTRequest *             request));
1.1       timbl     406: 
                    407: 
2.5       timbl     408: </PRE>
                    409: <H2>Load a document from absolute name</H2>
                    410: <H3>On Entry,</H3>
                    411: <DL>
                    412: <DT>addr
2.6       timbl     413: <DD> The absolute address of the
                    414: document to be accessed.
2.5       timbl     415: <DT>filter
2.6       timbl     416: <DD> if YES, treat document as
                    417: HTML
2.9       timbl     418: <DT>request->anchor
                    419: <DD> not filled in yet
2.5       timbl     420: </DL>
1.1       timbl     421: 
2.5       timbl     422: <PRE>
                    423: </PRE>
                    424: <H3>On Exit,</H3>
                    425: <PRE>
                    426: </PRE>
                    427: <DL>
                    428: <DT>returns YES
2.6       timbl     429: <DD> Success in opening document
2.5       timbl     430: <DT>NO
2.6       timbl     431: <DD> Failure 
2.5       timbl     432: </DL>
1.1       timbl     433: 
2.9       timbl     434: <PRE>extern BOOL HTLoadAbsolute PARAMS((CONST char * addr,
                    435:                HTRequest *             request));
1.1       timbl     436: 
                    437: 
2.5       timbl     438: </PRE>
                    439: <H2>Load a document from absolute name
                    440: to a stream</H2>
                    441: <H3>On Entry,</H3>
                    442: <DL>
                    443: <DT>addr
2.6       timbl     444: <DD> The absolute address of the
                    445: document to be accessed.
2.5       timbl     446: <DT>filter
2.6       timbl     447: <DD> if YES, treat document as
                    448: HTML
2.9       timbl     449: <DT>request->anchor
                    450: <DD> not filled in yet
2.5       timbl     451: </DL>
                    452: 
                    453: <H3>On Exit,</H3>
                    454: <DL>
                    455: <DT>returns YES
2.6       timbl     456: <DD> Success in opening document
2.5       timbl     457: <DT>NO
2.6       timbl     458: <DD> Failure 
2.5       timbl     459: </DL>
                    460: Note: This is equivalent to HTLoadDocument
2.9       timbl     461: <PRE>extern BOOL HTLoadToStream PARAMS((
                    462:                CONST char *            addr,
                    463:                BOOL                    filter,
                    464:                HTRequest *             request));
1.1       timbl     465: 
                    466: 
2.5       timbl     467: </PRE>
                    468: <H2>Load if necessary, and select an
2.9       timbl     469: anchor</H2>The anchor parameter may be a child
                    470: anchor. The anchor in the request
2.33      frystyk   471: is set to the parent anchor. The recursive function keeps the error stack in 
                    472: the request structure so that no information is lost having more than one
                    473: call. 
2.5       timbl     474: <H3>On Entry,</H3>
                    475: <DL>
2.9       timbl     476: <DT>anchor
                    477: <DD> may be a child or parenet
                    478: anchor or 0 in which case there is
                    479: no effect.
                    480: <DT>request->anchor      
                    481: <DD>    Not set
                    482: yet.
2.5       timbl     483: </DL>
                    484: 
                    485: <H3>On Exit,</H3>
                    486: <PRE>
                    487: </PRE>
                    488: <DL>
                    489: <DT>returns YES
2.6       timbl     490: <DD> Success
2.5       timbl     491: <DT>returns NO
2.6       timbl     492: <DD> Failure 
2.9       timbl     493: <DT>request->anchor
                    494: <DD> The parenet anchor.
2.5       timbl     495: </DL>
                    496: 
2.33      frystyk   497: <PRE>
                    498: extern BOOL HTLoadAnchor PARAMS((HTAnchor  * a,
                    499:                                 HTRequest *            request));
                    500: extern BOOL HTLoadAnchorRecursive PARAMS((HTAnchor  * a,
                    501:                                          HTRequest *           request));
2.5       timbl     502: </PRE>
2.24      luotonen  503: 
                    504: <H2>Load a Document</H2>
                    505: This is an internal routine, which has an address AND a matching
                    506: anchor.  (The public routines are called with one OR the other.)
2.33      frystyk   507: This is recursively called from file load module to try ftp (though this
                    508: will be obsolete in the next major release).
2.24      luotonen  509: 
                    510: <H3>On entry,</H3>
2.33      frystyk   511: <DL> 
                    512: <DT> request->
                    513: <DD>
2.24      luotonen  514: <DL>
                    515:        <DT> anchor             <DD> a parent anchor with fully qualified
                    516:                                     hypertext reference as its address set
                    517:        <DT> output_format      <DD> valid
                    518:        <DT> output_stream      <DD> valid on NULL
                    519: </DL>
2.33      frystyk   520: <DT> keep_error_stack 
                    521: <DD> If this is set to YES then the error (or info) stack is not cleared from
                    522: the previous call. 
                    523: </DL> 
2.24      luotonen  524: <H3>On exit,</H3>
                    525: returns
                    526: <DL>
                    527:        <DT> <0         <DD> Error has occured.
                    528:        <DT> HT_LOADED  <DD> Success
                    529:        <DT> HT_NO_DATA <DD> Success, but no document loaded.
                    530:                                        (telnet sesssion started etc)
                    531: </DL>
                    532: 
                    533: <PRE>
2.33      frystyk   534: PUBLIC int HTLoad PARAMS((HTRequest * request, BOOL keep_error_stack));
2.24      luotonen  535: </PRE>
                    536: 
                    537: 
2.20      frystyk   538: <H2>Bind an anchor to a request structure
                    539: without loading</H2>The anchor parameter may be a child
                    540: anchor. The anchor in the request
                    541: is set to the parent anchor. This
                    542: is useful in non-interactive mode
                    543: if no home-anchor is known. Actually
                    544: the same as HTLoadAnchor(), but without
                    545: loading
                    546: <H3>On Entry,</H3>
                    547: <DL>
                    548: <DT>anchor
                    549: <DD> may be a child or parenet
                    550: anchor or 0 in which case there is
                    551: no effect.
                    552: <DT>request->anchor      
                    553: <DD> Not set yet.
                    554: </DL>
                    555: 
                    556: <H3>On Exit,</H3>
                    557: <PRE>
                    558: </PRE>returns YES       Success<P>
                    559: returns NO      Failure <P>
                    560: request->anchor         The parenet anchor.
                    561: <PRE>
                    562: extern BOOL HTBindAnchor PARAMS((HTAnchor *anchor, HTRequest *request));
                    563: 
                    564: 
                    565: </PRE>
2.5       timbl     566: <H2>Make a stream for Saving object back</H2>
                    567: <H3>On Entry,</H3>
                    568: <DL>
2.9       timbl     569: <DT>request->anchor
                    570: <DD> is valid anchor which
                    571: has previously beeing loaded
2.5       timbl     572: </DL>
                    573: 
                    574: <H3>On exit,</H3>
                    575: <DL>
                    576: <DT>returns
2.6       timbl     577: <DD> 0 if error else a stream
                    578: to save the object to.
2.5       timbl     579: </DL>
                    580: 
                    581: <PRE>
                    582: 
2.13      timbl     583: extern HTStream * HTSaveStream PARAMS((HTRequest * request));
1.1       timbl     584: 
                    585: 
2.5       timbl     586: </PRE>
                    587: <H2>Search</H2>Performs a search on word given by
                    588: the user. Adds the search words to
                    589: the end of the current address and
                    590: attempts to open the new address.
                    591: <H3>On Entry,</H3>
                    592: <DL>
                    593: <DT>*keywords
2.6       timbl     594: <DD> space-separated keyword
2.5       timbl     595: list or similar search list
                    596: <DT>here
2.6       timbl     597: <DD> The anchor of the object being
2.5       timbl     598: searched
                    599: </DL>
1.1       timbl     600: 
2.9       timbl     601: <PRE>extern BOOL HTSearch PARAMS((
                    602:                CONST char *            keywords,
                    603:                HTParentAnchor*         here,
                    604:                HTRequest *             request));
1.1       timbl     605: 
                    606: 
2.5       timbl     607: </PRE>
                    608: <H2>Search Given Indexname</H2>Performs a keyword search on word
                    609: given by the user. Adds the keyword
                    610: to  the end of the current address
                    611: and attempts to open the new address.
                    612: <H3>On Entry,</H3>
                    613: <DL>
                    614: <DT>*keywords
2.6       timbl     615: <DD> space-separated keyword
2.5       timbl     616: list or similar search list
                    617: <DT>*indexname
2.6       timbl     618: <DD> is name of object search
2.5       timbl     619: is to be done on.
                    620: </DL>
1.1       timbl     621: 
2.5       timbl     622: <PRE>extern BOOL HTSearchAbsolute PARAMS((
2.9       timbl     623:        CONST char *            keywords,
                    624:        CONST char *            indexname,
                    625:        HTRequest *             request));
1.1       timbl     626: 
                    627: 
2.5       timbl     628: </PRE>
2.9       timbl     629: <H2>Register an access method</H2>An access method is defined by an
                    630: HTProtocol structure which point
                    631: to the routines for performing the
                    632: various logical operations on an
                    633: object: in HTTP terms,  GET, PUT,
                    634: and POST.<P>
                    635: Each of these routine takes as a
                    636: parameter a <A
                    637: NAME="z2" HREF="#z1">request structure</A> containing
                    638: details ofthe request.  When the
                    639: protocol class routine is called,
                    640: the anchor elemnt in the request
                    641: is already valid (made valid by HTAccess).
                    642: <PRE>typedef struct _HTProtocol {
1.1       timbl     643:        char * name;
                    644:        
2.11      timbl     645:        int (*load)PARAMS((HTRequest *  request));
1.1       timbl     646:                
2.11      timbl     647:        HTStream* (*saveStream)PARAMS((HTRequest *      request));
                    648: 
2.9       timbl     649:        HTStream* (*postStream)PARAMS((
                    650:                                HTRequest *     request,
                    651:                                HTParentAnchor* postTo));
1.1       timbl     652: 
                    653: } HTProtocol;
                    654: 
                    655: extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
                    656: 
                    657: 
2.5       timbl     658: </PRE>
                    659: <H2>Generate the anchor for the home
                    660: page</H2>
                    661: <PRE>
                    662: </PRE>As it involves file access, this
                    663: should only be done once when the
                    664: program first runs. This is a default
                    665: algorithm -- browser don't HAVE to
                    666: use this.
2.25      luotonen  667: <PRE>
2.33      frystyk   668: extern HTParentAnchor * HTHomeAnchor NOPARAMS;
2.25      luotonen  669: </PRE>
                    670: 
                    671: <PRE>
1.1       timbl     672: #endif /* HTACCESS_H */
2.25      luotonen  673: </PRE>
                    674: end of HTAccess
                    675: </BODY>
2.9       timbl     676: </HTML>

Webmaster