Skip to content
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

Storing underlying request part iterator with RequestBody #634

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

adam-fowler
Copy link
Member

If you try to run withInboundCloseHandler on a request body that has been edited, there is a good chance you won't have a reference to the original request part iterator that is used to tell if the connection has been closed. If you did have a reference to the original iterator either it had iterated past the request body so couldn't be used to feed the request body in withInboundCloseHandler or it would provide the buffers from the original request and not the edited buffers.

To get around this we

  • Store HTTPRequestPart iterator from original RequestBody with any subsequent request body setup.
  • Using RequestBody.mergeWithUnderlyingRequestPartIterator we combine the current RequestBody with the original RequestPart iterator. With this we can supply the RequestBody buffer stream, but then also verify if the connection has been closed.

@adam-fowler adam-fowler requested a review from Joannis as a code owner December 9, 2024 15:39
@adam-fowler adam-fowler force-pushed the cancel-on-inbound-close2 branch from c2bbca4 to 7bdc69e Compare December 12, 2024 10:12
@adam-fowler adam-fowler force-pushed the storing-underlying-request-body branch from 4fda44d to ebee606 Compare December 13, 2024 15:17
Base automatically changed from cancel-on-inbound-close2 to main December 13, 2024 15:18
@adam-fowler adam-fowler force-pushed the storing-underlying-request-body branch from ebee606 to 102d455 Compare December 13, 2024 15:20
@adam-fowler adam-fowler merged commit 294b620 into main Dec 13, 2024
7 checks passed
@adam-fowler adam-fowler deleted the storing-underlying-request-body branch December 13, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants