From 2810ad72aeb973a898034d6875922284062c5ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 17 Sep 2021 17:02:29 +0200 Subject: Rework query functions Now, the value/parameter retrieval function handles both GET and POST parameters. --- t/front.t | 16 +++++++++++++++- t/front.tc | 14 +++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/front.t b/t/front.t index ed6fbf8..0a372a6 100644 --- a/t/front.t +++ b/t/front.t @@ -1,2 +1,16 @@

<%= site.name %>

-<% printf("Hello world!"); %> \ No newline at end of file +<% printf("Hello world!"); %> +
+Request method: <%= getenv("REQUEST_METHOD") %> +
+<% + char *a, *b, *bv; + a = nextparam(512); + printf("%s (%d)
", a, TRUNCATED(a)); + b = nextparam(512); + printf("%s (%d)
", b, TRUNCATED(b)); + bv = split(b); + printf("'%s' contains '%s'
", b, bv); + printf("Next: %s\n", nextparam(512)); + printf("Next: %s\n", nextparam(512)); +%> \ No newline at end of file diff --git a/t/front.tc b/t/front.tc index 0d7aec3..89e665a 100644 --- a/t/front.tc +++ b/t/front.tc @@ -1,4 +1,16 @@ printf("

"); printf("%s", site.name ); printf("

\n"); - printf("Hello world!"); printf("\n"); + printf("Hello world!"); printf("\n
\nRequest method: "); +printf("%s", getenv("REQUEST_METHOD") ); +printf("
\n"); + char *a, *b, *bv; + a = nextparam(512); + printf("%s (%d)
", a, TRUNCATED(a)); + b = nextparam(512); + printf("%s (%d)
", b, TRUNCATED(b)); + bv = split(b); + printf("'%s' contains '%s'
", b, bv); + printf("Next: %s\n", nextparam(512)); + printf("Next: %s\n", nextparam(512)); +printf("\n"); -- cgit v1.2.3