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

http: add headers via local reply mapper #12093

Merged

Conversation

Augustyniak
Copy link
Contributor

@Augustyniak Augustyniak commented Jul 15, 2020

Add an option for local reply mapper to add HTTP headers to local responses.

Commit Message:
Additional Description:
Risk Level: Low
Testing: Added unit tests and updated integration tests
Docs Changes: Updated
Release Notes: Updated
Fixes #11707

Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Rafal Augustyniak <[email protected]>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #12093 was opened by Augustyniak.

see: more, trace.

Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Rafal Augustyniak <[email protected]>
@Augustyniak Augustyniak marked this pull request as ready for review July 15, 2020 16:22
Signed-off-by: Rafal Augustyniak <[email protected]>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

/lgtm api

@Augustyniak
Copy link
Contributor Author

I don’t think that envoy-presubmit (Linux-x64 tsan) job’s failure has anything to do with my changes here 🤔

@junr03 junr03 self-assigned this Jul 15, 2020
Signed-off-by: Rafal Augustyniak <[email protected]>
@Augustyniak Augustyniak changed the title Add headers via local reply mapper http: add headers via local reply mapper Jul 15, 2020
Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Rafal Augustyniak <[email protected]>
@Augustyniak
Copy link
Contributor Author

@htuch can you re-approve pls? I needed to push a small doc string update in one of the proto files.

@mattklein123 mattklein123 self-assigned this Jul 16, 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 with a small comment.

/wait

// HTTP headers to add to a local reply. This allows the response mapper to append, to add
// or to override headers of any local reply before it is sent to a downstream client.
repeated config.core.v3.HeaderValueOption headers_to_add = 5
[(validate.rules).repeated = {max_items: 1000}];
Copy link
Member

Choose a reason for hiding this comment

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

I would probably remove this. The limit seems somewhat arbitrary.

Copy link
Member

Choose a reason for hiding this comment

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

We have these limits in other places for heads to add. I think it was put in for fuzzing.

Copy link
Member

Choose a reason for hiding this comment

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

I see, OK. Sounds good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is why I added this requirement - I checked other places where the list of headers was defined and basically all of them had this limitation.

mattklein123
mattklein123 previously approved these changes Jul 16, 2020
@Augustyniak Augustyniak requested a review from dio as a code owner July 16, 2020 22:26
@Augustyniak
Copy link
Contributor Author

I needed to merge master and push due to the conflict in current.rst file.

@Augustyniak Augustyniak force-pushed the add-headers-via-local-reply-mapper branch from eed90b5 to 5841230 Compare July 16, 2020 23:37
This reverts commit 53370b3.

Signed-off-by: Rafal Augustyniak <[email protected]>
@Augustyniak
Copy link
Contributor Author

Augustyniak commented Jul 17, 2020

I’m seeing the following error (I needed to merge master due to a conflict in current.rst file):

clang toolchain with libc++ configured
fix_format...
ERROR: Codecs are not synced: ./source/common/http/http2/codec_impl.cc does not match ./source/common/http/http2/codec_impl_legacy.cc. Update codec implementations to sync and/or update the diff manually to:
--- 
+++ 
@@ -1,4 +1,4 @@
-#include "common/http/http2/codec_impl.h"
+#include "common/http/http2/codec_impl_legacy.h"
 
 #include <cstdint>
 #include <memory>
@@ -25,6 +25,7 @@
 
 namespace Envoy {
 namespace Http {
+namespace Legacy {
 namespace Http2 {
 
 class Http2ResponseCodeDetailValues {
@@ -52,6 +53,9 @@
 };
 
 using Http2ResponseCodeDetails = ConstSingleton<Http2ResponseCodeDetailValues>;
+using Http::Http2::CodecStats;
+using Http::Http2::MetadataDecoder;
+using Http::Http2::MetadataEncoder;
 
 bool Utility::reconstituteCrumbledCookies(const HeaderString& key, const HeaderString& value,
                                           HeaderString& cookies) {
@@ -492,7 +496,7 @@
       max_headers_count_(max_headers_count),
       per_stream_buffer_limit_(http2_options.initial_stream_window_size().value()),

and I’m not sure how it’s related to my PR. I can update the content of the aforementioned file ^ but I’m not sure whether I should be doing this 🤔 @mattklein123 am I missing something here?

@Augustyniak
Copy link
Contributor Author

I think that merging #12142 should help to get rid of the error I mentioned in my message above.

Signed-off-by: Rafal Augustyniak <[email protected]>
@Augustyniak
Copy link
Contributor Author

@mattklein123 @htuch After a few merges of master it’s green again and ready to be merged.

@mattklein123 mattklein123 merged commit 23df4fc into envoyproxy:master Jul 17, 2020
KBaichoo pushed a commit to KBaichoo/envoy that referenced this pull request Jul 30, 2020
Signed-off-by: Rafal Augustyniak <[email protected]>
Signed-off-by: Kevin Baichoo <[email protected]>
scheler pushed a commit to scheler/envoy that referenced this pull request Aug 4, 2020
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.

Fault Filter - Abort Faults' Responses
5 participants