;;; mhttpd.mhtml: -*- Meta-HTML -*-  Functions used by the server.
;;;
;;;  Copyright (c) 1997 Brian J. Fox
;;;  Author: Brian J. Fox (bfox@ai.mit.edu) Tue May 27 09:36:02 1997.
<defun mhtml::post-secure>
  <set-var names[]=<package-vars posted strip=true>>
  <foreach name names>
    <when <match <symbol-info posted::<get-var-once name>> STRING>>
      <copy-var POSTED::<get-var-once name>
		DEFAULT::<get-var-once name>>
      <subst-in-var <get-var-once name> "&" "&amp;" "<" "&lt;" ">" "&gt;">
    </when>
  </foreach>
</defun>

<defmacro mhtml::mime-type-mappings package=local>
  <set-var temp[]="%body" i=0 m=0 mhtml::metahtml-extensions[]="">
  <while <get-var temp[i]>>
    <set-var mapping=<get-var temp[i]>>
    <subst-in-var mapping "[ \t]+" "\n">
    <set-var mapping[]=<get-var mapping> j=1>
    <while <get-var mapping[j]>>
      <if <match <get-var mapping[0]> "metahtml/interpreted">
	  <prog
	    <set-var mhtml::metahtml-extensions[m]=".<get-var mapping[j]>">
	    <increment m>>>
      <set-var mime-type::.<get-var mapping[j]> = "<get-var mapping[0]>">
      <increment j>
    </while>
    <increment i>
  </while>
</defmacro>

