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

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

Webmaster