summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2023-08-01 23:09:57 +0200
committerVincent Douillet <vincent@vdouillet.fr>2023-08-07 14:57:21 +0200
commitf172ffca292594147939280dab20cb03a4921fb6 (patch)
treebc63edcd5fbd474cdfdcced0d89b659c3bcc1cb4 /http.c
parent62b01654da4f1ae1a9aaeab106cea5e7bb9d77e3 (diff)
add log messages
Diffstat (limited to 'http.c')
-rw-r--r--http.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/http.c b/http.c
index 1f7b85b..d0fcbe8 100644
--- a/http.c
+++ b/http.c
@@ -28,6 +28,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include "http.h"
@@ -39,3 +41,25 @@ http_open(struct kreq * r, enum khttp code)
khttp_head(r, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[r->mime]);
khttp_body(r);
}
+
+void
+http_exit(struct kreq * r, enum khttp code, char *content,...)
+{
+ va_list args;
+
+ printf("Status: %s\n", khttps[code]);
+ printf("Content-Type: text/plain\n");
+ printf("\n");
+
+ if (content == NULL)
+ printf("%s", khttps[code]);
+ else {
+ va_start(args, content);
+ vprintf(content, args);
+ va_end(args);
+ }
+
+ va_start(args, content);
+ kutil_verr(r, NULL, content, args);
+ va_end(args);
+}