wsapi.cgi(1)

πŸ“¦
version 1.6.1 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

✨ wsapi.cgi ✨

ok so like, this is the wsapi.cgi page from the wsapi docs, and bestie, it's literally a CGI wrapper for wsapi-based dynamic pages. that's the whole vibe. πŸ’…


🌸 NAME 🌸

wsapi.cgi β€” a cgi wrapper for wsapi based dynamic pages πŸ¦‹


πŸ’– SYNOPSIS πŸ’–

#!/usr/bin/env wsapi.cgi

like yes, that's it. that's the shebang. that's the whole entry point. iconic. ✨


πŸŽ€ DESCRIPTION πŸŽ€

here's a sample dynamic page, bestie, so you can see exactly what the girlies are working with:

#!/usr/bin/env wsapi.cgi

module(..., package.seeall)

function run(wsapi_env)
  local headers = { ["Content-type"] = "text/html" }

  local function hello_text()
    coroutine.yield("<html><body>")
    coroutine.yield("<p>Hello Wsapi!</p>")
    coroutine.yield("<p>PATH_INFO: " .. wsapi_env.PATH_INFO .. "</p>")
    coroutine.yield("<p>SCRIPT_NAME: " .. wsapi_env.SCRIPT_NAME .. "</p>")
    coroutine.yield("</body></html>")
  end

  return 200, headers, coroutine.wrap(hello_text)
end

so you've got your run(wsapi_env) function, you've got your headers table with ["Content-type"] = "text/html", and then hello_text just yields chunks of HTML one at a time via coroutine.yield β€” <html><body>, then <p>Hello Wsapi!</p>, then wsapi_env.PATH_INFO and wsapi_env.SCRIPT_NAME all wrapped up pretty, then </body></html>. and the run function returns 200, headers, and coroutine.wrap(hello_text). no cap, that's the entire structure. πŸ”₯

ngl the coroutine situation is giving "streaming HTML with extra steps" but it's also kind of a serve, so we respect it. πŸ‘‘

🌈 SEE ALSO 🌈


🫢 AUTHOR 🫢

Enrico Tassi <gareuselesinge@debian.org> β€” thank you for your service king, we are obsessed πŸŽ€


and that's the whole page, bestie!! this was wsapi.cgi(1) from the wsapi documentation, dated 28 April 2009 β€” an absolute vintage moment, highkey a relic, and we love her for it. periodt. πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from