diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/tipidee/response.h | 8 | ||||
-rw-r--r-- | src/libtipidee/deps-lib/tipidee | 5 | ||||
-rw-r--r-- | src/libtipidee/tipidee_response_error_nofile_G.c | 12 | ||||
-rw-r--r-- | src/libtipidee/tipidee_response_file_G.c | 12 | ||||
-rw-r--r-- | src/libtipidee/tipidee_response_header_date_G.c | 12 | ||||
-rw-r--r-- | src/libtipidee/tipidee_response_header_writeall_G.c | 12 | ||||
-rw-r--r-- | src/libtipidee/tipidee_response_header_writemerge_G.c | 12 | ||||
-rw-r--r-- | src/tipideed/cgi.c | 2 | ||||
-rw-r--r-- | src/tipideed/options.c | 2 | ||||
-rw-r--r-- | src/tipideed/regular.c | 6 | ||||
-rw-r--r-- | src/tipideed/responses.c | 10 | ||||
-rw-r--r-- | src/tipideed/trace.c | 2 |
12 files changed, 84 insertions, 11 deletions
diff --git a/src/include/tipidee/response.h b/src/include/tipidee/response.h index ea0e835..31b8df4 100644 --- a/src/include/tipidee/response.h +++ b/src/include/tipidee/response.h @@ -28,19 +28,27 @@ struct tipidee_response_header_s extern size_t tipidee_response_status (buffer *, tipidee_rql const *, unsigned int, char const *) ; extern size_t tipidee_response_header_date_fmt (char *, size_t, tain const *) ; + extern size_t tipidee_response_header_date (char *, size_t, tain const *) ; +extern size_t tipidee_response_header_date_G (char *, size_t) ; #define tipidee_response_header_date_g(buf, max) tipidee_response_header_date(buf, (max), &STAMP) + extern size_t tipidee_response_header_lastmodified (char *, size_t, struct stat const *) ; extern size_t tipidee_response_header_writeall (buffer *, tipidee_response_header const *, uint32_t, uint32_t, tain const *) ; +extern size_t tipidee_response_header_writeall_G (buffer *, tipidee_response_header const *, uint32_t, uint32_t) ; #define tipidee_response_header_writeall_g(b, rhdr, rhdrn, options) tipidee_response_header_writeall(b, rhdr, rhdrn, (options), &STAMP) + extern size_t tipidee_response_header_writemerge (buffer *, tipidee_response_header const *, uint32_t, tipidee_headers const *, uint32_t, tain const *) ; +extern size_t tipidee_response_header_writemerge_G (buffer *, tipidee_response_header const *, uint32_t, tipidee_headers const *, uint32_t) ; #define tipidee_response_header_writemerge_g(b, rhdr, rhdrn, hdr, options) tipidee_response_header_writemerge(b, rhdr, rhdrn, hdr, (options), &STAMP) size_t tipidee_response_file (buffer *, tipidee_rql const *, unsigned int, char const *, struct stat const *, char const *, tipidee_response_header const *, uint32_t, uint32_t, tain const *) ; +size_t tipidee_response_file_G (buffer *, tipidee_rql const *, unsigned int, char const *, struct stat const *, char const *, tipidee_response_header const *, uint32_t, uint32_t) ; #define tipidee_response_file_g(b, rql, status, reason, st, ct, rhdr, rhdrn, options) tipidee_response_file(b, rql, status, reason, st, ct, rhdr, rhdrn, (options), &STAMP) extern size_t tipidee_response_error_nofile (buffer *, tipidee_rql const *, unsigned int, char const *, char const *, tipidee_response_header const *, uint32_t, uint32_t, tain const *) ; +extern size_t tipidee_response_error_nofile_G (buffer *, tipidee_rql const *, unsigned int, char const *, char const *, tipidee_response_header const *, uint32_t, uint32_t) ; #define tipidee_response_error_nofile_g(b, rql, status, reason, text, rhdr, rhdrn, options) tipidee_response_error_nofile(b, rql, status, reason, text, rhdr, rhdrn, (options), &STAMP) extern int tipidee_response_header_preparebuiltin (tipidee_response_header *, uint32_t, char const *, size_t) ; diff --git a/src/libtipidee/deps-lib/tipidee b/src/libtipidee/deps-lib/tipidee index d71ef89..985be7e 100644 --- a/src/libtipidee/deps-lib/tipidee +++ b/src/libtipidee/deps-lib/tipidee @@ -21,13 +21,18 @@ tipidee_log_request.o tipidee_log_start.o tipidee_method.o tipidee_response_error_nofile.o +tipidee_response_error_nofile_G.o tipidee_response_file.o +tipidee_response_file_G.o tipidee_response_header_date.o +tipidee_response_header_date_G.o tipidee_response_header_date_fmt.o tipidee_response_header_lastmodified.o tipidee_response_header_preparebuiltin.o tipidee_response_header_writeall.o +tipidee_response_header_writeall_G.o tipidee_response_header_writemerge.o +tipidee_response_header_writemerge_G.o tipidee_response_status.o tipidee_rql_read.o tipidee_uri_parse.o diff --git a/src/libtipidee/tipidee_response_error_nofile_G.c b/src/libtipidee/tipidee_response_error_nofile_G.c new file mode 100644 index 0000000..d7239cc --- /dev/null +++ b/src/libtipidee/tipidee_response_error_nofile_G.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +#include <tipidee/response.h> + +size_t tipidee_response_error_nofile_G (buffer *b, tipidee_rql const *rql, unsigned int status, char const *reason, char const *text, tipidee_response_header const *rhdr, uint32_t rhdrn, uint32_t options) +{ + tain wstamp ; + tain_wallclock_read(&wstamp) ; + return tipidee_response_error_nofile(b, rql, status, reason, text, rhdr, rhdrn, options, &wstamp) ; +} diff --git a/src/libtipidee/tipidee_response_file_G.c b/src/libtipidee/tipidee_response_file_G.c new file mode 100644 index 0000000..8c08c98 --- /dev/null +++ b/src/libtipidee/tipidee_response_file_G.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +#include <tipidee/response.h> + +size_t tipidee_response_file_G (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 wstamp ; + tain_wallclock_read(&wstamp) ; + return tipidee_response_file(b, rql, status, reason, st, ct, rhdr, rhdrn, options, &wstamp) ; +} diff --git a/src/libtipidee/tipidee_response_header_date_G.c b/src/libtipidee/tipidee_response_header_date_G.c new file mode 100644 index 0000000..6d06d81 --- /dev/null +++ b/src/libtipidee/tipidee_response_header_date_G.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +#include <tipidee/response.h> + +size_t tipidee_response_header_date_G (char *s, size_t max) +{ + tain wstamp ; + tain_wallclock_read(&wstamp) ; + return tipidee_response_header_date(s, max, &wstamp) ; +} diff --git a/src/libtipidee/tipidee_response_header_writeall_G.c b/src/libtipidee/tipidee_response_header_writeall_G.c new file mode 100644 index 0000000..b448395 --- /dev/null +++ b/src/libtipidee/tipidee_response_header_writeall_G.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +#include <tipidee/response.h> + +size_t tipidee_response_header_writeall_G (buffer *b, tipidee_response_header const *rhdr, uint32_t rhdrn, uint32_t options) +{ + tain wstamp ; + tain_wallclock_read(&wstamp) ; + return tipidee_response_header_writeall(b, rhdr, rhdrn, options, &wstamp) ; +} diff --git a/src/libtipidee/tipidee_response_header_writemerge_G.c b/src/libtipidee/tipidee_response_header_writemerge_G.c new file mode 100644 index 0000000..78a7526 --- /dev/null +++ b/src/libtipidee/tipidee_response_header_writemerge_G.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <skalibs/tai.h> + +#include <tipidee/response.h> + +size_t tipidee_response_header_writemerge_G (buffer *b, tipidee_response_header const *rhdr, uint32_t rhdrn, tipidee_headers const *hdr, uint32_t options) +{ + tain wstamp ; + tain_wallclock_read(&wstamp) ; + return tipidee_response_header_writemerge(b, rhdr, rhdrn, hdr, options, &wstamp) ; +} diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c index 3319099..12b2155 100644 --- a/src/tipideed/cgi.c +++ b/src/tipideed/cgi.c @@ -323,7 +323,7 @@ static inline int process_cgi_output (tipidee_rql *rql, char const *docroot, tip } tipidee_response_status(buffer_1, rql, status, reason) ; - tipidee_response_header_writemerge_g(buffer_1, g.rhdr, g.rhdrn, hdr, !g.cont) ; + tipidee_response_header_writemerge_G(buffer_1, g.rhdr, g.rhdrn, hdr, !g.cont) ; { char fmt[SIZE_FMT] ; fmt[size_fmt(fmt, rbodylen)] = 0 ; diff --git a/src/tipideed/options.c b/src/tipideed/options.c index ce25a81..0ecbb6f 100644 --- a/src/tipideed/options.c +++ b/src/tipideed/options.c @@ -15,7 +15,7 @@ int respond_options (tipidee_rql const *rql, uint32_t flags) { tain deadline ; tipidee_response_status(buffer_1, rql, 200, "OK") ; - tipidee_response_header_writeall_g(buffer_1, g.rhdr, g.rhdrn, 0) ; + tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, 0) ; buffer_putsnoflush(buffer_1, "Content-Length: 0\r\nAllow: GET, HEAD") ; if (flags & 1) buffer_putsnoflush(buffer_1, ", POST") ; buffer_putnoflush(buffer_1, "\r\n\r\n", 4) ; diff --git a/src/tipideed/regular.c b/src/tipideed/regular.c index 2228f92..67fba35 100644 --- a/src/tipideed/regular.c +++ b/src/tipideed/regular.c @@ -22,7 +22,7 @@ int respond_regular (tipidee_rql const *rql, char const *docroot, char const *fn if (rql->m == TIPIDEE_METHOD_HEAD) { tain deadline ; - tipidee_response_file_g(buffer_1, rql, 200, "OK", st, ra->content_type, g.rhdr, g.rhdrn, 2 | !g.cont) ; + tipidee_response_file_G(buffer_1, rql, 200, "OK", st, ra->content_type, g.rhdr, g.rhdrn, 2 | !g.cont) ; tipidee_log_answer(g.logv, rql, 200, st->st_size) ; tain_add_g(&deadline, &g.writetto) ; if (!buffer_timed_flush_g(buffer_1, &deadline)) @@ -40,7 +40,7 @@ int respond_regular (tipidee_rql const *rql, char const *docroot, char const *fn } else die500sys(rql, 111, docroot, "open ", fn) ; } - tipidee_response_file_g(buffer_1, rql, 200, "OK", st, ra->content_type, g.rhdr, g.rhdrn, 2 | !g.cont) ; + tipidee_response_file_G(buffer_1, rql, 200, "OK", st, ra->content_type, g.rhdr, g.rhdrn, 2 | !g.cont) ; tipidee_log_answer(g.logv, rql, 200, st->st_size) ; send_file(fd, st->st_size, fn) ; fd_close(fd) ; @@ -53,7 +53,7 @@ int respond_304 (tipidee_rql const *rql, char const *fn, struct stat const *st) tain deadline ; char fmt[128] ; tipidee_response_status(buffer_1, rql, 304, "Not Modified") ; - tipidee_response_header_writeall_g(buffer_1, g.rhdr, g.rhdrn, !g.cont) ; + tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, !g.cont) ; { size_t l = tipidee_response_header_lastmodified(fmt, 128, st) ; if (l) buffer_putnoflush(buffer_1, fmt, l) ; diff --git a/src/tipideed/responses.c b/src/tipideed/responses.c index 2f1df9d..ad53351 100644 --- a/src/tipideed/responses.c +++ b/src/tipideed/responses.c @@ -24,7 +24,7 @@ void response_error_early (tipidee_rql const *rql, unsigned int status, char const *reason, char const *text, uint32_t options) { tain deadline ; - tipidee_response_error_nofile_g(buffer_1, rql, status, reason, text, g.rhdr, g.rhdrn, options & 1 || !g.cont) ; + tipidee_response_error_nofile_G(buffer_1, rql, status, reason, text, g.rhdr, g.rhdrn, options & 1 || !g.cont) ; tain_add_g(&deadline, &g.writetto) ; if (!buffer_timed_flush_g(buffer_1, &deadline)) strerr_diefu1sys(111, "write to stdout") ; @@ -88,7 +88,7 @@ void response_error (tipidee_rql const *rql, char const *docroot, unsigned int s } else { - tipidee_response_file_g(buffer_1, rql, status, dt.reason, &st, tipidee_conf_get_content_type(&g.conf, g.sa.s + salen + g.cwdlen + 1), g.rhdr, g.rhdrn, options) ; + tipidee_response_file_G(buffer_1, rql, status, dt.reason, &st, tipidee_conf_get_content_type(&g.conf, g.sa.s + salen + g.cwdlen + 1), g.rhdr, g.rhdrn, options) ; tipidee_log_answer(g.logv, rql, status, st.st_size) ; send_file(fd, st.st_size, g.sa.s + salen + g.cwdlen + 1) ; fd_close(fd) ; @@ -100,7 +100,7 @@ void response_error (tipidee_rql const *rql, char const *docroot, unsigned int s g.sa.len = salen ; } - tipidee_response_error_nofile_g(buffer_1, rql, status, dt.reason, dt.text, g.rhdr, g.rhdrn, options & 1 || !g.cont) ; + tipidee_response_error_nofile_G(buffer_1, rql, status, dt.reason, dt.text, g.rhdr, g.rhdrn, options & 1 || !g.cont) ; tipidee_log_answer(g.logv, rql, status, 0) ; tain_add_g(&deadline, &g.writetto) ; if (!buffer_timed_flush_g(buffer_1, &deadline)) @@ -126,7 +126,7 @@ void exit_405_ (tipidee_rql const *rql, uint32_t options) { tain deadline ; tipidee_response_status(buffer_1, rql, 405, "Method Not Allowed") ; - tipidee_response_header_writeall_g(buffer_1, g.rhdr, g.rhdrn, 1) ; + tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, 1) ; buffer_putsnoflush(buffer_1, "Allow: GET, HEAD") ; if (options & 1) buffer_putsnoflush(buffer_1, ", POST") ; buffer_putnoflush(buffer_1, "\r\n\r\n", 4) ; @@ -143,7 +143,7 @@ void respond_30x (tipidee_rql const *rql, tipidee_redirection const *rd) static char const *const reason[4] = { "Temporary Redirect", "Permanent Redirect", "Found", "Moved Permanently" } ; tain deadline ; tipidee_response_status(buffer_1, rql, status[rd->type], reason[rd->type]) ; - tipidee_response_header_writeall_g(buffer_1, g.rhdr, g.rhdrn, 0) ; + tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, 0) ; buffer_putsnoflush(buffer_1, "Content-Length: 0\r\nLocation: ") ; buffer_putsnoflush(buffer_1, rd->location) ; if (rd->sub) buffer_putsnoflush(buffer_1, rd->sub) ; diff --git a/src/tipideed/trace.c b/src/tipideed/trace.c index 0e2ccac..1186675 100644 --- a/src/tipideed/trace.c +++ b/src/tipideed/trace.c @@ -19,7 +19,7 @@ int respond_trace (tipidee_rql const *rql, tipidee_headers const *hdr) size_t cl = 0 ; char fmt[SIZE_FMT] ; tipidee_response_status(buffer_1, rql, 200, "OK") ; - tipidee_response_header_writeall_g(buffer_1, g.rhdr, g.rhdrn, 0) ; + tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, 0) ; buffer_putsnoflush(buffer_1, "Content-Type: message/http\r\nContent-Length: ") ; cl += strlen(tipidee_method_tostr(rql->m)) + 1; if (rql->uri.host) cl += 7 + rql->uri.https + strlen(rql->uri.host) ; |