Outline of SRE-http, ver 1.3h

Since SRE-http has numerous options, many of which have similar effects, at times it can get confusing!

This document outlines the steps followed by SRE-http when a new request is received. The goal is to provide a general outline, without burdening the reader with the details of how it actually works. That is, some familiarity with the various SRE-http parameters is assumed, or a willingness to check the main documentation or the description of the initialization parameters !

Notes:

The outline

Multiple hosts

  1. A HOST: request header is read (if it exists)
  2. The IP address of the client is extracted.
  3. Using the HOST: information and the IP address, the HOSTS. stem variables are searched for a match.
  4. If one is found, the appropriate host nickname is returned (and used throughout SRE-http). In general, host-specific values for the various SRE-http parameters are used if available, otherwise default (non-host-specific) values are used.

Preliminary checks

  1. The LOAD_THRESHOLD and BACUPSERVERLIST variables are examined to see if this request should be forwarded to another server. Note that the simple load balancer shipped with SRE-http is easily upgraded (typically, all you need to do is replace the BACKSRVR.SRF file).
  2. If PRE_FILTER="YES", call the (several) pre-filter(s) (listed in the PREFILTER_NAME variable).
  3. Since to that GoServe's caching, or SREPROXY, or a pre-filter did not resolve this request. If one of these did respond, then goto the "post -filter step" (see below).
  4. Check the list PUBLIC_URLS (as read from the PUBURLS.IN file and the realm definitions file). If the requested selector appears on this list (perhaps by matching a wildcarded entry) then:

Logon and access controls

Logon

  1. If the client is an OWNER or has an IP address that matches an INHOUSEIPS., skip the logons (grant her entry to the site).
  2. If the client is an UNALLOWEDIPS, deny entry.
  3. If DNS_CHECK='YES', check for the domain name server for the existence of a matching IP "name".
  4. Otherwise, if CHECKLOG is on, look up (or first ask for) the username/password in the USER_FILE.
    ..but, first check the LOGON_LIMIT
  5. If LOGON_LIMIT is violated, or an incorrect username/password is entered, SRE-http can either,
  6. Re-request username/password, (site logon authorization responses use THE_REALM as the "realm name").
  7. Send the LOGON_FAIL_FILE

Determining client-privileges


If the client has access rights to the site, we then assign client privileges.
  1. If the client is an OWNER, grant her SUPERUSER "client privileges"
  2. If the client is an INHOUSEIPS., grant her any privilege mentioned on her INHOUSEIPS. entry, and the privileges contained in INHOUSE_PRIVS.
  3. Based on the client's username/password (if provided), client-privileges are read from the USER_FILE
  4. Everyone gets PUBLIC_PRIVS;
  5. If CHECK_ADD_PRIVS is on, the "dynamic" privileges cache is checked for client-specific transient privileges.
  6. If ADD_USER_NAME is on, add the "username" to the client-privileges list.

Determining Access Rights using Resource-Privileges

  1. Lookup SEL-specific resource privileges, permissions, etc. in the ACCESS_FILE (or the realm definitions file). Add the "action" portion of the URL if ADD_RESOURCE_NAME is on.
  2. If ALLOW_ACCESS is on, the list of resource privileges is compared against the client privileges.
  3. If the resource privileges are not "satisfied":
  4. In addition to the "resource privileges list" and the SEL-specific realm, several permissions are read from the ACCESS_FILE and the realm definitions file.
    Any of the following permissions might appear: NO_SSI, YES_SSI, NO_SSP, CACHE, NO_HTACCESS, NO_ALIAS, NO_VIRTUAL, NO_POSTFILTER, DELETE, and PUT.
  5. If CHECKLOG< >"NO" or ALLOW_ACCESS< >"YES", then caching is suppressed. This suppression is withdrawn when the CACHE permission appears.

Request selector modifications and URL redirections

  1. But first, if PRE_FILTER equals YES (rather then FIRST), call the pre-filter (and check for an "all done" return status).
  2. If it is an empty selector, then set the selector to be the DEFAULT
  3. NOTE: Non-literal public_urls jump to here !
  4. If CHECK_ALIAS is on, and the NO_ALIAS permission is not present: Compare the request selector to the aliases contained in the ALIAS_FILE and the realm-definitions file.
    Matches may indicate "local redirection", "remote" redirection, or "immediate file transfer".
    If a local redirection, the request selector is modified.
    If a remote URL redirection (or a file transfer); do the"redirection" (or the "transfer"), and goto the post-filter step.
    If a negotiable resource is indicated, then either server-side negotiation is used to generate a new "selector" (similar to "local redirection"), or a "variants list" is immediately sent to the client.
  5. If the http method is GET, then check "auto naming"
  6. If NOEXT_TYPE is on, check the (now alias modified) selector for an extension.
  7. If no extension found, then (depending on the value of NOEXT_TYPE) either add an extension, or search a directory for a file (using the entries in AUTO_NAME), or display a directory of files in the requested directory (using the !DIR facility).
  8. Perform the HOME_DIR for ~ replacement (with possible use of the $ to signifiy "www specific subdirectories").
  9. If the selector contains a *, and WILD_SELS_OKAY is not equal to 0, then search for a file that mathes this wildcarded. Depending on the value of WILD_SELS_OKAY, this might yield a !DIR style listing of multiple matches.

Processing the Request

There are 7 "methods" supported by SRE-http: HEAD GET POST DELETE PUT TRACE and OPTIONS. In addition, CGI-BIN requests, and !special requests are recognized.

Note that in all cases,

Post-filter processing

After returning results (say, an HTML file) to the client, and closing the connection, SRE-http can either record the transaction or call a post-filter (but only if the NO_POSTFILTER permission has not been set, and a public_url with a NORECORD modifer did not apply to this request).
  1. If the WRITE_LOGS parameter is enabled, then (perhaps) write the common-log audit file, the browser log, and the referer log. The SREFLOGS.INI will dictate exactly where and how to write these log files. SREFLOGS.INI, and SCHEDULE.CFG, are also used to dictate when to run "scheduled programs".
  2. If the RECORD_OPTION is on and the RECORD_ALL_FILE is set, then record this selector.
    ... but first check the repetitive hits cache to see if it has been recently recorded.
    Note: recording may be stored in an internal cache for several minutes.
  3. If the POST_FILTER variable is on, then call a (set of) post-filter(s) with listed in POSTFILTER_NAME (note that the SMTP_GATEWAY can be used by the POST_FILTER).


End of Document