1
0
Fork 0
forked from fun/fun

More CGI Fun. (0.39.7)

This commit is contained in:
Johannes Findeisen 2026-03-25 22:44:32 +01:00
commit 3b70d6c92a
7 changed files with 494 additions and 175 deletions

View file

@ -32,7 +32,22 @@ html = html + "<h1>Hello, " + cgi.escape_html(name) + "!</h1>"
html = html + "<p>REQUEST_METHOD: " + cgi.escape_html(cgi.env["REQUEST_METHOD"]) + "</p>"
html = html + "<p>QUERY_STRING: " + cgi.escape_html(cgi.env["QUERY_STRING"]) + "</p>"
html = html + "<p>User-Agent cookie: " + cgi.escape_html(ua) + "</p>"
html = html + "<h2>Params</h2><pre>" + to_string(cgi.params()) + "</pre>"
// Render parsed CGI params as key => value(s)
pmap = cgi.params()
html = html + "<h2>Params</h2><ul>"
for k in keys(pmap)
vals = cgi.param_all(k)
// Join multiple values with ", "
i = 0
n = len(vals)
joined = ""
while (i < n)
if (i > 0)
joined = joined + ", "
joined = joined + cgi.escape_html(vals[i])
i = i + 1
html = html + "<li><b>" + cgi.escape_html(k) + "</b>: " + joined + "</li>"
html = html + "</ul>"
html = html + "</body></html>"
// Send CGI headers + body