Skip to content

Commit 0a2cabc

Browse files
author
smorivan
committed
feat core: use separate http client plugins list for dynamic configs
Several changes are made in order to support dynamic config subscription in http client plugins: 1. Plugins are renamed to middlewares 2. Middlewares static configuration for @ref clients::HttpClient is updated to be more like @ref scripts/docs/en/userver/grpc/client\_middlewares.md 3. @ref clients::http::MiddlewarePipelineComponent are introduced to manage common middlewares settings 4. Dynamic configs use separate @ref clients::HttpClient instance named `dynamic-config-http-client`, so that middlewares that use dynamic configs may be disabled just for dynamic configs client and enabled for all other clients in `http-client-middleware-pipeline.middlewares` Migration guide: 1. Make sure that you use `.AppendComponentList(clients::http::ComponentList())` in your component list instead of `.Append<components::HttpClientCore>().Append<components::HttpClient>()` 2. For classes inherited from @ref tracing::TracingManagerBase: 1. Change @ref clients::http::PluginRequest in @ref tracing::TracingManagerBase::FillRequestWithTracingContext() parameters to @ref clients::http::MiddlewareRequest 3. For classes inherited from @ref clients::http::Plugin: 1. Replace `#include <userver/clients/http/plugin.hpp>` with `#include <userver/clients/http/middlewares/base.hpp>` 2. Change base class to @ref clients::http::MiddlewareBase 3. Change @ref clients::http::PluginRequest in methods parameters to @ref clients::http::MiddlewareRequest 4. Stop passing middleware name to base class constructor 5. Empty methods implementations (or `return true;` for @ref clients::http::MiddlewareBase::HookOnRetry()) may be omitted For example: ```diff -#include <userver/clients/http/plugin.hpp> +#include <userver/clients/http/middlewares/base.hpp> ... -class MyPlugin : public clients::http::Plugin { +class MyMiddleware : public clients::http::MiddlewareBase { public: ... - MyPlugin() : clients::http::Plugin("my-plugin") {} + MyMiddleware() : clients::http::MiddlewareBase() {} - void HookPerformRequest(clients::http::PluginRequest& request) override { do_something(request); } + void HookPerformRequest(clients::http::MiddlewareRequest& request) override { do_something(request); }; - void HookCreateSpan(clients::http::PluginRequest&, tracing::Span&) override {} - void HookOnCompleted(clients::http::PluginRequest&, clients::http::Response&) override {} - void HookOnError(clients::http::PluginRequest&, std::error_code) override {} - bool HookOnRetry(clients::http::PluginRequest&) override { return true; } ... }; ``` 4. For plugin components inherited from @ref clients::http::plugin::ComponentBase: 1. Replace `#include <userver/clients/http/plugin_component.hpp>` with `#include <userver/clients/http/middlewares/component.hpp>` 2. Change base class to @ref clients::http::middlewares::ComponentBase 3. Component name is not required to have prefix `http-client-plugin-` anymore, `http-client-` prefix is suggested instead 4. Rename `GetPlugin` method to `GetMiddleware`, change its return type to `clients::http::MiddlewareBase` 5. Use @ref dynamic\_config::Source::UpdateAndListen() to subscribe on dynamic config updates 6. Pass middleware index to base class constructor, instead of setting it in config file For example: ```diff -#include <userver/clients/http/plugin_component.hpp> +#include <userver/clients/http/middlewares/component.hpp> ... -class SomeComponentName : public clients::http::plugin::ComponentBase { +class SomeComponentName : public clients::http::middlewares::ComponentBase { public: - static constexpr std::string_view kName = "http-client-plugin-my-plugin-name"; + static constexpr std::string_view kName = "http-client-my-middleware-name"; - SomeComponentName(const components::ComponentConfig& config, const components::ComponentContext& context) - : ComponentBase(config, context), - plugin_(std::make_unique<Plugin>()), + SomeComponentName(const components::ComponentConfig& config, const components::ComponentContext& context) + : ComponentBase(config, context, clients::http::middlewares::MiddlewareIndex{1234}), + middleware_(std::make_unique<Middleware>()), { auto& config_component = context.FindComponent<components::DynamicConfig>(); subscriber_scope_ = - components::DynamicConfig::NoblockSubscriber{config_component} - .GetEventSource() - .AddListener(this, kName, &Component::OnConfigUpdate); + config_component + .GetSource() + .UpdateAndListen(this, kName, &Component::OnConfigUpdate); } ... - clients::http::Plugin& GetPlugin() override { return *plugin_; } + clients::http::MiddlewareBase& GetMiddleware() override { return *middleware_; } private: - std::unique_ptr<clients::http::Plugin> plugin_; + std::unique_ptr<clients::http::MiddlewareBase> middleware_; }; ``` 5. Make the following changes in static config: 1. In every @ref components::HttpClient config, rename `plugins` to `middlewares` 2. Update middleware component names to current `Component::kName` 3. Use full middleware components names as keys and `{enabled: true}` as values in `middlewares` for every @ref components::HttpClient config 4. Move middlewares that you want to use for all @ref components::HttpClient instances from `http-client.middlewares` to `http-client-middleware-pipeline.middlewares` 5. Set `dynamic-config-http-client.middlewares.<middleware name>.enabled` to `false` for all middlewares that are subscribed to dynamic configs updates For example: ```diff components_manager: components: - http-client-plugin-common-plugin-name: + http-client-common-middleware-name: ... - http-client-plugin-plugin-with-dynamic-config: + http-client-middleware-with-dynamic-config: ... - http-client: - plugins: - common-plugin-name: 1 - with-dynamic-config: 2 + http-client-middleware-pipeline: + middlewares: + http-client-common-middleware-name: + enabled: true + http-client-middleware-with-dynamic-config: + enabled: true + dynamic-config-http-client: + middlewares: + http-client-middleware-with-dynamic-config: + enabled: false ``` commit_hash:ab1885792c5fe3e25b3030f6ef998a6098d4849c
1 parent 0bee02e commit 0a2cabc

File tree

77 files changed

+910
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+910
-748
lines changed

.mapping.json

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,15 @@
725725
"core/functional_tests/http2server/tests/conftest.py":"taxi/uservices/userver/core/functional_tests/http2server/tests/conftest.py",
726726
"core/functional_tests/http2server/tests/test_http2_streaming.py":"taxi/uservices/userver/core/functional_tests/http2server/tests/test_http2_streaming.py",
727727
"core/functional_tests/http2server/tests/test_http2server.py":"taxi/uservices/userver/core/functional_tests/http2server/tests/test_http2server.py",
728-
"core/functional_tests/http_client_plugins/CMakeLists.txt":"taxi/uservices/userver/core/functional_tests/http_client_plugins/CMakeLists.txt",
729-
"core/functional_tests/http_client_plugins/config_vars.yaml":"taxi/uservices/userver/core/functional_tests/http_client_plugins/config_vars.yaml",
730-
"core/functional_tests/http_client_plugins/main.cpp":"taxi/uservices/userver/core/functional_tests/http_client_plugins/main.cpp",
731-
"core/functional_tests/http_client_plugins/src/echo_handler.hpp":"taxi/uservices/userver/core/functional_tests/http_client_plugins/src/echo_handler.hpp",
732-
"core/functional_tests/http_client_plugins/src/echo_handler_detach.hpp":"taxi/uservices/userver/core/functional_tests/http_client_plugins/src/echo_handler_detach.hpp",
733-
"core/functional_tests/http_client_plugins/src/plugin.hpp":"taxi/uservices/userver/core/functional_tests/http_client_plugins/src/plugin.hpp",
734-
"core/functional_tests/http_client_plugins/static_config.yaml":"taxi/uservices/userver/core/functional_tests/http_client_plugins/static_config.yaml",
735-
"core/functional_tests/http_client_plugins/tests/conftest.py":"taxi/uservices/userver/core/functional_tests/http_client_plugins/tests/conftest.py",
736-
"core/functional_tests/http_client_plugins/tests/test_plugin.py":"taxi/uservices/userver/core/functional_tests/http_client_plugins/tests/test_plugin.py",
728+
"core/functional_tests/http_client_middlewares/CMakeLists.txt":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/CMakeLists.txt",
729+
"core/functional_tests/http_client_middlewares/config_vars.yaml":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/config_vars.yaml",
730+
"core/functional_tests/http_client_middlewares/main.cpp":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/main.cpp",
731+
"core/functional_tests/http_client_middlewares/src/echo_handler.hpp":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/src/echo_handler.hpp",
732+
"core/functional_tests/http_client_middlewares/src/echo_handler_detach.hpp":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/src/echo_handler_detach.hpp",
733+
"core/functional_tests/http_client_middlewares/src/middleware.hpp":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/src/middleware.hpp",
734+
"core/functional_tests/http_client_middlewares/static_config.yaml":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/static_config.yaml",
735+
"core/functional_tests/http_client_middlewares/tests/conftest.py":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/tests/conftest.py",
736+
"core/functional_tests/http_client_middlewares/tests/test_middleware.py":"taxi/uservices/userver/core/functional_tests/http_client_middlewares/tests/test_middleware.py",
737737
"core/functional_tests/https/CMakeLists.txt":"taxi/uservices/userver/core/functional_tests/https/CMakeLists.txt",
738738
"core/functional_tests/https/cert.crt":"taxi/uservices/userver/core/functional_tests/https/cert.crt",
739739
"core/functional_tests/https/httpserver_handlers.hpp":"taxi/uservices/userver/core/functional_tests/https/httpserver_handlers.hpp",
@@ -835,7 +835,7 @@
835835
"core/include/userver/clients/http/cancellation_policy.hpp":"taxi/uservices/userver/core/include/userver/clients/http/cancellation_policy.hpp",
836836
"core/include/userver/clients/http/client.hpp":"taxi/uservices/userver/core/include/userver/clients/http/client.hpp",
837837
"core/include/userver/clients/http/client_core.hpp":"taxi/uservices/userver/core/include/userver/clients/http/client_core.hpp",
838-
"core/include/userver/clients/http/client_with_plugins.hpp":"taxi/uservices/userver/core/include/userver/clients/http/client_with_plugins.hpp",
838+
"core/include/userver/clients/http/client_with_middlewares.hpp":"taxi/uservices/userver/core/include/userver/clients/http/client_with_middlewares.hpp",
839839
"core/include/userver/clients/http/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/component.hpp",
840840
"core/include/userver/clients/http/component_core.hpp":"taxi/uservices/userver/core/include/userver/clients/http/component_core.hpp",
841841
"core/include/userver/clients/http/component_list.hpp":"taxi/uservices/userver/core/include/userver/clients/http/component_list.hpp",
@@ -845,11 +845,12 @@
845845
"core/include/userver/clients/http/error_kind.hpp":"taxi/uservices/userver/core/include/userver/clients/http/error_kind.hpp",
846846
"core/include/userver/clients/http/form.hpp":"taxi/uservices/userver/core/include/userver/clients/http/form.hpp",
847847
"core/include/userver/clients/http/local_stats.hpp":"taxi/uservices/userver/core/include/userver/clients/http/local_stats.hpp",
848-
"core/include/userver/clients/http/plugin.hpp":"taxi/uservices/userver/core/include/userver/clients/http/plugin.hpp",
849-
"core/include/userver/clients/http/plugin_component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/plugin_component.hpp",
850-
"core/include/userver/clients/http/plugins/headers_propagator/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/plugins/headers_propagator/component.hpp",
851-
"core/include/userver/clients/http/plugins/retry_budget/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/plugins/retry_budget/component.hpp",
852-
"core/include/userver/clients/http/plugins/yandex_tracing/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/plugins/yandex_tracing/component.hpp",
848+
"core/include/userver/clients/http/middlewares/base.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/base.hpp",
849+
"core/include/userver/clients/http/middlewares/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/component.hpp",
850+
"core/include/userver/clients/http/middlewares/headers_propagator/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/headers_propagator/component.hpp",
851+
"core/include/userver/clients/http/middlewares/pipeline_component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/pipeline_component.hpp",
852+
"core/include/userver/clients/http/middlewares/retry_budget/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/retry_budget/component.hpp",
853+
"core/include/userver/clients/http/middlewares/yandex_tracing/component.hpp":"taxi/uservices/userver/core/include/userver/clients/http/middlewares/yandex_tracing/component.hpp",
853854
"core/include/userver/clients/http/request.hpp":"taxi/uservices/userver/core/include/userver/clients/http/request.hpp",
854855
"core/include/userver/clients/http/response.hpp":"taxi/uservices/userver/core/include/userver/clients/http/response.hpp",
855856
"core/include/userver/clients/http/response_future.hpp":"taxi/uservices/userver/core/include/userver/clients/http/response_future.hpp",
@@ -1249,7 +1250,7 @@
12491250
"core/src/clients/http/client_test.cpp":"taxi/uservices/userver/core/src/clients/http/client_test.cpp",
12501251
"core/src/clients/http/client_utils_test.hpp":"taxi/uservices/userver/core/src/clients/http/client_utils_test.hpp",
12511252
"core/src/clients/http/client_wait_test.cpp":"taxi/uservices/userver/core/src/clients/http/client_wait_test.cpp",
1252-
"core/src/clients/http/client_with_plugins.cpp":"taxi/uservices/userver/core/src/clients/http/client_with_plugins.cpp",
1253+
"core/src/clients/http/client_with_middlewares.cpp":"taxi/uservices/userver/core/src/clients/http/client_with_middlewares.cpp",
12531254
"core/src/clients/http/component.cpp":"taxi/uservices/userver/core/src/clients/http/component.cpp",
12541255
"core/src/clients/http/component.yaml":"taxi/uservices/userver/core/src/clients/http/component.yaml",
12551256
"core/src/clients/http/component_core.cpp":"taxi/uservices/userver/core/src/clients/http/component_core.cpp",
@@ -1266,19 +1267,24 @@
12661267
"core/src/clients/http/form.cpp":"taxi/uservices/userver/core/src/clients/http/form.cpp",
12671268
"core/src/clients/http/form_test.cpp":"taxi/uservices/userver/core/src/clients/http/form_test.cpp",
12681269
"core/src/clients/http/http_method_test.cpp":"taxi/uservices/userver/core/src/clients/http/http_method_test.cpp",
1269-
"core/src/clients/http/plugin.cpp":"taxi/uservices/userver/core/src/clients/http/plugin.cpp",
1270-
"core/src/clients/http/plugins/headers_propagator/component.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/headers_propagator/component.cpp",
1271-
"core/src/clients/http/plugins/headers_propagator/plugin.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/headers_propagator/plugin.cpp",
1272-
"core/src/clients/http/plugins/headers_propagator/plugin.hpp":"taxi/uservices/userver/core/src/clients/http/plugins/headers_propagator/plugin.hpp",
1273-
"core/src/clients/http/plugins/retry_budget/component.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/component.cpp",
1274-
"core/src/clients/http/plugins/retry_budget/component.yaml":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/component.yaml",
1275-
"core/src/clients/http/plugins/retry_budget/plugin.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/plugin.cpp",
1276-
"core/src/clients/http/plugins/retry_budget/plugin.hpp":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/plugin.hpp",
1277-
"core/src/clients/http/plugins/retry_budget/plugin_test.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/plugin_test.cpp",
1278-
"core/src/clients/http/plugins/retry_budget/storage.hpp":"taxi/uservices/userver/core/src/clients/http/plugins/retry_budget/storage.hpp",
1279-
"core/src/clients/http/plugins/yandex_tracing/component.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/yandex_tracing/component.cpp",
1280-
"core/src/clients/http/plugins/yandex_tracing/plugin.cpp":"taxi/uservices/userver/core/src/clients/http/plugins/yandex_tracing/plugin.cpp",
1281-
"core/src/clients/http/plugins/yandex_tracing/plugin.hpp":"taxi/uservices/userver/core/src/clients/http/plugins/yandex_tracing/plugin.hpp",
1270+
"core/src/clients/http/middlewares/base.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/base.cpp",
1271+
"core/src/clients/http/middlewares/component.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/component.cpp",
1272+
"core/src/clients/http/middlewares/headers_propagator/component.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/headers_propagator/component.cpp",
1273+
"core/src/clients/http/middlewares/headers_propagator/middleware.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/headers_propagator/middleware.cpp",
1274+
"core/src/clients/http/middlewares/headers_propagator/middleware.hpp":"taxi/uservices/userver/core/src/clients/http/middlewares/headers_propagator/middleware.hpp",
1275+
"core/src/clients/http/middlewares/pipeline.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/pipeline.cpp",
1276+
"core/src/clients/http/middlewares/pipeline.hpp":"taxi/uservices/userver/core/src/clients/http/middlewares/pipeline.hpp",
1277+
"core/src/clients/http/middlewares/pipeline_component.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/pipeline_component.cpp",
1278+
"core/src/clients/http/middlewares/pipeline_component.yaml":"taxi/uservices/userver/core/src/clients/http/middlewares/pipeline_component.yaml",
1279+
"core/src/clients/http/middlewares/retry_budget/component.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/component.cpp",
1280+
"core/src/clients/http/middlewares/retry_budget/component.yaml":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/component.yaml",
1281+
"core/src/clients/http/middlewares/retry_budget/middleware.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/middleware.cpp",
1282+
"core/src/clients/http/middlewares/retry_budget/middleware.hpp":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/middleware.hpp",
1283+
"core/src/clients/http/middlewares/retry_budget/middleware_test.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/middleware_test.cpp",
1284+
"core/src/clients/http/middlewares/retry_budget/storage.hpp":"taxi/uservices/userver/core/src/clients/http/middlewares/retry_budget/storage.hpp",
1285+
"core/src/clients/http/middlewares/yandex_tracing/component.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/yandex_tracing/component.cpp",
1286+
"core/src/clients/http/middlewares/yandex_tracing/middleware.cpp":"taxi/uservices/userver/core/src/clients/http/middlewares/yandex_tracing/middleware.cpp",
1287+
"core/src/clients/http/middlewares/yandex_tracing/middleware.hpp":"taxi/uservices/userver/core/src/clients/http/middlewares/yandex_tracing/middleware.hpp",
12821288
"core/src/clients/http/request.cpp":"taxi/uservices/userver/core/src/clients/http/request.cpp",
12831289
"core/src/clients/http/request_state.cpp":"taxi/uservices/userver/core/src/clients/http/request_state.cpp",
12841290
"core/src/clients/http/request_state.hpp":"taxi/uservices/userver/core/src/clients/http/request_state.hpp",

chaotic-openapi/chaotic_openapi/back/cpp_client/templates/client_impl.cpp.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ ClientImpl::ClientImpl(const USERVER_NAMESPACE::chaotic::openapi::client::Config
2222
) {
2323
auto r = http_client_.CreateRequest();
2424
r.SetUrlTemplate("{{ op.path }}");
25-
if (plugins_) {
26-
r.SetPluginsList(*plugins_);
25+
if (core_middlewares_) {
26+
r.SetMiddlewaresList(*core_middlewares_);
2727
}
2828
ApplyConfig(r, command_control, config_);
2929

chaotic-openapi/chaotic_openapi/back/cpp_client/templates/client_impl.hpp.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ public:
4747
middleware_manager_.RegisterMiddleware(middleware);
4848
}
4949

50-
void SetPlugins(std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::Plugin*>>> plugins) {
51-
plugins_ = std::move(plugins);
50+
void SetCoreMiddlewares(std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::MiddlewareBase*>>> core_middlewares) {
51+
core_middlewares_ = std::move(core_middlewares);
5252
}
5353

5454
private:
5555
USERVER_NAMESPACE::chaotic::openapi::client::Config config_;
5656
USERVER_NAMESPACE::clients::http::Client& http_client_;
5757
USERVER_NAMESPACE::chaotic::openapi::MiddlewareManager middleware_manager_;
5858
std::unordered_map<std::string, std::shared_ptr<USERVER_NAMESPACE::chaotic::openapi::client::Middleware>> middlewares_;
59-
std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::Plugin*>>> plugins_;
59+
std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::MiddlewareBase*>>> core_middlewares_;
6060
};
6161

6262
}

chaotic-openapi/chaotic_openapi/back/cpp_client/templates/component.cpp.jinja

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include <userver/chaotic/openapi/client/config.hpp>
44
#include <userver/chaotic/openapi/client/middleware_factory.hpp>
5-
#include <userver/clients/http/plugin.hpp>
6-
#include <userver/clients/http/plugin_component.hpp>
5+
#include <userver/clients/http/middlewares/base.hpp>
6+
#include <userver/clients/http/middlewares/component.hpp>
77
#include <userver/components/component_context.hpp>
88
#include <userver/yaml_config/merge_schemas.hpp>
99

@@ -34,17 +34,17 @@ Component::Component(const USERVER_NAMESPACE::components::ComponentConfig& confi
3434
client_.RegisterMiddleware(middleware);
3535
}
3636

37-
const auto& names = config["plugins"].As<std::optional<std::vector<std::string>>>(std::nullopt);
38-
std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::Plugin*>>> plugins;
37+
const auto& names = config["core-middlewares"].As<std::optional<std::vector<std::string>>>(std::nullopt);
38+
std::optional<std::vector<USERVER_NAMESPACE::utils::NotNull<USERVER_NAMESPACE::clients::http::MiddlewareBase*>>> core_middlewares;
3939
if (names) {
40-
plugins.emplace();
40+
core_middlewares.emplace();
4141
for (const auto& name : *names) {
4242
auto& component =
43-
context.FindComponent<USERVER_NAMESPACE::clients::http::plugin::ComponentBase>(std::string{"http-client-plugin-"} + name);
44-
plugins->emplace_back(&component.GetPlugin());
43+
context.FindComponent<USERVER_NAMESPACE::clients::http::middlewares::ComponentBase>(name);
44+
core_middlewares->emplace_back(&component.GetMiddleware());
4545
}
4646
}
47-
client_.SetPlugins(std::move(plugins));
47+
client_.SetCoreMiddlewares(std::move(core_middlewares));
4848
}
4949
}
5050

core/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ list(APPEND EMBED_FILES
122122
src/cache/lru_cache_component_base.yaml
123123
src/clients/http/component.yaml
124124
src/clients/http/component_core.yaml
125-
src/clients/http/plugins/retry_budget/component.yaml
125+
src/clients/http/middlewares/pipeline_component.yaml
126+
src/clients/http/middlewares/retry_budget/component.yaml
126127
src/components/impl/component_base.yaml
127128
src/components/dump_configurator.yaml
128129
src/components/fs_cache.yaml

core/functional_tests/http_client_plugins/CMakeLists.txt renamed to core/functional_tests/http_client_middlewares/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project(userver-core-tests-http-client-plugins CXX)
1+
project(userver-core-tests-http-client-middlewares CXX)
22

33
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*pp")
44
add_executable(${PROJECT_NAME} ${SOURCES} "main.cpp")

core/functional_tests/http_client_plugins/config_vars.yaml renamed to core/functional_tests/http_client_middlewares/config_vars.yaml

File renamed without changes.

core/functional_tests/http_client_plugins/main.cpp renamed to core/functional_tests/http_client_middlewares/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <echo_handler.hpp>
1111
#include <echo_handler_detach.hpp>
12-
#include <plugin.hpp>
12+
#include <middleware.hpp>
1313

1414
int main(int argc, char* argv[]) {
1515
const auto component_list =
@@ -19,7 +19,7 @@ int main(int argc, char* argv[]) {
1919
.Append<components::TestsuiteSupport>()
2020
.Append<server::handlers::TestsControl>()
2121
.Append<clients::dns::Component>()
22-
.Append<PluginComponent>()
22+
.Append<MiddlewareComponent>()
2323
.AppendComponentList(clients::http::ComponentList());
2424
return utils::DaemonMain(argc, argv, component_list);
2525
}

core/functional_tests/http_client_plugins/src/echo_handler.hpp renamed to core/functional_tests/http_client_middlewares/src/echo_handler.hpp

File renamed without changes.

core/functional_tests/http_client_plugins/src/echo_handler_detach.hpp renamed to core/functional_tests/http_client_middlewares/src/echo_handler_detach.hpp

File renamed without changes.

0 commit comments

Comments
 (0)