tprint a status header (for httpd/cgi) to be able to signal some errors - vote - simple cgi voting system for web and gopher
(HTM) git clone git://src.adamsgaard.dk/vote
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit f5592f94b672d1c35cb7e58f1aa1d5104c4331c3
(DIR) parent bdffc606de2cab60a78349fe387c97a0a0220e38
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 4 Oct 2020 15:48:09 +0200
print a status header (for httpd/cgi) to be able to signal some errors
Signed-off-by: Anders Damsgaard <anders@adamsgaard.dk>
Diffstat:
M vote.c | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/vote.c b/vote.c
t@@ -181,6 +181,7 @@ create_poll_file(const char *name, const char *question, const char *options)
char *fname;
if (!*name || !*question || !*options) {
+ http_status(401);
puts("<p><b>Error: Could not create poll</b></p>");
puts("<ul>");
if (!*name)
t@@ -195,6 +196,7 @@ create_poll_file(const char *name, const char *question, const char *options)
fname = pollfile(name, "");
if (stat(fname, &sb) == 0) {
+ http_status(401);
printf("<p>Poll '%s' already exists</p>", name);
return -1;
} else {