summaryrefslogtreecommitdiff
path: root/src/tipideed/regular.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tipideed/regular.c')
-rw-r--r--src/tipideed/regular.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tipideed/regular.c b/src/tipideed/regular.c
index 24dc392..845f12b 100644
--- a/src/tipideed/regular.c
+++ b/src/tipideed/regular.c
@@ -15,13 +15,14 @@
#include <tipidee/method.h>
#include <tipidee/response.h>
+#include <tipidee/log.h>
#include "tipideed-internal.h"
int respond_regular (tipidee_rql const *rql, char const *fn, struct stat const *st, tipidee_resattr const *ra)
{
tain deadline ;
char fmt[128] ;
- size_t n = tipidee_response_status_line(buffer_1, rql, "200 OK") ;
+ size_t n = tipidee_response_status(buffer_1, rql, 200, "OK") ;
n += tipidee_response_header_common_put_g(buffer_1, !g.cont) ;
{
size_t l = tipidee_response_header_lastmodified(fmt, 128, st) ;
@@ -33,9 +34,9 @@ int respond_regular (tipidee_rql const *rql, char const *fn, struct stat const *
fmt[uint64_fmt(fmt, st->st_size)] = 0 ;
n += buffer_putsnoflush(buffer_1, fmt) ;
n += buffer_putnoflush(buffer_1, "\r\n\r\n", 4) ;
- log_regular(fn, fmt, rql->m == TIPIDEE_METHOD_HEAD, ra->content_type) ;
if (rql->m == TIPIDEE_METHOD_HEAD)
{
+ tipidee_log_answer(g.logv, rql, 200, st->st_size) ;
tain_add_g(&deadline, &g.writetto) ;
if (!buffer_timed_flush_g(buffer_1, &deadline))
strerr_diefu1sys(111, "write to stdout") ;
@@ -53,6 +54,7 @@ int respond_regular (tipidee_rql const *rql, char const *fn, struct stat const *
}
else die500sys(rql, 111, "open ", fn) ;
}
+ tipidee_log_answer(g.logv, rql, 200, st->st_size) ;
send_file(fd, st->st_size, fn) ;
fd_close(fd) ;
}
@@ -63,14 +65,14 @@ int respond_304 (tipidee_rql const *rql, char const *fn, struct stat const *st)
{
tain deadline ;
char fmt[128] ;
- size_t n = tipidee_response_status_line(buffer_1, rql, "304 Not Modified") ;
+ size_t n = tipidee_response_status(buffer_1, rql, 304, "Not Modified") ;
n += tipidee_response_header_common_put_g(buffer_1, !g.cont) ;
{
size_t l = tipidee_response_header_lastmodified(fmt, 128, st) ;
if (l) n += buffer_putnoflush(buffer_1, fmt, l) ;
}
n += buffer_putnoflush(buffer_1, "\r\n", 2) ;
- log_response("304", fn) ;
+ tipidee_log_answer(g.logv, rql, 304, 0) ;
tain_add_g(&deadline, &g.writetto) ;
if (!buffer_timed_flush_g(buffer_1, &deadline))
strerr_diefu1sys(111, "write to stdout") ;