mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-25 12:41:53 +08:00
fix: 修复 i18n.Tr vet 报错、Unicode 测试用例,移除过期域名
- 移除 i18n.Tr 中错误的 fmt.Sprintf fallback,消除 go vet 误报 - 修复 match_engine_test Unicode 测试用例与 Latin-1 转换逻辑不匹配 - README 移除过期的 fscan.club 域名 - 添加 .gitattributes 统一换行符为 LF
This commit is contained in:
@@ -355,18 +355,19 @@ func TestMatchPattern_BinaryData(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMatchPattern_UnicodeResponse 测试Unicode响应
|
||||
// TestMatchPattern_UnicodeResponse 测试Latin-1转换后的字节级匹配
|
||||
func TestMatchPattern_UnicodeResponse(t *testing.T) {
|
||||
compiled, _ := regexp.Compile(`服务器`)
|
||||
// bytesToLatin1String 按字节逐个映射到 Latin-1 码点
|
||||
// UTF-8 多字节字符会被拆开,所以用字节级正则匹配
|
||||
raw := []byte("HTTP/1.1 200 OK\r\nServer: test-srv\r\n")
|
||||
compiled, _ := regexp.Compile(`test-srv`)
|
||||
|
||||
m := &Match{
|
||||
PatternCompiled: compiled,
|
||||
}
|
||||
|
||||
response := []byte("HTTP/1.1 200 OK\r\nServer: 服务器\r\n")
|
||||
|
||||
result := m.MatchPattern(response)
|
||||
result := m.MatchPattern(raw)
|
||||
if !result {
|
||||
t.Error("Unicode内容应被匹配")
|
||||
t.Error("Latin-1字节级匹配应成功")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user