diff options
| author | yangwei <[email protected]> | 2023-04-13 11:45:40 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-04-13 11:45:40 +0800 |
| commit | 0fc69f46ddc8d179de9083670930879d816c8df0 (patch) | |
| tree | ff3e1e06a40babf7ab63d512458a769b7369b959 /src | |
| parent | 177fac792dace1bce90964d88509e81a34e6fc59 (diff) | |
🧪 test(unit test): 移除http_test,http parseræµ‹è¯•ç”¨ä¾‹åŠ å…¥åˆ°gtest
Diffstat (limited to 'src')
| -rw-r--r-- | src/HTTP_Message.c | 2 | ||||
| -rw-r--r-- | src/HTTP_Message.h | 14 | ||||
| -rw-r--r-- | src/HTTP_Test.c | 167 |
3 files changed, 6 insertions, 177 deletions
diff --git a/src/HTTP_Message.c b/src/HTTP_Message.c index ae9ccd7..a6822e7 100644 --- a/src/HTTP_Message.c +++ b/src/HTTP_Message.c @@ -544,8 +544,6 @@ int HTTP_INIT(void) } } - /*http test*/ - http_test(); return 0; } diff --git a/src/HTTP_Message.h b/src/HTTP_Message.h index a1107e3..18b65d1 100644 --- a/src/HTTP_Message.h +++ b/src/HTTP_Message.h @@ -71,7 +71,7 @@ #define HTTP_STAT_HEADER_SPAN_BYTE 27 #define HTTP_MAX_STAT_FIELD 28 -/*������룬û��chunk��û��cont-length*/ +/*������룬û��chunk��û��cont-length*/ #define HTTP_TRANS_ENCOD_CNNTCLOSE 0X04//connection close #define HTTP_CHUNK_STATE_UNKONWN 0X00 @@ -126,8 +126,8 @@ typedef struct _session_infor_t typedef struct _fold_infor_t { - void* buf; //�۵��л����� - int buflen; //�۵��л�������С + void* buf; //�۵��л����� + int buflen; //�۵��л�������С }fold_infor_t; typedef struct _fold_buf_t @@ -154,9 +154,9 @@ typedef struct _http_parser_t char* phttp_begin; uint32 poneline_datalen; - uint32 processed_offset; //�Ѵ��������ڵ�ǰ����ƫ����,��������һ������Ҫ���� + uint32 processed_offset; //�Ѵ��������ڵ�ǰ����ƫ����,��������һ������Ҫ���� - uint64 packet_entity_len; //δ������ʵ�峤�� + uint64 packet_entity_len; //δ������ʵ�峤�� docanalyze_streamparam_t ungzip_handle; uint64 acc_cont_length; int64 batch_prot_flag; @@ -184,7 +184,7 @@ typedef struct _http_prog_runtime_parameter_t FILE* http_stat_file; void* http_log_handle; - void* region_hash; //��չ���ʶ�� + void* region_hash; //��չ���ʶ�� void* stat_handler; void* docanly_handler; @@ -232,8 +232,6 @@ struct http_proto_tag_t char buf[8]; }; -void http_test(); - #ifdef __cplusplus extern "C" { #endif diff --git a/src/HTTP_Test.c b/src/HTTP_Test.c deleted file mode 100644 index 1595db5..0000000 --- a/src/HTTP_Test.c +++ /dev/null @@ -1,167 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <pthread.h> -#include <dlfcn.h> -#include <math.h> -#include <stream.h> -#include "inc/http_parser.h" -#include "HTTP_Common.h" -#include "http.h" - - -/*http_host_parser_test Ð��ʶ������,host��������*/ -static const char * http_request = - /* - "POST /gen_204 HTTP/1.1\r\n" - "Host: www.google.com\r\n" - "Connection: close\r\n" - "Content-Length: 0\r\n" - "Origin: https://www.google.com\r\n" - "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\r\n" - "Content-Type: text/plain;charset=UTF-8\r\n" - "X-Client-Data: CJG2yQEIorbJAQjEtskBCKmdygEI2J3KAQjZncoBCKijygEY+aXKAQ==\r\n" - "Referer: https://www.google.com/\r\n" - "Accept-Encoding: gzip, deflate\r\n" - "Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7\r\n"; - */ - - "GET sampleFile.html HTTP/1.1\r\nUser-Agent:xPTS/2.0\r\n"; //http_parser����ʧ�ܣ�uri��/��ʼ - - -/*http_host_parser_test Ð��ʶ������,��host�ֶ�*/ -static const char * http_request_no_host = - "POST /gen_204 HTTP/1.1\r\n" - "Connection: close\r\n" - "Content-Length: 0\r\n" - "Origin: https://www.google.com\r\n" - "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\r\n" - "Content-Type: text/plain;charset=UTF-8\r\n" - "Accept: */*\r\n" - "X-Client-Data: CJG2yQEIorbJAQjEtskBCKmdygEI2J3KAQjZncoBCKijygEY+aXKAQ==\r\n" - "Referer: https://www.google.com/\r\n" - "Accept-Encoding: gzip, deflate\r\n" - "Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7\r\n"; - -/*http_host_parser_test Ð��ʶ������*/ -static const char * http_response = - //"HTTP/1.1 200 OK\r\nAccept-Ranges: bytes\r\nVary: Accept-Encoding\r\nContent-Type: text/javascript; charset=UTF-8\r\nContent-Length: 4064\r\nAge: 8963\r\n"; - "HTTP/1.1 200 OK\r\nDate: Mon, 25 Oct 2004 23:59:59 GMT\r\nContent-Type: text/html\r\nServer: xPTS/2.0 (Red.Hat.Linux)"; - -/*http_host_parser_test Ð��ʶ��������host����ʧ�ܣ���֧��\r*/ -static const char * http_request_CR = - "POST /gen_204 HTTP/1.1\r" - "Host: www.google.com\r" - "Connection: close\r" - "Content-Length: 0\r" - "Origin: https://www.google.com\r" - "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\r\n" - "Content-Type: text/plain;charset=UTF-8\r"; - -/*http_host_parser_test Ð��ʶ������������ʧ��*/ -static const char * http_reponse_CR = - "HTTP/1.1 200 OK\r" - "Accept-Ranges: bytes\r" - "Vary: Accept-Encoding\r\nContent-Type: text/javascript; charset=UTF-8\r\nContent-Length: 4064\r\nAge: 8963\r\n"; - -/*/*http_host_parser_test Ð��ʶ���������������hostΪclose����֧�ִ����*/ -static const char * http_request_LF = - "POST /gen_204 HTTP/1.1\n" - "host: \n" - "Connection: close\n" - "Content-Length: 0\n" - "Origin: https://www.google.com\n"; - -/*http_host_parser_test Ð��ʶ������,host��������*/ -static const char * http_request_SPACE = - "POST /gen_204 HTTP/1.1\r\n" - "HOST: www. google.com \r\n"; - -/*http_host_parser_test Ð��ʶ������,host��������*/ -static const char * http_request_incpomplete = - "POST /gen_204 HTTP/1.1\n" - "Host: www.googl"; - -/*http_host_parser_test Ð��ʶ������,host��������*/ -static const char * http_request_with_body = - "POST /gen_204 HTTP/1.1\r\n" - "Host: www.google.com\r\n" - "Connection: close\r\n" - "Content-Length: 0\r\n" - "Origin: https://www.google.com\r\n" - "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\r\n" - "Content-Type: text/plain;charset=UTF-8\r\n" - "Accept: */*\r\n" - "X-Client-Data: CJG2yQEIorbJAQjEtskBCKmdygEI2J3KAQjZncoBCKijygEY+aXKAQ==\r\n" - "Referer: https://www.google.com/\r\n" - "Accept-Encoding: gzip, deflate\r\n" - "Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7\r\n" - "\r\n" - "abcdjhjkhdlaks"; - -/*http_host_parser_test Ð��ʶ������,host��������*/ -static const char * http_request_space_start = - "\r \nPOST /gen_204 HTTP/1.1\r\n" - "Host: www.google.com\r\n" - "Connection: close\r\n" - "Content-Length: 0\r\n" - "Origin: https://www.google.com\r\n" - "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\r\n" - "Content-Type: text/plain;charset=UTF-8\r\n" - "Accept: */*\r\n" - "X-Client-Data: CJG2yQEIorbJAQjEtskBCKmdygEI2J3KAQjZncoBCKijygEY+aXKAQ==\r\n" - "Referer: https://www.google.com/\r\n" - "Accept-Encoding: gzip, deflate\r\n" - "Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7\r\n" - "\r\n" - "abcdjhjkhdlaks"; - - -void http_host_parser_test(const char* test_buf, int test_buf_dir) -{ - char* host = NULL; - uint32 hostlen = 0; - int rec = -1; - - /*�ж��Ƿ���httpÐ������*/ - rec = http_host_parser((const char*)test_buf, (uint32)strlen(test_buf), test_buf_dir, NULL); - if(-1==rec) - { - printf("not http data\n"); - } - else if(0==rec) - { - printf("is http data\n"); - } - - /*�ж��Ƿ���httpÐ�����ݣ�����ȡhost�ֶ�����*/ - rec = http_host_parser((const char*)test_buf, (uint32)strlen(test_buf), test_buf_dir, &host); - if(-1==rec) - { - printf("not http data\n"); - } - else if(0<=rec) - { - printf("is http data\n"); - if(0<rec) - { - printf("HOST: %.*s\n", (int)rec, host); - } - } - printf("http_host_parser_test end!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"); -} - -void http_test() -{ - /*http_host_parser_test����*/ - //http_host_parser_test(http_request, DIR_C2S); - //http_host_parser_test(http_request_no_host, DIR_C2S); - //http_host_parser_test(http_response, DIR_S2C); - //http_host_parser_test(http_request_CR, DIR_C2S); - //http_host_parser_test(http_reponse_CR, DIR_S2C); - //http_host_parser_test(http_request_LF, DIR_C2S); - //http_host_parser_test(http_request_SPACE, DIR_C2S); - //http_host_parser_test(http_request_incpomplete, DIR_C2S); - //http_host_parser_test(http_request_with_body, DIR_C2S); - //http_host_parser_test(http_request_space_start, DIR_C2S); -} |
