Implement incremental writing of HAR file#729
Merged
Mzack9999 merged 6 commits intoprojectdiscovery:devfrom Sep 10, 2025
Merged
Implement incremental writing of HAR file#729Mzack9999 merged 6 commits intoprojectdiscovery:devfrom
Mzack9999 merged 6 commits intoprojectdiscovery:devfrom
Conversation
Use martian's HAR package to Export() logs periodically. This enables proxify to save some HAR logs even if it crashes unexpectedly. However, it does not reduce the burden on RAM usage caused by martian keeping track of all the reqs/resps. Signed-off-by: MJ Kim <mjkim610@gmail.com>
Replace Export() with ExportAndReset(). This allows martian to flush its memory of completed reqs/resps. There are several ways to append new logs into the existing HAR file. 1. read-merge-overwrite: less error-prone, but overhead caused by overwriting 2. parse-append: less overhead, but more complex logic and more error-prone The read-merge-overwrite approach is chosen in this commit. Signed-off-by: MJ Kim <mjkim610@gmail.com>
Contributor
Author
|
Closes #728 |
- Move all the logic related to HAR logging into a new package `har`. - Clean up HAR logging code - Add `done` channel and `wg` WaitGroup for exiting goroutine Signed-off-by: MJ Kim <mjkim610@gmail.com>
- Add har_test.go - Add argument to NewLogger to make DI possible and change flush interval (for testing purposes) Signed-off-by: MJ Kim <mjkim610@gmail.com>
Mzack9999
approved these changes
Sep 10, 2025
Mzack9999
approved these changes
Sep 10, 2025
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.
Proposed changes
Checklist