#! /usr/bin/env racket
#lang racket/base
(require racket/port
(planet neil/html-template:1:1)
(planet neil/scgi:2:0))
(cgi #:request
(lambda ()
(display "Content-type: text/html\r\n\r\n")
(html-template
(html (head (title "sample-1.ss"))
(body (h1 "SCGI sample-1.ss")
(p "Hello, world.")
(p (code "(cgi-type) ")
(& rArr)
(code " " (% (format "~S" (cgi-type)))))
(p (code "(cgi-request-method) ")
(& rArr)
(code " " (% (format "~S" (cgi-request-method)))))
(p (code "(cgi-request-uri) ")
(& rArr)
(code " " (% (format "~S" (cgi-request-uri)))))
(p (code "(cgi-content-length) ")
(& rArr)
(code " " (% (format "~S" (cgi-content-length)))))
(h2 "SCGI Variables")
(p (code (% (format "~S" (scgi-variables)))))
(%eval/effects-only
(if (equal? (cgi-request-method) "POST")
(html-template
(h2 "POST Data")
(% (format "~S" (port->bytes)))) (html-template
(h2 "Test POST Form")
(form (@ (action "")
(method "POST"))
(p (input (@ (type "text") (name "Alpha") (size "10") (value "XXX"))))
(p (input (@ (type "text") (name "Bravo") (size "10") (value "YYY"))))
(p (input (@ (type "submit")))))))))))
(newline)))