#!/usr/bin/env fun /* * This file is part of the Fun programming language. * https://fun-lang.xyz/ * * Copyright 2026 Johannes Findeisen * Licensed under the terms of the Apache-2.0 license. * https://opensource.org/license/apache-2-0 * * Added: 2026-03-25 */ #include cgi = CGI() name = cgi.param("name") if (len(name) == 0) name = "World" ua = cgi.cookie("ua") if (len(ua) == 0) // Set a demo cookie via header() cgi.header("Set-Cookie", "ua=FunClient; Path=/; HttpOnly") cgi.content_type("text/html; charset=utf-8") html = "" html = html + "Fun CGI" html = html + "

Hello, " + cgi.escape_html(name) + "!

" html = html + "

REQUEST_METHOD: " + cgi.escape_html(cgi.env["REQUEST_METHOD"]) + "

" html = html + "

QUERY_STRING: " + cgi.escape_html(cgi.env["QUERY_STRING"]) + "

" html = html + "

User-Agent cookie: " + cgi.escape_html(ua) + "

" html = html + "

Params

" + to_string(cgi.params()) + "
" html = html + "" // Send CGI headers + body cgi.send(html)