summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
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);
+}