diff options
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -33,6 +33,18 @@ #include <stdlib.h> #include "http.h" +#include "mime.h" + +void +http_open_file(struct kreq * r, enum khttp code, struct file * f) +{ + khttp_head(r, kresps[KRESP_STATUS], "%s", khttps[code]); + khttp_head(r, kresps[KRESP_CONTENT_DISPOSITION], + "attachment;filename=\"%s\"", f->name); + khttp_head(r, kresps[KRESP_CONTENT_TYPE], "%s", mime_str(f->mime)); + khttp_head(r, kresps[KRESP_CONTENT_LENGTH], "%zu", f->size); + khttp_body_compress(r, 0); /* file is not compressed */ +} void http_open(struct kreq * r, enum khttp code, enum kmime mime) |