summaryrefslogtreecommitdiff
path: root/src/libtipidee/tipidee_response_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libtipidee/tipidee_response_file.c')
-rw-r--r--src/libtipidee/tipidee_response_file.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/libtipidee/tipidee_response_file.c b/src/libtipidee/tipidee_response_file.c
index f2021ee..b64d086 100644
--- a/src/libtipidee/tipidee_response_file.c
+++ b/src/libtipidee/tipidee_response_file.c
@@ -2,18 +2,15 @@
#include <stddef.h>
-#include <skalibs/types.h>
+#include <skalibs/uint64.h>
#include <skalibs/buffer.h>
-#include <tipidee/conf.h>
-#include <tipidee/method.h>
-#include <tipidee/rql.h>
#include <tipidee/response.h>
-#include <tipidee/util.h>
-size_t tipidee_response_file (buffer *b, tipidee_rql const *rql, unsigned int status, char const *reason, struct stat const *st, char const *ct, tipidee_response_header const *rhdr, uint32_t rhdrn, uint32_t options, tain const *stamp)
+size_t tipidee_response_file (buffer *b, tipidee_rql const *rql, unsigned int status, char const *reason, struct stat const *st, uint64_t cl, char const *ct, tipidee_response_header const *rhdr, uint32_t rhdrn, uint32_t options, tain const *stamp)
{
char fmt[128] ;
+ tipidee_response_header v[2] = { { .key = "Content-Type", .value = ct, .options = 0 }, { .key = "Content-Length", .value = fmt, .options = 0 } } ;
size_t n = tipidee_response_status(b, rql, status, reason) ;
n += tipidee_response_header_writeall(b, rhdr, rhdrn, options & 1, stamp) ;
if (options & 2)
@@ -21,11 +18,7 @@ size_t tipidee_response_file (buffer *b, tipidee_rql const *rql, unsigned int st
size_t l = tipidee_response_header_lastmodified(fmt, 128, st) ;
if (l) n += buffer_putnoflush(b, fmt, l) ;
}
- n += buffer_putsnoflush(b, "Content-Type: ") ;
- n += buffer_putsnoflush(b, ct) ;
- n += buffer_putsnoflush(b, "\r\nContent-Length: ") ;
- fmt[uint64_fmt(fmt, st->st_size)] = 0 ;
- n += buffer_putsnoflush(b, fmt) ;
- n += buffer_putnoflush(b, "\r\n\r\n", 4) ;
+ fmt[uint64_fmt(fmt, cl)] = 0 ;
+ n += tipidee_response_header_write(b, v, 2) ;
return n ;
}