-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fixing output writing #2462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+223
−44
Merged
fixing output writing #2462
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Persistence is now split between
analyzeand the output loop, causing double writes without matchers and a uniqueness regression with matchers.The deferred persistence path (the output loop at lines 1303-1340) still writes the response file unconditionally for every matched result via plain
os.WriteFile(responsePath, data, 0644)— it does not useO_EXCLand does not apply the_<idx>suffix logic added here. Concrete consequences of the split:O_EXCLis then re-written (overwritten) by the output loop'sos.WriteFile, doubling I/O for every response.fileNameHashstays at the barehash(no_<idx>suffix). The hash issha1(method + ":" + URL.EscapedString()), which is identical across distinct results that share method+URL — e.g.-probe-all-ips(differentCustomIP, same URL string), thegoto retrypath after protocol fallback, or repeated probing. With matchers active those matched results all collide on the same<hash>.txtand silently overwrite each other.OmitBodyis a no-op in the deferred path. The output loop strips viastrings.ReplaceAll(resp.Raw, resp.ResponseBody, ""), butResult.ResponseBodyis only populated when-response/-base64-response/-mdc/-fdcare set (see lines 2180-2190). The branch here usesstring(resp.Data)and works correctly; the deferred branch leaves the body inresp.Rawon disk whenever-omit-bodyis combined with a matcher/filter without one of those flags.Recommendation: consolidate persistence into a single path. The cleanest fix is to drop this
analyze-side write entirely and move theO_EXCL+_<idx>uniqueness logic and thestring(resp.Data)-basedOmitBodyhandling into the output loop (which already runs after matcher/filter evaluation) so uniqueness, body omission, and "only matched" all work together. UpdatingResult.FileNameHashin the output loop after a successful create would keep downstream consumers (index.txt, callers) consistent.🤖 Prompt for AI Agents