1.修改hjack读取profile文件方式
2.命中query替换规则后,http2适配http修改 3.添加URI测试用例
This commit is contained in:
@@ -152,7 +152,44 @@ TEST(PatternReplace, CaseInsensitiveRussian)
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
|
||||
|
||||
free(output);
|
||||
return;
|
||||
}
|
||||
|
||||
TEST(PatternReplace, QueryAdd)
|
||||
{
|
||||
const char * find = "(?<=\\?|^|&)q=([^&|^#]*)(?=&|$)";
|
||||
const char* replacement="q=find";
|
||||
const char* input="https://cn.bing.com/search?ei=pQnxXPS-LPSGr7wP3u6usAY&q=test&oq=test&gs_l=psy-ab.3..0i131i67j0l8j0i131.26791.27227..27885...0.0..0.235.683.0j3j1......0....1..gws-wiz.......0i71j0i67.klHdqBPS88k";
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
|
||||
printf("%s\n", output);
|
||||
free(output);
|
||||
return;
|
||||
}
|
||||
|
||||
TEST(PatternReplace, QueryDel)
|
||||
{
|
||||
const char * find = "(?<=\\?|^|&)sk=([^&|^#]*)(&|$)";
|
||||
const char* replacement="";
|
||||
const char* input="https://cn.bing.com/&search?q=find&qs=n&form=QBLH&sp=-1&pq=find&sk=";
|
||||
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
|
||||
printf("%s\n", output);
|
||||
free(output);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user