Annotation of libwww/Library/src/HTRules.html, revision 2.11
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,
41: HT_Exec
2.7 luotonen 42: } HTRuleOp;
2.1 timbl 43:
2.9 luotonen 44: #ifdef SHORT_NAMES
45: #define HTSearSc HTSearchScript
2.11 ! luotonen 46: #define HTPutScr HTPutScript
! 47: #define HTPostSc HTPostScript
2.9 luotonen 48: #endif /*SHORT_NAMES*/
49:
50: </PRE>
51:
52: <H2>Server Side Script Execution</H2>
53:
54: If a URL starts with <CODE>/htbin/</CODE> it is understood
55: to mean a script execution request on server.
56: This feature needs to
57: be turned on by setting <CODE>HTBinDir</CODE> by the
58: <CODE>htbin</CODE> rule. Index searching is enabled by
59: setting <CODE>HTSearchScript</CODE> into the name of script
60: in BinDir doing the actual search by <CODE>search</CODE> rule
61: (BinDir must also be set in this case, of course).
62: <PRE>
2.8 luotonen 63: extern char * HTBinDir; /* Physical /htbin location */
2.9 luotonen 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>
139:
140: <H2>HTTranslateReq: Translate request by rules</H2>
141: <H3>On entry,</H3>
142: <DL>
143: <DT><CODE>req</CODE>
144: <DD>request structure.
145: <DT>req->simplified
146: <DD>simplified pathname (no ..'s etc in it),
147: which will be translated by rules.
148: </DL>
149: <H3>On exit,</H3>
150: <DL>
151: <DT>returns
152: <DD>YES on success, NO on failure (Forbidden).
153: <DT><CODE>req->translated</CODE>
154: <DD>contains the translated filename;
155: <CODE>NULL</CODE> if a script call.
156: <DT><CODE>req->script</CODE>
157: <DD>contains the executable script name;
158: <CODE>NULL</CODE> if not a script call.
159: </DL>
160: <PRE>
161: PUBLIC BOOL HTTranslateReq PARAMS((HTRequest * req));
2.1 timbl 162:
163:
2.6 timbl 164: </PRE>
165: <H2><A
166: NAME=z2>HTSetConfiguration: Load one line
167: of configuration information</A></H2>
168: <H3>On entry,</H3>
169: <DL>
170: <DT>config
171: <DD> is a string in the syntax
172: of a rule file line.
173: </DL>
174: This routine may be used for loading
175: configuration information from sources
176: other than the rule file, for example
177: INI files for X resources.
178: <PRE>extern int HTSetConfiguration PARAMS((CONST char * config));
179:
180:
181: </PRE>
182: <H2><A
183: NAME=z0>HtLoadRules: Load the rules from
184: a file</A></H2>
185: <H3>On entry,</H3>
186: <DL>
187: <DT>Rule table
188: <DD> Rules can be in any state
189: </DL>
190:
191: <H3>On exit,</H3>
192: <DL>
193: <DT>Rule table
194: <DD> Any existing rules will
195: have been kept. Any new rules will
196: have been loaded on top, so as to
197: be tried first.
198: <DT>Returns
199: <DD> 0 if no error.
200: </DL>
2.1 timbl 201:
2.6 timbl 202: <PRE>
2.1 timbl 203: #ifdef __STDC__
204: extern int HTLoadRules(const char * filename);
205: #else
206: extern int HTLoadRules();
207: #endif
2.7 luotonen 208: </PRE>
2.1 timbl 209:
2.7 luotonen 210: <PRE>
2.1 timbl 211:
212: #endif /* HTUtils.h */
2.6 timbl 213: </PRE>end</A></BODY>
Webmaster