Lazy load request/response bodies fixes #50#86
Merged
chirino merged 2 commits intoroastedroot:mainfrom Jun 2, 2025
Merged
Conversation
…estBody class • Created new HttpRequestBody class to encapsulate lazy loading logic and state • Refactored PluginHttpContext to use HttpRequestBody instead of managing state directly • Updated ProxyWasmFilter to use shared HttpRequestBody instance across plugins • Improved request body processing loop with proper action handling • Enhanced type safety by removing Object-based field types • Moved body state management from context to dedicated supplier class This refactoring addresses memory efficiency concerns by only loading request bodies when WASM modules actually access them via proxy_get_buffer_bytes. Signed-off-by: Hiram Chirino <hiram@hiramchirino.com>
…ency • Add HttpResponseBody class for lazy response body management with supplier-based loading • Add deferred loading mechanism - response body only loaded when WASM modules access it • Fix request body processing logic to properly handle early returns for non-body plugins • Update response header filtering logic to skip unnecessary processing when no body handling needed This implementation extends the existing lazy request body loading concept to response bodies, providing significant memory and performance improvements. The lazy loading mechanism ensures response bodies are only read from the output stream when WASM plugins actually call proxy_get_buffer_bytes to access the data. This prevents unnecessary memory allocation and I/O operations for plugins that process headers but don't need response body content, while maintaining full backward compatibility with existing plugin implementations. Signed-off-by: Hiram Chirino <hiram@hiramchirino.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.
commit 6dca5a0 (HEAD -> lazy-loading, chirino/lazy-loading)
Author: Hiram Chirino hiram@hiramchirino.com
Date: Mon Jun 2 16:22:20 2025 -0400
commit 4bb0309
Author: Hiram Chirino hiram@hiramchirino.com
Date: Mon Jun 2 14:44:22 2025 -0400