From c22b2543c6a58e703d9b29200f522712c53d225a Mon Sep 17 00:00:00 2001 From: Moritz Barsnick Date: Thu, 19 Sep 2024 16:28:13 +0200 Subject: [PATCH] Uri: fix schema reporting "ws://" was being reported as secure. Use `get_scheme()` to also correctly report the supported (legacy) "http(s)" URIs. Fixes https://github.com/EVerest/libocpp/issues/697 Signed-off-by: Moritz Barsnick --- lib/ocpp/common/websocket/websocket_uri.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ocpp/common/websocket/websocket_uri.cpp b/lib/ocpp/common/websocket/websocket_uri.cpp index 26dc32cf1..50a441635 100644 --- a/lib/ocpp/common/websocket/websocket_uri.cpp +++ b/lib/ocpp/common/websocket/websocket_uri.cpp @@ -60,16 +60,16 @@ Uri Uri::parse_and_validate(std::string uri, std::string chargepoint_id, int sec case security::SecurityProfile::UNSECURED_TRANSPORT_WITH_BASIC_AUTHENTICATION: if (uri_temp.get_secure()) { throw std::invalid_argument( - "secure schema 'ws://' in URI does not fit with insecure security-profile = " + - std::to_string(security_profile)); + "secure schema '" + uri_temp.get_scheme() + + "://' in URI does not fit with insecure security-profile = " + std::to_string(security_profile)); } break; case security::SecurityProfile::TLS_WITH_BASIC_AUTHENTICATION: case security::SecurityProfile::TLS_WITH_CLIENT_SIDE_CERTIFICATES: if (!uri_temp.get_secure()) { throw std::invalid_argument( - "insecure schema 'ws://' in URI does not fit with secure security-profile = " + - std::to_string(security_profile)); + "insecure schema '" + uri_temp.get_scheme() + + "://' in URI does not fit with secure security-profile = " + std::to_string(security_profile)); } break; default: