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

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

Webmaster