- (write-string key *apache-socket*)
- (write-char #\NewLine *apache-socket*)
- (write-string value *apache-socket*)
- (write-char #\NewLine *apache-socket*))
-
-(defun header-value (command key)
- (cdr (assoc key command :test #'string=)))
-
-
-;;; Default (demo) processor
-
-(defun demo-apache-command-processor (command)
- "Sample function to process an apache command"
- (if (equal (header-value command "url") "/asp/fixed")
- (fixed-request)
- (debug-request command)))
-
-(defun fixed-request ()
- (let ((html (fixed-html)))
- (write-header-line "Status" "200 OK")
- (write-header-line "Content-Type" "text/html")
- (write-header-line "Content-Length" (format nil "~d" (length html)))
- (write-header-line "Keep-Socket" "1")
- (write-string "end" *apache-socket*)
- (write-char #\NewLine *apache-socket*)
- (write-string html *apache-socket*)
- (setq *close-apache-socket* nil)) )
-
-(defun debug-request (command)
- (let ((html (debug-table command)))
- (write-header-line "Status" "200 OK")
- (write-header-line "Content-Type" "text/html")
- (write-header-line "Keep-Socket" "0")
- (write-string "end" *apache-socket*)
- (write-char #\NewLine *apache-socket*)
- (write-string html *apache-socket*)
- (setq *close-apache-socket* t)) )
-
-(defun debug-table (command)
- (with-output-to-string (s)
- (write-string "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
-<HTML><HEAD></HEAD><BODY><TABLE bgcolor=\"#c0c0c0\">
-<TR bgcolor=\"yellow\"><TH COLSPAN=2>ACL 6.2 + mod_lisp 2.0 + apache + Linux</TH></TR>
-<TR bgcolor=\"yellow\"><TH>Key</TH><TH>Value</TH></TR>" s)
- (format s "<TR bgcolor=\"#F0F0c0\"><TD>apache-nb-use-socket</TD><TD>~a</TD></TR>" *apache-nb-use-socket*)
- (loop for (key . value) in command do
- (format s "<TR bgcolor=\"#F0F0c0\"><TD>~a</TD><TD>~a</TD></TR>" key value))
- (write-string "</TABLE></BODY></HTML>" s)))
-
-(defun fixed-html ()
- "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
-<HTML><HEAD></HEAD><BODY><H1>mod_lisp 2.0</H1><P>This is a constant
- html string sent by mod_lisp</P></BODY></HTML>")