diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2023-08-01 23:09:57 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2023-08-07 14:57:21 +0200 |
commit | f172ffca292594147939280dab20cb03a4921fb6 (patch) | |
tree | bc63edcd5fbd474cdfdcced0d89b659c3bcc1cb4 /http.c | |
parent | 62b01654da4f1ae1a9aaeab106cea5e7bb9d77e3 (diff) |
add log messages
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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); +} |