;;; engine.conf: -*- Meta-HTML -*-  Typical startup file for (nph-)Engine.
;;;
;;; Copyright (c) 1996 Brian J. Fox
;;; Author: Brian J. Fox (bfox@ai.mit.edu) Sat Sep 14 03:51:33 1996.

;;; You set the variable MHTML::DOCUMENT-ROOT to tell the engine
;;; where your documents are being served from.  If the location
;;; of the engine is "/www/metahtml/docs/cgi-bin/nph-engine", then
;;; the default document root is "/www/metahtml/docs".  This may or
;;; may not be correct for your site.  Simply set the variable here if
;;; it is not.
;;; <set-var mhtml::document-root = /www/metahtml/docs>

;;; The user that you would like the engine to run under.
;;; This only has an effect if the engine is already running as the
;;; root user.
;;; <set-var mhtml::default-user = nobody>

;;; If you wish to allow your users to store documents underneath
;;; their home directories, then set this variable to be the name of
;;; the subdirectory under which users store their documents.  For
;;; example, if the URL "/~bfox/welcome.mhtml" should be served from
;;; a subdirectory of Brian Fox's home directory called "public_html",
;;; then you would do:
;;;
;;; <defvar mhtml::~directory  public_html>

;;; Use cookies that appear permanent to the client.
<set-var mhtml::permanent-cookies = true>

;;; Top level cgi-directory.  Actually an array of possible cgi directories.
<set-var mhtml::cgi-directories[0]=/cgi-bin/>

;;; Analogous to MHTML::PROLOGUE-DOCUMENT is MHTML::PER-PAGE-FUNCTION.
;;; You probably only need one or the other, but not both.  If this
;;; variable is set to the name of a defun, defsubst, or defmacro,
;;; then that function is called with no arguments.  Here is the
;;; default that we recommend -- it makes all posted data innocuous.
;;;
;;; If you turn this off, you will have to make sure that your pages
;;; are written in a secure fashion.  Please see the manual
;;; description of <get-var-once> for more details.
;;;
<defun mhtml::engine-per-page-function>
  mhtml::post-secure>
  ;;;
  ;;; Code that sets up the URL rewriter.  This has to be a per-page function
  ;;; because we haven't computed the URL of the document at the time
  ;;; this engine.conf file is read, so variables such as mhtml::http-prefix
  ;;; aren't set yet, and will be changed at the time the page location is
  ;;; computed.
  <when <get-var rewriter::engine-webpath>>
    <set-var
      mhtml::http-prefix = <get-var mhtml::http-prefix
			     rewriter::engine-webpath>
      mhtml::http-prefix-sans-sid = <get-var mhtml::http-prefix-sans-sid
				      rewriter::engine-webpath>
      mhtml::url-to-dir = <get-var mhtml::http-prefix mhtml::relative-prefix>
      mhtml::url-to-dir-sans-sid = <get-var mhtml::http-prefix-sans-sid
				     mhtml::relative-prefix>
      mhtml::full-url = <get-var mhtml::http-prefix mhtml::location>>
    <copy-var *meta-html*::rewriter::a *meta-html*::a>
    <copy-var *meta-html*::rewriter::img *meta-html*::img>
    <copy-var *meta-html*::rewriter::form *meta-html*::form>
  </when>
</defun>

<set-var mhtml::per-page-function = mhtml::engine-per-page-function>
<set-var mime-type::.asp=metahtml/interpreted>

;;; If your Web server cannot perform the necessary mappings to run
;;; the Meta-HTML Engine from "/", then set REWRITER::ENGINE-WEBPATH
;;; to be the path to the Meta-HTML engine.
;;;
;;; If this variable is set, then we install code to rewrite URL
;;; references in Meta-HTML pages, such that constructs such as
;;; <a href="/foo"> ... </a> get translated to
;;;  <a href="/cgi-bin/nph-engine/foo"> ... </a>.
;;;
;;; The rewriter code can be used to rewrite various references in any
;;; case -- simply do the COPY-VARs below without changing the
;;; variables mhtml::http-prefix or rewriter::rewrite-prefix.  Then,
;;; references in your pages which looked like <img src="/images/foo.gif">
;;; get rewritten to say <img src="http://www.foo.com/images/foo.gif">
;;; instead.
;;;
;;; <set-var rewriter::engine-webpath = /cgi-bin/nph-engine>
