diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/async_resolve.hpp | 5 | ||||
-rw-r--r-- | include/event_service_store.hpp | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp index 3f31e1383f..71d2497e26 100644 --- a/include/async_resolve.hpp +++ b/include/async_resolve.hpp @@ -63,7 +63,7 @@ class Resolver // This function is kept using snake case so that it is interoperable with // boost::asio::ip::tcp::resolver // NOLINTNEXTLINE(readability-identifier-naming) - void async_resolve(const std::string& host, std::string_view port, + void async_resolve(std::string_view host, std::string_view port, ResolveHandler&& handler) { BMCWEB_LOG_DEBUG("Trying to resolve: {}:{}", host, port); @@ -82,7 +82,8 @@ class Resolver uint64_t flag = 0; crow::connections::systemBus->async_method_call( - [host, portNum, handler{std::forward<ResolveHandler>(handler)}]( + [host{std::string(host)}, portNum, + handler{std::forward<ResolveHandler>(handler)}]( const boost::system::error_code& ec, const std::vector< std::tuple<int32_t, int32_t, std::vector<uint8_t>>>& resp, diff --git a/include/event_service_store.hpp b/include/event_service_store.hpp index 61f1ac7b0f..8b24fcbe83 100644 --- a/include/event_service_store.hpp +++ b/include/event_service_store.hpp @@ -3,6 +3,7 @@ #include <boost/beast/http/fields.hpp> #include <boost/container/flat_map.hpp> +#include <boost/url/parse.hpp> #include <nlohmann/json.hpp> namespace persistent_data @@ -11,7 +12,7 @@ namespace persistent_data struct UserSubscription { std::string id; - std::string destinationUrl; + boost::urls::url destinationUrl; std::string protocol; std::string retryPolicy; std::string customText; @@ -48,7 +49,13 @@ struct UserSubscription { continue; } - subvalue->destinationUrl = *value; + boost::urls::result<boost::urls::url> url = + boost::urls::parse_absolute_uri(*value); + if (!url) + { + continue; + } + subvalue->destinationUrl = std::move(*url); } else if (element.key() == "Protocol") { |