diff options
Diffstat (limited to 'src/tipideed/options.c')
-rw-r--r-- | src/tipideed/options.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tipideed/options.c b/src/tipideed/options.c new file mode 100644 index 0000000..d425943 --- /dev/null +++ b/src/tipideed/options.c @@ -0,0 +1,25 @@ +/* ISC license. */ + +#include <string.h> + +#include <skalibs/buffer.h> +#include <skalibs/strerr.h> +#include <skalibs/tai.h> +#include <skalibs/unix-timed.h> + +#include <tipidee/response.h> +#include "tipideed-internal.h" + +int respond_options (tipidee_rql const *rql, uint32_t flags) +{ + tain deadline ; + tipidee_response_status_line(buffer_1, rql, "200 OK") ; + tipidee_response_header_common_put_g(buffer_1, 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) ; + tain_add_g(&deadline, &g.writetto) ; + if (!buffer_timed_flush_g(buffer_1, &deadline)) + strerr_diefu1sys(111, "write to stdout") ; + return 0 ; +} |