Annotation of libwww/Library/src/HTRules.html, revision 2.18
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,
2.15 luotonen 42: HT_Redirect,
43: HT_UseProxy
2.7 luotonen 44: } HTRuleOp;
2.1 timbl 45:
2.9 luotonen 46: #ifdef SHORT_NAMES
47: #define HTSearSc HTSearchScript
2.11 luotonen 48: #define HTPutScr HTPutScript
49: #define HTPostSc HTPostScript
2.9 luotonen 50: #endif /*SHORT_NAMES*/
51:
52: </PRE>
53:
54: <H2>Server Side Script Execution</H2>
55:
56: If a URL starts with <CODE>/htbin/</CODE> it is understood
57: to mean a script execution request on server.
58: This feature needs to
59: be turned on by setting <CODE>HTBinDir</CODE> by the
60: <CODE>htbin</CODE> rule. Index searching is enabled by
61: setting <CODE>HTSearchScript</CODE> into the name of script
62: in BinDir doing the actual search by <CODE>search</CODE> rule
63: (BinDir must also be set in this case, of course).
64: <PRE>
2.16 duns 65: #ifdef NOT_USED
2.9 luotonen 66: extern char * HTSearchScript; /* Search script name */
2.11 luotonen 67: extern char * HTPutScript; /* Script handling PUT */
68: extern char * HTPostScript; /* Script handling POST */
2.16 duns 69: #endif /* NOT_USED */
2.8 luotonen 70:
2.6 timbl 71: </PRE>
72: <H2>HTAddRule: Add rule to the list</H2>
73: <H3>On entry,</H3>
74: <DL>
75: <DT>pattern
76: <DD>points to 0-terminated string
77: containing a single "*"
78: <DT>equiv
79: <DD>points to the equivalent string
80: with * for the place where the text
81: matched by * goes.
82: </DL>
83:
84: <H3>On exit,</H3>
85: <DL>
86: <DT>returns
87: <DD>0 if success, -1 if error.
88: </DL>
89: Note that if BYTE_ADDRESSING is set,
90: the three blocks required are allocated
91: and deallocated as one. This will
92: save time and storage, when malloc's
93: allocation units are large.
94:
2.17 frystyk 95: <PRE>
96: extern int HTAddRule PARAMS(( HTRuleOp op, const char * pattern,
97: const char * equiv));
98: </PRE>
2.6 timbl 99:
100: <H2>HTClearRules: Clear all rules</H2>
101: <H3>On exit,</H3>
102: <DL>
103: <DT>Rule file
104: <DD> There are no rules
105: <DT>returns
106: <DD>
107: <DD> 0 if success, -1 if error.
108: </DL>
109:
110: <PRE>
2.18 ! frystyk 111: extern int HTClearRules NOPARAMS;
2.17 frystyk 112: </PRE>
2.1 timbl 113:
2.17 frystyk 114: <H2><A NAME=z4>HTTranslate: Translate by rules</A></H2>
2.1 timbl 115:
2.6 timbl 116: <H3>On entry,</H3>
117: <DL>
118: <DT>required
119: <DD> points to a string whose
120: equivalent value is neeed
121: </DL>
122:
123: <H3>On exit,</H3>
124: <DL>
125: <DT>returns
126: <DD> the address of the equivalent
127: string allocated from the heap which
128: the CALLER MUST FREE. If no translation
129: occured, then it is a copy of the
130: original.
131: </DL>
132:
2.10 luotonen 133: <PRE>
2.18 ! frystyk 134: extern char * HTTranslate PARAMS((CONST char * required));
2.10 luotonen 135:
136: </PRE>
2.6 timbl 137: <H2><A
138: NAME=z2>HTSetConfiguration: Load one line
139: of configuration information</A></H2>
140: <H3>On entry,</H3>
141: <DL>
142: <DT>config
143: <DD> is a string in the syntax
144: of a rule file line.
145: </DL>
146: This routine may be used for loading
147: configuration information from sources
148: other than the rule file, for example
149: INI files for X resources.
150: <PRE>extern int HTSetConfiguration PARAMS((CONST char * config));
151:
152:
153: </PRE>
154: <H2><A
155: NAME=z0>HtLoadRules: Load the rules from
156: a file</A></H2>
157: <H3>On entry,</H3>
158: <DL>
159: <DT>Rule table
160: <DD> Rules can be in any state
161: </DL>
162:
163: <H3>On exit,</H3>
164: <DL>
165: <DT>Rule table
166: <DD> Any existing rules will
167: have been kept. Any new rules will
168: have been loaded on top, so as to
169: be tried first.
170: <DT>Returns
171: <DD> 0 if no error.
172: </DL>
2.1 timbl 173:
2.6 timbl 174: <PRE>
2.18 ! frystyk 175: extern int HTLoadRules PARAMS((const char * filename));
2.7 luotonen 176: </PRE>
2.1 timbl 177:
2.7 luotonen 178: <PRE>
2.1 timbl 179:
180: #endif /* HTUtils.h */
2.6 timbl 181: </PRE>end</A></BODY>
Webmaster