forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: allow decoding/encoding a header only request/response (envoypr…
…oxy#4885) This adds a new return value to encodeHeaders that indicates that filter iteration should immediately stop, dropping any pending data/trailers. This results in a header only request/response, which can be used to terminate stream processing early, eg in case of invalid request or response. Signed-off-by: Snow Pettersen <snowp@squareup.com> Signed-off-by: Fred Douglas <fredlas@google.com>
- Loading branch information
Showing
13 changed files
with
511 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "envoy/http/filter.h" | ||
#include "envoy/server/filter_config.h" | ||
|
||
#include "extensions/filters/http/common/empty_http_filter_config.h" | ||
|
||
namespace Envoy { | ||
|
||
// DRYs up the creation of a simple filter config for a filter that requires no config. | ||
template <class T> | ||
class SimpleFilterConfig : public Extensions::HttpFilters::Common::EmptyHttpFilterConfig { | ||
public: | ||
SimpleFilterConfig() : EmptyHttpFilterConfig(T::name) {} | ||
|
||
Http::FilterFactoryCb createFilter(const std::string&, Server::Configuration::FactoryContext&) { | ||
return [](Http::FilterChainFactoryCallbacks& callbacks) -> void { | ||
callbacks.addStreamFilter(std::make_shared<T>()); | ||
}; | ||
} | ||
}; | ||
|
||
} // namespace Envoy |
Oops, something went wrong.