From 51d0fdce74aeb23ef28336037b2d35aa4c955cee Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 20 Dec 2023 14:08:25 +0000 Subject: Major refactors; implement ranges Signed-off-by: Laurent Bercot --- src/include/tipidee/response.h | 20 ++++++++++++-------- src/include/tipidee/util.h | 5 ++++- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/include') diff --git a/src/include/tipidee/response.h b/src/include/tipidee/response.h index 31b8df4..f912cd3 100644 --- a/src/include/tipidee/response.h +++ b/src/include/tipidee/response.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -35,21 +36,24 @@ extern size_t tipidee_response_header_date_G (char *, size_t) ; extern size_t tipidee_response_header_lastmodified (char *, size_t, struct stat const *) ; +extern size_t tipidee_response_header_write (buffer *, tipidee_response_header const *, uint32_t) ; 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_end (buffer *) ; + 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) +size_t tipidee_response_file (buffer *, tipidee_rql const *, unsigned int, char const *, struct stat const *, uint64_t, 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 *, uint64_t, char const *, tipidee_response_header const *, uint32_t, uint32_t) ; + +size_t tipidee_response_partial (buffer *, tipidee_rql const *, struct stat const *, uint64_t, uint64_t, char const *, tipidee_response_header const *, uint32_t, uint32_t, tain const *) ; +size_t tipidee_response_partial_G (buffer *, tipidee_rql const *, struct stat const *, uint64_t, uint64_t, char const *, tipidee_response_header const *, uint32_t, uint32_t) ; -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 size_t tipidee_response_error_nofile (buffer *, tipidee_rql const *, unsigned int, char const *, char const *, tipidee_response_header const *, uint32_t, 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, tipidee_response_header const *, uint32_t, uint32_t) ; extern int tipidee_response_header_preparebuiltin (tipidee_response_header *, uint32_t, char const *, size_t) ; diff --git a/src/include/tipidee/util.h b/src/include/tipidee/util.h index 7870a23..18eb2ce 100644 --- a/src/include/tipidee/util.h +++ b/src/include/tipidee/util.h @@ -3,9 +3,10 @@ #ifndef TIPIDEE_UTIL_H #define TIPIDEE_UTIL_H -#include +#include #include +#include #include #include #include @@ -31,4 +32,6 @@ extern int tipidee_util_chunked_read (buffer *, stralloc *, size_t, tain const * extern int tipidee_util_httpdate (char const *, tain *) ; extern int tipidee_util_defaulttext (unsigned int, tipidee_defaulttext *) ; +extern int tipidee_util_parse_range (char const *, off_t, uint64_t *, uint64_t *) ; + #endif -- cgit v1.3.1