增加对GZIP压缩编码的解压缩功能及单元测试用例
This commit is contained in:
19
plugin/protocol/http/include/internal/http_convert.h
Normal file
19
plugin/protocol/http/include/internal/http_convert.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <tfe_http.h>
|
||||
#include <http_half.h>
|
||||
|
||||
struct hf_content_converter;
|
||||
|
||||
enum hf_content_conv_work_mode
|
||||
{
|
||||
HF_CONTENT_CONV_COMPRASS,
|
||||
HF_CONTENT_CONV_UNCOMPRASS
|
||||
};
|
||||
|
||||
int hf_content_converter_write(struct hf_content_converter * cv_object,
|
||||
struct http_half_private * hf_private, tfe_http_event http_ev, const unsigned char * data, size_t datalen);
|
||||
|
||||
void hf_content_converter_destroy(struct hf_content_converter * cv_object);
|
||||
|
||||
struct hf_content_converter * hf_content_converter_create(enum hf_content_conv_work_mode mode,
|
||||
unsigned int content_encode, hf_private_cb * data_cb, void * data_cb_user);
|
||||
@@ -21,6 +21,15 @@ struct http_header_private
|
||||
char * value;
|
||||
};
|
||||
|
||||
#define BV(x) (1 << x)
|
||||
#define HTTP_ACCEPT_ENCODING_IDENTITY BV(0)
|
||||
#define HTTP_ACCEPT_ENCODING_GZIP BV(1)
|
||||
#define HTTP_ACCEPT_ENCODING_DEFLATE BV(2)
|
||||
#define HTTP_ACCEPT_ENCODING_COMPRESS BV(3)
|
||||
#define HTTP_ACCEPT_ENCODING_BZIP2 BV(4)
|
||||
#define HTTP_ACCEPT_ENCODING_X_GZIP BV(5)
|
||||
#define HTTP_ACCEPT_ENCODING_X_BZIP2 BV(6)
|
||||
|
||||
TAILQ_HEAD(http_header_private_list, http_header_private);
|
||||
struct http_half_private
|
||||
{
|
||||
@@ -54,6 +63,9 @@ struct http_half_private
|
||||
struct evbuffer * evbuf_uri;
|
||||
char * url_storage;
|
||||
|
||||
/* Content-Encoding */
|
||||
uint16_t content_encoding;
|
||||
|
||||
/* Header Parser */
|
||||
struct evbuffer * evbuf_header_field;
|
||||
struct evbuffer * evbuf_header_value;
|
||||
@@ -104,8 +116,6 @@ struct http_session_private * hs_private_create(struct http_connection_private *
|
||||
|
||||
void hs_private_destory(struct http_session_private * hs_private);
|
||||
|
||||
|
||||
|
||||
void hs_private_hf_private_set(struct http_session_private * hs_private,
|
||||
struct http_half_private * hf, enum tfe_http_direction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user