diff options
| author | lishu <[email protected]> | 2019-12-05 18:17:55 +0800 |
|---|---|---|
| committer | lishu <[email protected]> | 2019-12-05 18:17:55 +0800 |
| commit | dcb49ad5d9f717fdda3d0bdf6324c7332262d615 (patch) | |
| tree | 35f7ace884b2a4a2b6bd0ccda4eebdaebf1dee9d /src | |
| parent | bf0a31b981e86b055a15466959e0359024ee6b7a (diff) | |
增加http http_line2value函数,支持获取value内容
Diffstat (limited to 'src')
| -rw-r--r-- | src/HTTP_Analyze.c | 7 | ||||
| -rw-r--r-- | src/HTTP_Message.c | 13 | ||||
| -rw-r--r-- | src/http.h | 11 | ||||
| -rw-r--r-- | src/http_global.map | 1 | ||||
| -rw-r--r-- | src/http_update.txt | 4 |
5 files changed, 32 insertions, 4 deletions
diff --git a/src/HTTP_Analyze.c b/src/HTTP_Analyze.c index f567a13..f4b9a66 100644 --- a/src/HTTP_Analyze.c +++ b/src/HTTP_Analyze.c @@ -24,8 +24,8 @@ http_prog_runtime_parameter_t g_http_prog_para; -int G_HTTP_H_VERSION_3_20150320 = 0; -int G_HTTP_VERSION_4_20191112 = 0; +int G_HTTP_H_VERSION_4_20191205 = 0; +int G_HTTP_VERSION_4_20191205 = 0; void history() { //2014-12-09 V3.0 new documentAnalyze lib ; http.h add and delete ; @@ -102,6 +102,9 @@ void history() //2019-01-11 V4.0 //is_absolute_uri //2019-01-28 V4.0 //1. support Content-Range: bytes -154100106/154100107 2. bug:http_doWithGzipData 3. assert(session_info.buflen>=0); //2019-11-12 V4.0 //����http_host_parser���� + //2019-12-05 V4.0 //����http_line2value���� + + } /* diff --git a/src/HTTP_Message.c b/src/HTTP_Message.c index ebc6661..8d116eb 100644 --- a/src/HTTP_Message.c +++ b/src/HTTP_Message.c @@ -50,6 +50,19 @@ int http_line2region(const char *line, uint32 line_len, char** region, uint32* r return 0; } +int http_line2value(const char *line, uint32 line_len, char** value, uint32* value_len) +{ + /*line����ҵ��㣬��append,����lineǰ��Ŀո��Ѿ�ɾ����ֻ��Ҫɾ��: ֮��Ŀո�*/ + uint32 vlen=0, sp_offset=0; + char* colon_pos = (char*)memchr(line, ':', line_len); + if(NULL==colon_pos) return -1; + vlen = line_len - (colon_pos - line + 1); + http_deleteEmptyRow(&sp_offset, colon_pos+1, vlen); + *value = colon_pos+1+sp_offset; + *valuelen = vlen-sp_offset; + return 0; +} + /* old platform char* http_url_decode(char *data, int* data_len) { @@ -4,8 +4,10 @@ //20160905 add http_line2region //20191112 add http_host_parser function +//20191205 add http_line2value function -#define HTTP_H_VERSION_4_20191112 0 +#define HTTP_H_VERSION_4_20191205 0 +//#define HTTP_H_VERSION_4_20191112 0 //#define HTTP_H_VERSION_4_20160905 0 //#define HTTP_H_VERSION_3_20150321 0 @@ -214,6 +216,13 @@ extern "C" { */ int http_line2region(const char *line, uint32 line_len, char** region, uint32* region_len); /* +*����������(key:value)���value ��value_len +*����ֵ0�ɹ���-1:ʧ�� +*_key_:_value,ֻ����value +*/ +int http_line2value(const char *line, uint32 line_len, char** value, uint32* value_len); + +/* * �����ֶ�����region ����ֶε�proto_flag * region : ������host (in pcap)��Ҳ������HTTP_HOST(in http.conf) */ diff --git a/src/http_global.map b/src/http_global.map index 1947c3a..02f05e6 100644 --- a/src/http_global.map +++ b/src/http_global.map @@ -7,6 +7,7 @@ global: HTTP_PROT_FUNSTAT; HTTP_GETPLUGID; http_line2region; + http_line2value; http_region2proto_flag; http_proto_flag2region; http_get_method; diff --git a/src/http_update.txt b/src/http_update.txt index a777621..fb5db8f 100644 --- a/src/http_update.txt +++ b/src/http_update.txt @@ -1,4 +1,6 @@ - +*************************************************************** +20191205 +1.����http http_line2value������֧�ֻ�ȡvalue���� *************************************************************** 20191112 1.����http������������http_host_parser |
