diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-http/http-header.h | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib-http/http-header.h')
-rw-r--r-- | src/lib-http/http-header.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/lib-http/http-header.h b/src/lib-http/http-header.h new file mode 100644 index 0000000..59941d9 --- /dev/null +++ b/src/lib-http/http-header.h @@ -0,0 +1,45 @@ +#ifndef HTTP_HEADER_H +#define HTTP_HEADER_H + +struct http_header; + +struct http_header_limits { + uoff_t max_size; + uoff_t max_field_size; + unsigned int max_fields; +}; + +struct http_header_field { + const char *name; + const char *value; + size_t size; +}; +ARRAY_DEFINE_TYPE(http_header_field, struct http_header_field); + +static inline bool http_header_field_is(const struct http_header_field *hfield, + const char *name) +{ + return (strcasecmp(hfield->name, name) == 0); +} + +struct http_header * +http_header_create(pool_t pool, unsigned int init_count); + +const struct http_header_field * +http_header_field_add(struct http_header *header, + const char *name, const unsigned char *data, size_t size); +void http_header_field_delete(struct http_header *header, const char *name); + +const ARRAY_TYPE(http_header_field) * +http_header_get_fields(const struct http_header *header) ATTR_PURE; + +const struct http_header_field * +http_header_field_find(const struct http_header *header, const char *name) + ATTR_PURE; +const char * +http_header_field_get(const struct http_header *header, const char *name) + ATTR_PURE; +int http_header_field_find_unique(const struct http_header *header, + const char *name, const struct http_header_field **hfield_r); + +#endif |