--[[
  greetings.lua - Cadet example
  Christian Koch <cfkoch@sdf.lonestar.org>

  # /etc/inetd.conf:

    8899	stream	tcp	nowait:600	_httpd	/path/to/bozohttpd \
    httpd -L greetings /path/to/greetings.lua \
    /path/to/slashdir
]]

package.path = "/home/christian/devel/cadet/?.lua;" .. package.path
local Cadet = require("cadet")

Greetings = {}

function Greetings.index(env, headers, query)
  local res = Cadet.response
  local write = Cadet.write

  res.content_type = "text/html"
  res.status = 200

  write("<h1>Greetings, Cadet</h1>")
  write([[<img alt="" height="300" src="/WaterfallGarden.jpg"/>]])

  return Cadet.finish()
end

httpd.register_handler("index", Greetings.index)

--[[
  greetings.lua - Cadet example
  Christian Koch <cfkoch@sdf.lonestar.org>

  # /etc/inetd.conf:

    8899	stream	tcp	nowait:600	_httpd	/path/to/bozohttpd \
    httpd -L greetings /path/to/greetings.lua \
    /path/to/slashdir
]]

package.path = "/home/christian/devel/cadet/?.lua;" .. package.path
local Cadet = require("cadet")

Greetings = {}

function Greetings.index(env, headers, query)
  local res = Cadet.response
  local write = Cadet.write

  res.headers["Content-Type"] = "text/html"
  res.status = 200

  write("<h1>Greetings, Cadet</h1>")
  write([[<img alt="" height="300" src="/WaterfallGarden.jpg"/>]])

  return Cadet.finish()
end

httpd.register_handler("index", Greetings.index)

Update Greetings example to new headers API
Update Greetings example to new headers API
