Skip to content

http conn man: stopped filters can add data from encodeTrailers#8404

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
ascheglov:feature/add-data-from-encode-trailers
Oct 1, 2019
Merged

http conn man: stopped filters can add data from encodeTrailers#8404
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
ascheglov:feature/add-data-from-encode-trailers

Conversation

@ascheglov
Copy link
Copy Markdown
Contributor

Now filters can return StopIteration from encodeHeaders,
and then call addEncodedData from encodeTrailers.

This allows the JsonTranscoderFilter to properly transcode gRPC status
in trailer headers into a JSON reply body.

Risk Level: Low
Testing: manual testing, unit-tests, integration tests in gRPC JSON transcoder filter.
Documentation: n/a
Release notes: n/a
Fixes #8402

Now filters can return StopIteration from encodeHeaders,
and then call addEncodedData from encodeTrailers.

This allows the JsonTranscoderFilter to properly transcode gRPC status
in trailer headers into a JSON reply body.

Risk Level: Low
Testing: unit-tests, integration tests in gRPC JSON transcoder filter.
Documentation: n/a
Release notes: n/a
Fixes envoyproxy#8402

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
@ascheglov ascheglov requested a review from lizan as a code owner September 26, 2019 22:29
@mattklein123 mattklein123 self-assigned this Sep 26, 2019
Copy link
Copy Markdown
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 for this change and all of the tests. This makes sense to me. Can you make a parallel change in the decode path as well? Thank you!

/wait

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Copy link
Copy Markdown
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. One additional test request. Thank you!

/wait

EXPECT_CALL(*decoder_filters_[0], decodeTrailers(_))
.WillOnce(InvokeWithoutArgs([&]() -> FilterTrailersStatus {
decoder_filters_[0]->callbacks_->addDecodedData(trailers_data, false);
return FilterTrailersStatus::Continue;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a similar parallel test in which the filter decode/encodeTrailers() callbacks continue to stop iteration and then do a continuation later outside of callback context?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
Copy link
Copy Markdown
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.

Awesome work, thank you!

@mattklein123 mattklein123 merged commit 429d6c4 into envoyproxy:master Oct 1, 2019
danzh2010 pushed a commit to danzh2010/envoy that referenced this pull request Oct 4, 2019
…yproxy#8404)

Now filters can return StopIteration from encodeHeaders,
and then call addEncodedData from encodeTrailers.

This allows the JsonTranscoderFilter to properly transcode gRPC status
in trailer headers into a JSON reply body.

Risk Level: Low
Testing: unit-tests, integration tests in gRPC JSON transcoder filter.
Documentation: n/a
Release notes: n/a
Fixes envoyproxy#8402

Signed-off-by: Anatoly Scheglov <ascheglov@yandex-team.ru>
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.

Filter can't add data from encodeTrailers

2 participants