-(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><tbody>
-<tr><t colspan=\"2\">mod_lisp debug</th></tr>
-<tr><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><td>~a</td><td>~a</td></tr>" key value))
- (write-string "</tbody></table></body></html>" s)))
-
-(defun fixed-html ()
- "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
-<html><head></head><body><h1>mod_lisp</h1>
-<p>This is a constant html string sent by mod_lisp</p></body></html>")