wsapi.cgi(1)
β¨ 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 π
wsapi.fcgi(1)β the FastCGI sibling, go say hi π
π«Ά 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
- debian bookworm: lua-wsapi 1.6.1-2 Β· MIT
- ubuntu jammy: lua-wsapi 1.6.1-1.1 Β· MIT
- ubuntu noble: lua-wsapi 1.6.1-2build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms