Fix IndexOutOfBoundsException when calling PostRequest.getUpstreamHeaders#326
Open
MariaLapovska wants to merge 1 commit intoapache:mainfrom
Open
Fix IndexOutOfBoundsException when calling PostRequest.getUpstreamHeaders#326MariaLapovska wants to merge 1 commit intoapache:mainfrom
MariaLapovska wants to merge 1 commit intoapache:mainfrom
Conversation
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.
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Related issues
bug: PostRequest.getUpstreamHeaders cause IndexOutOfBoundsException Error #325
request help: request.getUpstreamHeaders java.lang.IndexOutOfBoundsException: null? #228
bug: 在PluginFilter类中通过requiredRespBody()方法设置为true后,在插件中调用PostRequest..getUpstreamHeaders()方法会偶现(概率很高)报错java.lang.IndexOutOfBoundsException: null #234
Bugfix
Currently, if you try to call PostRequest.getUpstreamHeaders() in postFilter(), it intermittently throws IndexOutOfBoundsException (specifically headersLength() method in Req class):
If we follow the same pattern as RpcHandler does with HttpRequest, where it pre-reads the headers, we avoid the given issue, where by the time PostRequest.getUpstreamHeaders() is called from inside one of the plugins, the ByteBuffer could be corrupted, reused, or have a wrong position.