fn 200ok {
echo HTTP/1.1 200 OK
http_common
}
fn poweredby {
echo X-Powered-By: Plan 9 From Bell Labs
}
fn server {
echo Server: ip/httpd/httpd magic
}
fn http_common {
poweredby
server
datestamp
}
fn plain {
echo Content-Type: text/plain
}
fn pdf {
echo Content-Type: application/pdf
}
fn html {
echo Content-Type: text/html
}
fn length {
s = `{ls -l $1}
echo 'Content-Length: ' ^$s(6)
}
fn datestamp {
d = `{date}
echo Date: $d(1) ^, $d(3) $d(2) $d(6) $d(4) $d(5)
}
fn filename {
echo 'Content-Disposition: attachment; filename="' ^$1 ^'"'
}
|