Skip to content

http: Allow http filters to add a body that's not readily available to a headers-only request/response#12832

Merged
mattklein123 merged 17 commits intoenvoyproxy:masterfrom
yosrym93:headers-continue-dont-end-stream
Sep 4, 2020
Merged

http: Allow http filters to add a body that's not readily available to a headers-only request/response#12832
mattklein123 merged 17 commits intoenvoyproxy:masterfrom
yosrym93:headers-continue-dont-end-stream

Conversation

@yosrym93
Copy link
Contributor

@yosrym93 yosrym93 commented Aug 26, 2020

Commit Message:
Allow HTTP filters to add a body that's not readily available to a headers-only request/response.
Signed-off-by: Yosry Ahmed yosryahmed@google.com

Additional Description:
This is done through adding a new FilterHeadersStatus::ContinueAndDontEndStream. This allows a filter to continue headers iteration without ending the stream. The filter can then add the request/response body by using injectEncodedDataToFilterChain/injectDecodedDataToFilterChain.

Risk Level: ?
Testing: Unit and integration tests.
Docs Changes: N/A
Release Notes: N/A
Fixes #12814

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
… body

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
@yosrym93
Copy link
Contributor Author

@mattklein123 This is a draft PR for the feature we discussed in #12814. Please take a look and let me know what you think. I added a unit test, and I'll add integration tests once we agree on the implementation.

@mattklein123 mattklein123 self-assigned this Aug 27, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level this looks great, thanks. Can you also add an integration test per discussion?

/wait

…t it

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
@yosrym93
Copy link
Contributor Author

yosrym93 commented Aug 28, 2020

I updated the doc of the new FilterHeadersStatus to explain that using add... is not supported yet, with a TODO on how to support it. I also added a message to the ASSERT that fails to make it clear that it fails because continue is called while the IterationState is already Continue. Hopefully this makes the failure clear in this case.
Working on the integration test now.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…ream

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
@yosrym93 yosrym93 marked this pull request as ready for review August 29, 2020 01:44
@yosrym93 yosrym93 requested a review from mattklein123 August 29, 2020 01:45
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks great work. Just some small comments. @snowp @alyssawilk in case you want to take a quick look.

/wait

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
…r a filter that returns ContinueAndEndStream

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
@yosrym93
Copy link
Contributor Author

yosrym93 commented Sep 1, 2020

I moved the test to protocol_integration_tests and removed the default switch statement.

I also fixed the bug, done some minimum refactoring in FilterManager::decodeHeaders to be consistent with FilterManager::encodeHeaders, and updated the FilterContinueAndEndStream* tests in conn_manager_impl_test.

@yosrym93
Copy link
Contributor Author

yosrym93 commented Sep 1, 2020

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #12832 (comment) was created by @yosrym93.

see: more, trace.

mattklein123
mattklein123 previously approved these changes Sep 1, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks great. @snowp can you PTAL since you have been doing a bunch of work in this area recently? Thank you.

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this seems like a great addition, just a few comments

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more comments, thanks for iterating!

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
@yosrym93 yosrym93 requested a review from snowp September 3, 2020 22:29
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mattklein123
Copy link
Member

Awesome. Can you merge main? It was broken temporarily.

/wait

@yosrym93
Copy link
Contributor Author

yosrym93 commented Sep 4, 2020

Awesome. Can you merge main? It was broken temporarily.

/wait

Done!

@mattklein123 mattklein123 merged commit 6aedd25 into envoyproxy:master Sep 4, 2020
@yosrym93 yosrym93 deleted the headers-continue-dont-end-stream branch September 4, 2020 22:03
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.

[Feature Request] Allow HTTP filters to add a body that's not readily available to headers-only responses

3 participants