Configuration manager
/*
** (c) COPYRIGHT MIT 1995.
** Please first read the full copyright statement in the file COPYRIGH.
*/
The configuration information loaded includes tables (file suffixes,
presentation methods) in other modules. The most likely routines
needed by developers will be:
- HTSetConfiguration
- to load configuration
information.
- HTLoadRules
- to load a whole file
of configuration information
- HTTranslate
- to translate a URL using
the rule table.
This module is implemented by HTRules.c, and
it is a part of the
Library of Common Code.
#ifndef HTRULE_H
#define HTRULE_H
#include "HTAccess.h" /* HTRequest */
typedef enum _HTRuleOp {
HT_Invalid,
HT_Map,
HT_Pass,
HT_Fail,
HT_DefProt,
HT_Protect,
HT_Exec,
HT_Redirect,
HT_UseProxy
} HTRuleOp;
Server Side Script Execution
If a URL starts with /htbin/
it is understood
to mean a script execution request on server.
This feature needs to
be turned on by setting HTBinDir
by the
htbin
rule. Index searching is enabled by
setting HTSearchScript
into the name of script
in BinDir doing the actual search by search
rule
(BinDir must also be set in this case, of course).
#ifdef NOT_USED
extern char * HTSearchScript; /* Search script name */
extern char * HTPutScript; /* Script handling PUT */
extern char * HTPostScript; /* Script handling POST */
#endif /* NOT_USED */
HTAddRule: Add rule to the list
On entry,
- pattern
- points to 0-terminated string
containing a single "*"
- equiv
- points to the equivalent string
with * for the place where the text
matched by * goes.
On exit,
- returns
- 0 if success, -1 if error.
Note that if BYTE_ADDRESSING is set,
the three blocks required are allocated
and deallocated as one. This will
save time and storage, when malloc's
allocation units are large.
extern int HTAddRule PARAMS(( HTRuleOp op, const char * pattern,
const char * equiv));
HTClearRules: Clear all rules
On exit,
- Rule file
- There are no rules
- returns
-
- 0 if success, -1 if error.
extern int HTClearRules NOPARAMS;
On entry,
- required
- points to a string whose
equivalent value is neeed
On exit,
- returns
- the address of the equivalent
string allocated from the heap which
the CALLER MUST FREE. If no translation
occured, then it is a copy of the
original.
extern char * HTTranslate PARAMS((CONST char * required));
On entry,
- config
- is a string in the syntax
of a rule file line.
This routine may be used for loading
configuration information from sources
other than the rule file, for example
INI files for X resources.
extern int HTSetConfiguration PARAMS((CONST char * config));
On entry,
- Rule table
- Rules can be in any state
On exit,
- Rule table
- Any existing rules will
have been kept. Any new rules will
have been loaded on top, so as to
be tried first.
- Returns
- 0 if no error.
extern int HTLoadRules PARAMS((const char * filename));
#endif /* HTUtils.h */
end