fix(fingers): treat empty Protocol as http during engine init#18
Merged
Conversation
From JSON/Cyberhub, Finger.Protocol may be empty string due to omitempty. Finger.Compile() defaults it to "http", but buildEngineFromFullFingers classifies by Protocol before Compile runs. Empty-protocol fingers were silently dropped, causing httpFingers to be empty. Downstream fingersEngine.NewEngine() then returns "fingers is nil", and the half-initialized engine (Aliases == nil) eventually panics in MergeFrameworks -> FindFramework. Fix: default empty Protocol to "http" at classification time, consistent with Finger.Compile() behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
从 JSON/Cyberhub 加载的 finger,Protocol 字段可能是空字符串(
omitempty省略)。Finger.Compile()会把空 Protocol 默认成"http",但buildEngineFromFullFingers在 Compile 之前就按 Protocol 分类。旧逻辑只认
"http"和"tcp",Protocol 为空的 HTTP 指纹被直接丢弃,导致httpFingers为空 →fingersEngine.NewEngine()返回"fingers is nil"→ 半初始化的 engine(Aliases == nil)被传到运行时 →MergeFrameworks调用Aliases.FindFramework()时 panic。修复
分类阶段把空 Protocol 按
"http"处理,和Finger.Compile()的默认行为保持一致。复现路径