Skip to content

Commit

Permalink
Uri: fix schema reporting
Browse files Browse the repository at this point in the history
"ws://" was being reported as secure.

Use `get_scheme()` to also correctly report the supported (legacy) "http(s)"
URIs.

Fixes #697

Signed-off-by: Moritz Barsnick <[email protected]>
  • Loading branch information
barsnick committed Sep 27, 2024
1 parent 8c59de3 commit c22b254
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ocpp/common/websocket/websocket_uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c22b254

Please sign in to comment.