Annotation of libwww/Library/src/HTRules.html, revision 2.14

2.6       timbl       1: <HEADER>
                      2: <TITLE>Configuration Manager for libwww</TITLE>
                      3: <NEXTID N="6">
                      4: </HEADER>
                      5: <BODY>
                      6: <H1>Configuration manager</H1>Author Tim Berners-Lee/CERN. Public
                      7: domain. Please mail changes to timbl@info.cern.ch.<P>
                      8: The configuration information loaded
                      9: includes tables (file suffixes, presentation
                     10: methods) in other modules.  The most
                     11: likely routines needed by developers
                     12: will be:
                     13: <DL>
                     14: <DT><A
                     15: NAME=z3 HREF="#z2">HTSetConfiguration</A>
                     16: <DD> to load configuration
                     17: information.
                     18: <DT><A
                     19: NAME=z1 HREF="#z0">HTLoadRules</A>
                     20: <DD> to load a whole file
                     21: of configuration information
                     22: <DT><A
                     23: NAME=z5 HREF="#z4">HTTranslate</A>
                     24: <DD> to translate a URL using
                     25: the rule table.
                     26: </DL>
2.1       timbl      27: 
2.6       timbl      28: <PRE>#ifndef HTRULE_H
2.1       timbl      29: #define HTRULE_H
                     30: 
                     31: #include "HTUtils.h"
2.10      luotonen   32: #include "HTAccess.h"  /* HTRequest */
2.1       timbl      33: 
2.7       luotonen   34: typedef enum _HTRuleOp {
                     35:        HT_Invalid, 
                     36:        HT_Map, 
                     37:        HT_Pass, 
                     38:        HT_Fail,
                     39:        HT_DefProt,
2.10      luotonen   40:        HT_Protect,
2.12      luotonen   41:        HT_Exec,
                     42:        HT_Redirect
2.7       luotonen   43: } HTRuleOp;
2.1       timbl      44: 
2.9       luotonen   45: #ifdef SHORT_NAMES
                     46: #define HTSearSc HTSearchScript
2.11      luotonen   47: #define HTPutScr HTPutScript
                     48: #define HTPostSc HTPostScript
2.9       luotonen   49: #endif /*SHORT_NAMES*/
                     50: 
                     51: </PRE>
                     52: 
                     53: <H2>Server Side Script Execution</H2>
                     54: 
                     55: If a URL starts with <CODE>/htbin/</CODE> it is understood
                     56: to mean a script execution request on server.
                     57: This feature needs to
                     58: be turned on by setting <CODE>HTBinDir</CODE> by the
                     59: <CODE>htbin</CODE> rule.  Index searching is enabled by
                     60: setting <CODE>HTSearchScript</CODE> into the name of script
                     61: in BinDir doing the actual search by <CODE>search</CODE> rule
                     62: (BinDir must also be set in this case, of course).
                     63: <PRE>
                     64: extern char * HTSearchScript;  /* Search script name */
2.11      luotonen   65: extern char * HTPutScript;     /* Script handling PUT */
                     66: extern char * HTPostScript;    /* Script handling POST */
2.8       luotonen   67: 
2.6       timbl      68: </PRE>
                     69: <H2>HTAddRule:  Add rule to the list</H2>
                     70: <H3>On entry,</H3>
                     71: <DL>
                     72: <DT>pattern
                     73: <DD>points to 0-terminated string
                     74: containing a single "*"
                     75: <DT>equiv
                     76: <DD>points to the equivalent string
                     77: with * for the place where the text
                     78: matched by * goes.
                     79: </DL>
                     80: 
                     81: <H3>On exit,</H3>
                     82: <DL>
                     83: <DT>returns
                     84: <DD>0 if success, -1 if error.
                     85: </DL>
                     86: Note that if BYTE_ADDRESSING is set,
                     87: the three blocks required are allocated
                     88: and deallocated as one. This will
                     89: save time and storage, when malloc's
                     90: allocation units are large.
                     91: <PRE>extern int HTAddRule PARAMS((HTRuleOp op, const char * pattern, const char * equiv));
                     92: 
                     93: 
                     94: </PRE>
                     95: <H2>HTClearRules: Clear all rules</H2>
                     96: <H3>On exit,</H3>
                     97: <DL>
                     98: <DT>Rule file
                     99: <DD> There are no rules
                    100: <DT>returns
                    101: <DD>
                    102: <DD> 0 if success, -1 if error.
                    103: </DL>
                    104: 
                    105: <PRE>
2.1       timbl     106: #ifdef __STDC__
                    107: extern int HTClearRules(void);
                    108: #else
                    109: extern int HTClearRules();
                    110: #endif
                    111: 
                    112: 
2.6       timbl     113: </PRE>
                    114: <H2><A
                    115: NAME=z4>HTTranslate: Translate by rules</A></H2>
                    116: <PRE>  
                    117: </PRE>
                    118: <H3>On entry,</H3>
                    119: <DL>
                    120: <DT>required
                    121: <DD> points to a string whose
                    122: equivalent value is neeed
                    123: </DL>
                    124: 
                    125: <H3>On exit,</H3>
                    126: <DL>
                    127: <DT>returns
                    128: <DD> the address of the equivalent
                    129: string allocated from the heap which
                    130: the CALLER MUST FREE. If no translation
                    131: occured, then it is a copy of the
                    132: original.
                    133: </DL>
                    134: 
2.10      luotonen  135: <PRE>
                    136: PUBLIC char * HTTranslate PARAMS((CONST char * required));
                    137: 
                    138: </PRE>
2.6       timbl     139: <H2><A
                    140: NAME=z2>HTSetConfiguration:  Load one line
                    141: of configuration information</A></H2>
                    142: <H3>On entry,</H3>
                    143: <DL>
                    144: <DT>config
                    145: <DD> is a string in the syntax
                    146: of a rule file line.
                    147: </DL>
                    148: This routine may be used for loading
                    149: configuration information from sources
                    150: other than the  rule file, for example
                    151: INI files for X resources.
                    152: <PRE>extern int HTSetConfiguration PARAMS((CONST char * config));
                    153: 
                    154: 
                    155: </PRE>
                    156: <H2><A
                    157: NAME=z0>HtLoadRules:  Load the rules from
                    158: a file</A></H2>
                    159: <H3>On entry,</H3>
                    160: <DL>
                    161: <DT>Rule table
                    162: <DD> Rules can be in any state
                    163: </DL>
                    164: 
                    165: <H3>On exit,</H3>
                    166: <DL>
                    167: <DT>Rule table
                    168: <DD> Any existing rules will
                    169: have been kept. Any new rules will
                    170: have been loaded on top, so as to
                    171: be tried first.
                    172: <DT>Returns
                    173: <DD> 0 if no error.
                    174: </DL>
2.1       timbl     175: 
2.6       timbl     176: <PRE>
2.1       timbl     177: #ifdef __STDC__
                    178: extern int HTLoadRules(const char * filename);
                    179: #else
                    180: extern int HTLoadRules();
                    181: #endif
2.7       luotonen  182: </PRE>
2.1       timbl     183: 
2.7       luotonen  184: <PRE>
2.1       timbl     185: 
                    186: #endif /* HTUtils.h */
2.6       timbl     187: </PRE>end</A></BODY>

Webmaster