Under SREhttp/2, selector-specific attributes are specified by defining realms in the ATTRIBS.CFG file(s).
Notes: |
|
---|
The basic idea of this realm-architecture:
action: options
The valid actions are:
Each block must contain a REALM and a RULE. | |
desc | -- a short (60 character) description |
option_file | -- specify an advanced options file |
failure | -- specify an access failure file |
option | -- specify an advanced option |
permissions | -- specify SREhttp/2 permissions |
realm | -- the name of this realm or subrealm(REQUIRED).
Alternatively, this can specify a meta-realm. |
redirect | -- url redirection, or virtual directory assignment |
requires | -- resources privileges needed for access |
rule | -- selectors (possibly *'ed) to assign to this realm (REQUIRED) |
hosts | -- a list of host-nicknames dictating when this realm may be used |
The following describes these actions in greater detail:
failure |
Specify how to respond when access is denied Failure complements the FAIL_FILE parameter in SREHTTP2.CFG.
Examples: | ||||||||||||||||||||||||||||||||||
option |
Specify an advanced option
The an_advanced_option can be any of the SREhttp/2 advanced options, as described in ADV_OPTS.HTM.
| ||||||||||||||||||||||||||||||||||
option_file |
Specify an advanced options file. Syntax: option_file: file_name file_name should be a relative file name; which will be relative to the CFG directory for the host (that is specified in HOSTDATA.CFG). For the default, this is usually the SREHTTP2\CFG directory. For more details on advanced options files, see ADV_OPTS.HTM
Example: option_file: ADV2.CTL | ||||||||||||||||||||||||||||||||||
permissions |
Specify the "permissions" to use for selectors that belong to this realm.
Syntax: permission: permission_list
permission_list is a spaced delimited list of SRE-http "permissions". NO_SSI DO_SSI NO_SSP CACHE NOCACHE LOG NO_LOG NO_CUSTOM_USERNAME PUT DELETE NO_DIR HTACCESS NO_HTACCESS
Example: permission: NO_SSI NO_SSP NO_CACHE | ||||||||||||||||||||||||||||||||||
realm
(required) |
Identify the realm,or specify a meta-realm.
| ||||||||||||||||||||||||||||||||||
requires |
Identify the required privileges a client needs to access this realm, or specify a
meta realm file.
| ||||||||||||||||||||||||||||||||||
redirect |
Redirect or redefine a request See Appendix 3 for a complete description of how SREhttp/2 uses redirection. Syntax: redirect: mode = xxx mode can be: dir, internal, literal, negotiate, perm, or temp
| ||||||||||||||||||||||||||||||||||
rule
(required) |
Specify matching rules for idenfitying selectors that
belong to this realm. Syntax: rule: a_selector a_selector may contain multiple wildcard (*) characters. Some simple examples include:
Notes:
Appendix 1 discusses how SREhttp/2 uses wildcards when matching selectors to a rule. | ||||||||||||||||||||||||||||||||||
desc
(strictly optional) |
A short description of this entry Syntax: desc: a short description desc is used for informational purposes. It is similar to including a comment (lines starting with a ;). There are a few differences --
|
||||||||||||||||||||||||||||||||||
hosts
(strictly optional) |
Hosts is used to control when this realm will be used.
If specified, hosts should be a host-nickname, or a space delimited list of host-nicknames. For a given request, the host-nickname (of the host to whom this request was sent) is compared against this list. If the host-nickname does not appear in this list, then the realm will not be used (for this request). However, if you do not specify a hosts attribute, then this additional test will not be made. The hosts attribute is useful ...
Basically, hosts is a shortcut -- instead of specifying several (possibly small) ATTRIBS.CFG files, you can use hosts to apply selected realm(s) only to a subset(s) of the hosts that could otherwise use it. For example, suppose you have lots of hosts that each have a few realms defined, and that also use a number of realms in common. These common realms can be easily defined in the DEFAULT ATTRIBS.CFG file. But what if there are a few realms that should only apply to the DEFAULT host? By using a Hosts: DEFAULT attribute on these realms, you can easily enforce this limitation.
|
In order to determine selector-specific attributes, SREhttp/2 will check the entries contained in ATTRIBS.CFG. More precisely, SREhttp/2 will examine entries in the default and host-specific ATTRIBS.CFG file.
When an exact match is found between the request selector and a rule, then this matching entry is used. If there is no exact match, then the request selector is compared against all wilcard entries. Entries are checked using a multiple wildcard, with multiple substitutions algorithim (where the * character acts as a wildcard).
If several entries can match the selector...
Special feature: | ending the TARGET with a | means no / or \ can be
covered by the final *. Thus, if the selector is: anim/cats/food.1 then anim/*food.1 will yield a match, but anim/*food.1| will not yield a match (since cats/ contains a /) The purpose of this feature is to "limit" wildcard matches to a single subdirectory (that is, to prevent matches to items in deeper portions of the directory tree) |
/BILL/DOG.HTM | will match /BILL/DOG.HTM |
/JOE/* | will match /JOE/FOO.HTM |
/JOAN/SRCH.HTM?* | will match /JOAN/SRCH.HTM?search+me |
/JOAN/SRCH.HTM?* | will not match /JOAN/SRCH.HTM (/JOAN/SRCH.HTM* will match both these examples) |
/PETS/*FOOD/*INDEX.HTM | will match /PETS/FOOD/INDEX.HTM, /PETS/CAT/FOOD/INDEX.HTM and /PETS/PUPPY/FOOD/LAB/INDEX.HTM but will not match /PETS/CAT/PUREBRED.HTM, and /PETS/FOOD/HELLO.HTM |
/STORE/*.JPG| | will match /STORE/RADIO.JPG but will not match /STORE/DEPT1/TV.JPG |
; selectors starting with /temp/* are directly mapped to h:\temp realm: r0 rule: /temp/* redirect: dir=h:\temp\* ; redirect some requests realm: r1 desc: some graphical programs were moved rule: blendgif.htm rule: mkgiftxt.htm redirect: moved=http://www.srehttp.org/apps/ ; all selectors starting with pubfiles/* are PUBLIC realm: public rule: pubfiles/* ; a "low auditing" class of PUBLIC resources realm: public.1 rule: morepubfiles/* permissions: no_postresponse redirect: literal=f:\pubs\* desc: these public files are not interesting to track ; selectors to HTML (or other static files) resources, that start ; with temp/*, are accessible by anyone with a valid username; ; and their "root directory" is f:\temp\* realm: r2 requires: * rule: temp/* redirect: !HTML dir=f:\temp\* realm: send1 rule: scores/yankees literal: e:\baseball\yanks.txt realm: r2.3 host: danny rule: yahoo redirect: move = http://www.yahoo.com realm: r3 rule: srehttp_faq redirect: internal=/samples/srehttp.faq permissions: yes_ssi realm: r4 rule: config2.* requires: superuser permissions: no_alias redirect: temp=http:/www.mysite.org/config2.* realm: r5.a.1 rule: /inhouse/foobar.htm permissions: no_ssi realm:r4.b rule: config3.* option_file: foo.ctl permissions: no_postresponse option: ssi_no_header option: ssi_no_footer realm: manual rule: /manual/* negotiate: mans/manual1.lst realm: intr rule: intro.txt option: set content_md5 1 realm r5 rule: /inhouse/* requires: inhouse realm: sort_of_secret rule: my_tales/* permissions: NO_DIR realm:defonly desc: this redirection should only be used with request to the default rule: /disclaim.txt hosts: DEFAULT literal: f:\legal\disclaim_2003.txt
Virtual directories can also be used to:
What are virtual directories |
When SREhttp/2 recieves a request, it must map
the request selector to a resource on the server. For example, by
matching an HTML request to a .HTM (or .HTML) file. Typically,
this is done by treating the request selector as
a relative file name, relative to a
data directory.
If a virtual directory is not specified, then a default (or host-specific) data directory is used as a root directory. That is, the request selector is mapped to a file that is relative to this root directory. Basically, virtual directories are used to specify a selector-specfic root directory. |
Specifying virtual directories |
Virtual directories are specified with a redirect: dir= xxx or, synonymously, with ... virtual= xxx where: |
Advanced usage: virtual directory by request type |
You can specify multiple virtual directories, with
different virtual directories used for different types
of requests. To do this, use:
Respectively, these are
|
Examples |
|
Specifying Internal Redirection |
Internal redirection is specified with a redirect: internal= xxx or, synonymously, with ... alias= xxx where: |
Advanced Usage: Iterating |
You can iterate an internal redirection
by prefacing xxx with !REPEAT. For example: redirect: internal= !REPEAT /faqs/* Iteration means that SREhttp/2 will repeat the attribute lookup, using the internally redirected selector (instead of the original selector). If this repeated lookup yields a match, then the attributes of that match are used, rather then the attributes of the original match.
| ||||||||
Notes: |
|
Examples: |
realm: goo1 rule: /INDEX rule: /INDX redirect: internal=/index.htm * Replaces alternate spellings of /INDEX.HTM realm: search1 rule: TESTSRCH.HTM?* redirect: internal= DOSEARCH?file=/congress.dat&searchfor=*&delim=$ * Implements a searchable index (using SREhttp/2's DOSEARCH utility) CONGRESS.DAT will be searched using the search list provided by the client |
Specifying Literal Assignment |
Literal assignment is specified with a redirect: literal= xxx or, synonymously, with ... literal= xxx where: |
For details on how to use content-negotiation in SREhttp/2, see NEGOTIAT.HTM. | |||||||
Specifying Content Negotiation |
Content negotiation is specified with a redirect: negotiate= xxx or, synonymously, with ... negotiate= xxx where: |
||||||
Usage |
Negotiation is used to tell SREhttp/2 that the request-selector
should be used as instructions for content-negotiation.
That is, the contents of the file pointed to by the request
selector should not be returned by the client.
Instead, the file is interpreted as a variant list, which is used to help choose some other file, with the choice being determined by the current values of various request headers. Thus, one usually does not include wildcards in the rule, and one usually specifies a period (or equivalently, nothing) after the negotiate: . However, you can use a wildcarded rule and place the name of the variant-list file after the negotiate: (in the selector portion of xxx).
| ||||||
Notes: |
The xxx can either be:
Considering the above example, instead of /MANUAL/MANUALS.LST, one could specify /DOCUMENTS/NEW_MANUALS/MANUALS.LST
|
||||||
For details on how to use content-negotiation in SREhttp/2, see NEGOTIAT.htm. |
Notify redirection is not a true http redirection. Instead, SREhttp/2 will send a normal (200) html response that contains a link directing the client to the new location of the resource.
Specifying Redirection |
Permanent redirection is specified with a redirect: perm= xxx or, synonymously, with ... move= xxx and...
Temporary redirection is specified with a and...
Notify redirection is specified with a where:
|
Usage |
Given that a permanent (or temporary or notify) redirection is
defined for a request-selector,
the redefined request selector is
determined by:
|
Examples: |
realm: goo3 rule: YAH* rule: WAH* redirect: move=http://www.yahoo.com/ * All requests starting with YAH or WAH are sent to the yahoo home page. realm: goo3 rule: /USGS/* redirect: temp=http://www.usgs.gov/tiger/* * Requests starting with /USGS/ are temporarily redirected to: http://www.usgs.gov/tiger/ Thus, a request-selector of /USGS/RIVERS.DAT is redirected to: http://www.usgs.gov/tiger/rivers.dat. realm: goo4 rule: /joedir/cv.htm redirect: notify= http://college.tfar.edu/C/JOE/CV.HTM * A "notification of moved resource" -- client recieves an html document telling her the resource has been moved to http://college.tfar.edu/C/JOE/CV.HTM with a link to this new location realm: goo4 rule: /sales/event.html redirect: move= /oldsales/event13.html * Redirect to a different selector on the same site. realm: elephant rule: pachyderm/events.html redirect: notify=www3.oursite.com/elephant.shtml option: Header add refresh: 15; url=http://www3.oursite.com/elephant.shtml option: set notify_message You will soon be redirected to our elephant site ... * Notifies the client that the pachyderm/events.html has been moved, and informs the client that this will be automatically obtained. After 15 seconds, most browsers will automatically fetch this new URI. |
Use of meta-realms offers several advantages:
Notes: |
|
---|
Example.... |
|