diff options
| author | lijia <[email protected]> | 2024-10-27 18:08:00 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2024-11-08 11:23:16 +0800 |
| commit | 627cfac992c52e3c7950355c0d447764056a5276 (patch) | |
| tree | afb5f8f462d964a764dbb071f5cfadad199cbe4d /decoders/http/http_decoder_decompress.h | |
| parent | d0a868591470a4a9d71a65a5d540058e72c8d92c (diff) | |
httpv2.0 rebase onto develop-2.0dev-http-v2.0
Diffstat (limited to 'decoders/http/http_decoder_decompress.h')
| -rw-r--r-- | decoders/http/http_decoder_decompress.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/decoders/http/http_decoder_decompress.h b/decoders/http/http_decoder_decompress.h new file mode 100644 index 0000000..fd82dd5 --- /dev/null +++ b/decoders/http/http_decoder_decompress.h @@ -0,0 +1,35 @@ +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include <stddef.h> +#include "stellar/http.h" + +#define HTTP_DECOMPRESS_BUFFER_SIZE (4096) + + enum http_content_encoding + { + HTTP_CONTENT_ENCODING_NONE = 0, + HTTP_CONTENT_ENCODING_GZIP = 1 << 1, + HTTP_CONTENT_ENCODING_DEFLATE = 1 << 2, + HTTP_CONTENT_ENCODING_BR = 1 << 3, + HTTP_CONTENT_ENCODING_UNKNOWN = 1 << 4, + }; + + struct http_content_decompress; + enum http_content_encoding http_content_encoding_str2int(const char *content_encoding, size_t encoding_str_len); + const char *http_content_encoding_int2str(enum http_content_encoding content_encoding); + struct http_content_decompress *http_content_decompress_create(enum http_content_encoding encoding); + void http_content_decompress_destroy(struct http_content_decompress *decompress); + // return 0 : success + // return -1 : error + int http_content_decompress_write(struct http_content_decompress *decompress, + const char *indata, size_t indata_len, + char **outdata, size_t *outdata_len); + void http_content_decompress_ownership_borrow(struct http_content_decompress *decompress); +#ifdef __cplusplus +} +#endif |
