userver: userver/server/handlers/handler_config.hpp Source File
Loading...
Searching...
No Matches
handler_config.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/server/handlers/handler_config.hpp
4/// @brief HTTP handler static configuration
5
6#include <optional>
7#include <string>
8#include <variant>
9#include <vector>
10
11#include <userver/server/handlers/auth/handler_auth_config.hpp>
12#include <userver/server/handlers/fallback_handlers.hpp>
13#include <userver/server/http/http_status.hpp>
14#include <userver/server/request/request_config.hpp>
15
16USERVER_NAMESPACE_BEGIN
17
18namespace server {
19struct ServerConfig;
20} // namespace server
21
22namespace server::handlers {
23
24/// Defines matching behavior for paths with trailing slashes.
26 kBoth, ///< ignore trailing slashes when matching paths
27 kStrictMatch, ///< require exact match for trailing slashes in paths
28
29 kDefault = kBoth,
30};
31
33 std::variant<std::string, FallbackHandler> path;
34 std::optional<std::string> task_processor;
35 std::string method;
36 request::HttpRequestConfig request_config{};
37 size_t request_body_size_log_limit{0};
38 size_t request_headers_size_log_limit{0};
39 size_t response_data_size_log_limit{0};
40 std::optional<auth::HandlerAuthConfig> auth;
41 UrlTrailingSlashOption url_trailing_slash{UrlTrailingSlashOption::kDefault};
42 std::optional<size_t> max_requests_in_flight;
43 std::optional<size_t> max_requests_per_second;
44 bool decompress_request{true};
45 bool throttling_enabled{true};
46 bool response_body_stream{false};
47 std::optional<bool> set_response_server_hostname;
48 bool set_tracing_headers{true};
49 bool deadline_propagation_enabled{true};
50 bool deadline_propagation_prefer_timestamp{false};
51 bool enable_write_statistics{true};
52 http::HttpStatus deadline_expired_status_code{498};
53};
54
55HandlerConfig ParseHandlerConfigsWithDefaults(
56 const yaml_config::YamlConfig& value,
57 const server::ServerConfig& server_config,
58 bool is_monitor = false
59);
60
61} // namespace server::handlers
62
63USERVER_NAMESPACE_END