diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib-http/http-request.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib-http/http-request.c b/src/lib-http/http-request.c new file mode 100644 index 0000000..aed9975 --- /dev/null +++ b/src/lib-http/http-request.c @@ -0,0 +1,32 @@ +/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "array.h" +#include "istream.h" + +#include "http-request.h" + +bool http_request_has_connection_option(const struct http_request *req, + const char *option) +{ + const char *opt; + + if (!array_is_created(&req->connection_options)) + return FALSE; + array_foreach_elem(&req->connection_options, opt) { + if (strcasecmp(opt, option) == 0) + return TRUE; + } + return FALSE; +} + +int http_request_get_payload_size(const struct http_request *req, + uoff_t *size_r) +{ + if (req->payload == NULL) { + *size_r = 0; + return 1; + } + + return i_stream_get_size(req->payload, TRUE, size_r); +} |