Repository navigation
NTLM: cloneable body - #821
Merged
Merged
Conversation
Merged
There was a problem hiding this comment.
I would change b to body, f to file, etc. It makes reading the code easier :)
Contributor
Author
There was a problem hiding this comment.
Some internal go code uses short vars like this. The go community seems to favor shorter names like that. But I think I learn more towards your opinion on this :)
|
Other than some variable names this looks awesome. |
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.
This is a proposal to merge into #820. It's complicated enough that I think it could use its own review.
Instead of buffering the entire request body into an in-memory byte buffer, this uses an internal
cloneableBodytype that only buffers up to 1MB. Any overflow is then written to a local temp file. This type can also clone itself without reading the body again. It simply creates a new struct with the same 1MB byte buffer, and re-opens the temp file.Also, assuming all file handles are properly closed, a
cloneableBodybuffer will only delete the tempfile when the last one is closed.