From b8cb40fd46e1d41925198ff171b9fbf8362bc924 Mon Sep 17 00:00:00 2001 From: bptato Date: Fri, 15 Dec 2023 19:55:04 +0100 Subject: about: actually error out on error --- adapter/protocol/about.nim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'adapter/protocol') diff --git a/adapter/protocol/about.nim b/adapter/protocol/about.nim index 860294f3..02aacc00 100644 --- a/adapter/protocol/about.nim +++ b/adapter/protocol/about.nim @@ -3,12 +3,15 @@ import std/envvars const chawan = staticRead"res/chawan.html" const license = staticRead"res/license.html" -proc main() = +template printPage(s: static string) = stdout.write("Content-Type: text/html\n\n") + stdout.write(s) + +proc main() = case getEnv("MAPPED_URI_PATH") - of "blank": stdout.write("") - of "chawan": stdout.write(chawan) - of "license": stdout.write(license) - else: stdout.write("Error: about page not found") + of "blank": printPage("") + of "chawan": printPage(chawan) + of "license": printPage(license) + else: stdout.write("Cha-Control: ConnectionError 4 about page not found") main() -- cgit